src stringlengths 721 1.04M |
|---|
#!/usr/bin/python
# eMPL_client.py
# A PC application for use with Embedded MotionApps.
# Copyright 2012 InvenSense, Inc. All Rights Reserved.
import serial, sys, time, string, pygame
from ponycube import *
class eMPL_packet_reader:
def __init__(self, port, quat_delegate=None, debug_delegate=None, data... |
# coding=utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open p... |
# Copyright 2014 Timothy Zhang(zt@live.cn).
#
# This file is part of Structer.
#
# Structer 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 vers... |
#!/usr/bin/python
#------------------------------------------------------------------------------
# Copyright (C) 2013 Bradley Hilton <bradleyhilton@bradleyhilton.com>
#
# Distributed under the terms of the GNU GENERAL PUBLIC LICENSE V3.
#_______________________________________________________________________... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from pows.apps.forum.views import *
urlpatterns = patterns('',
# landing page of a forum
url(r'^$',
ForumIndexView.as_view(),
name='forum-index',
),
# topic list of a forum
url(r'^forum/(?P<forum_id>\w+)/$'... |
import argparse
import os
from hmm_kit import HMMModel
import pandas as pd
import numpy as np
from hmm_kit import bwiter
from sklearn.cluster import KMeans
import pickle as pkl
def train_model(input_path, kernel, states, emission=None, transition=None, model_name=None, html=False):
input_dir = os.path.dirname(os... |
from django.shortcuts import render_to_response, redirect, render
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.conf import settings
from github3 import login
from .forms import ReviewRequestForm
... |
from importlib import import_module
import inspect
import os
import re
from django import template
from django.template import RequestContext
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.db import models
from django.shortcuts import render_to_resp... |
import asyncio
import discord
import datetime
import time
import random
from discord.ext import commands
from Cogs import Settings, DisplayName, Nullify, CheckRoles, UserTime, Message, PickList
def setup(bot):
# Add the bot and deps
settings = bot.get_cog("Settings")
bot.add_cog(Xp(bot, settings))
... |
#/bin/python
# Script will be run as a cron job every minute
# Steps:
# 1 - Obtain current state (read GPIO pins)
# 2 - Read the schedule
# 2a - Get the current position of the state machine
# 3 - Determine if anything needs to happen on the schedule
# 3a - Perform operations
# - Determine if the pump was on recentl... |
from lexer import lang
from ..tree import Node
class IfStat(Node):
"""docstring for IfStat."""
def __init__(self, exp, stats, else_stat, token):
super().__init__(None, token)
self.exp = exp or Node(None, token)
self.stats = stats
self.else_stat = else_stat
def process_sema... |
from queue import Queue
seed = 1362
seen = set()
def is_empty(x, y):
n = x*x + 3*x + 2*x*y + y + y*y + seed
return bin(n).count('1') % 2 == 0
def valid_moves(x, y):
result = []
actions = [-1, 1]
for action in actions:
new_x = x + action
if x > 0 and is_empty(new_x, y) and (new_x... |
#!===================================================================
#! Examples of distributions with singularities
#!===================================================================
from functools import partial
from pylab import *
from mpl_toolkits.axes_grid.inset_locator import zoomed_inset_axes
from mpl_toolk... |
# logic: detect idle time from mac os (mouse and keyboard) and force to go to a specific website
# to run the program, administrator needs to set the sleeptime, temp_idle_value and url
# Firefox should be the default browser, hide all other applications and docking on the screen
# set no screensaver
# install fullscre... |
"""
Copyright 2010 Sami Dalouche
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 ... |
import boto3,json,imp,pprint
from botocore.exceptions import ClientError
import logging
appversions = []
def log (message):
print id() + ": " + message
def id():
return "eb"
def get_env_elb(envname,region, current_session):
client = current_session.client('elasticbeanstalk')
response = ""
elb_na... |
import numpy as np
import matplotlib.pyplot as plt
from errsim import *
def label(d, pe, pb, n):
if pb is None:
pb = pe
label = 'd={} pe={} n={} BSC'.format(d, pe, n)
else:
label = 'd={} pe={} n={} pb={}'.format(d, pe, n, pb)
return label
def plot(pe, fpath=None):
fig, ax = pl... |
# slightly modified from
# https://gist.github.com/trungly/5889154
from http.server import HTTPServer
from http.server import SimpleHTTPRequestHandler
import urllib.parse
class GetHandler(SimpleHTTPRequestHandler):
def do_HEAD(self):
parsed_path = urllib.parse.urlparse(self.path)
if parsed_path.p... |
def scrapeCafe():
"""
Scrape the EastBay Cafe's site for the current lunch menu
"""
from bs4 import BeautifulSoup
import requests
# Get the page contents and make a soup object from it
page = requests.get('http://www.eastbaycafe.com/menu.php')
the_html = BeautifulSoup(page.text)
mapping = {
'Steam \'n T... |
# -*- coding: utf-8 -*-
__doc__ = """
Add WebSocket support to the built-in WSGI server
provided by the :py:mod:`wsgiref`. This is clearly not
meant to be a production server so please consider this
only for testing purpose.
Mostly, this module overrides bits and pieces of
the built-in classes so that it supports the ... |
'''
Database Models
Models defined here
===================
1. User
2. Employee
3. Workplace
4. Training
5. Letter
6. LearningAssignment
'''
import os
from datetime import date, datetime
from pony.orm import Database, sql_debug
from pony.orm import Required, Optional, Set
__all__ = ['db', 'User', 'Employee', 'Wor... |
# Copyright 2010-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from itertools import permutations
import fnmatch
import sys
import tempfile
import portage
from portage import os
from portage import shutil
from portage.const import (GLOBAL_CONFIG_PATH, PORTAGE_BASE_PATH,
USE... |
import os
import logging
import ckan.plugins as p
from ckanext.archiver.tasks import update_package, update_resource
log = logging.getLogger(__name__)
def compat_enqueue(name, fn, queue, args=None):
u'''
Enqueue a background job using Celery or RQ.
'''
try:
# Try to use RQ
from ckan.... |
#!/usr/bin/env python
# Copyright (c) 2010 Eric S. Raymond <esr@thyrsus.com>
# Distributed under BSD terms.
#
# Google changes (iustin):
# - taken from upstream git repo, contrib/ciabot/ciabot.py
# - disabled cgit.cgi and use gitweb as we use it on git.ganeti.org
# (url tweaked)
# - to not use tinyurl
# - remove the ... |
#!/usr/bin/env python
# By hcs with tweaks by Kef Schecter
# Requires Python 2.7 or greater
from __future__ import division
from contextlib import contextmanager
from struct import unpack, pack
import argparse
import sys
import wave
EN_SAMPLE_RATES = (
12000, # File 0
15000, # File 1
7000, # File 2
)
... |
"""
Add functions corresponding to each of the actions in the json file.
The function should be named as follows <feature name>_<action_name>
"""
from gdeploylib import defaults, Helpers, Global, YamlWriter
import os, re
from os.path import basename
from collections import defaultdict
helpers = Helpers()
writers = Yam... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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
#
# ... |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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 3 of the License, or
(at your option) any later version.
T... |
# -*- coding: utf-8 -*-
#################################################################################
# Facefinder: Crawl pictures based on known faces and extract information. #
# Copyright (C) 2016 Xoán Antelo Castro #
# ... |
# pylint: disable=W0231,E1101
import collections
import warnings
import operator
import weakref
import gc
import json
import numpy as np
import pandas as pd
from pandas._libs import tslib, lib, properties
from pandas.core.dtypes.common import (
_ensure_int64,
_ensure_object,
is_scalar,
is_number,
... |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
from nose.plugins.skip import SkipTest... |
# Copyright 2019 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 agreed to in writing, ... |
#!/usr/bin/python3
# Petter Strandmark
import sys
import matplotlib.pyplot as plt
LOOKING_FOR_DATA = 1
READING_DATA = 2
state = LOOKING_FOR_DATA
iterations = []
objectives = []
relative_changes_in_x = []
relative_changes_in_y = []
feasibilities = []
optimal_value = None
for line in s... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
else:
access = Ser... |
#!/usr/bin/python
import sys
import pprint
import time
import datetime
from dateutil import parser
from google.appengine.ext import ndb
from apiclient.discovery import build
from google.appengine.ext import webapp
service = build('calendar', 'v3')
def getCalendarList(httpAuth):
request = service.calendarList(... |
# Распределение зерна на еду и на посев
import re
import data, ask, act
from event import Event
class Distribute(Event):
"""Распределение зерна"""
#
def start(self):
"""docstring for start"""
self.min_for_food = data.resources['peasant'] + data.resources['soldier'] + 1
self.min... |
# -*- coding: utf-8 -*-
#
from django.shortcuts import get_object_or_404
from rest_framework.viewsets import ModelViewSet
from rest_framework_bulk import BulkModelViewSet
from common.mixins import IDInCacheFilterMixin
from ..utils import set_to_root_org
from ..models import Organization
__all__ = [
'RootOrgViewMi... |
# 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, software
# distributed under the... |
from __future__ import unicode_literals
import logging
from django.contrib.staticfiles.storage import staticfiles_storage
from django import template
from django.template.base import VariableDoesNotExist
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from ..collect... |
import struct
class BufferReader():
def __init__(self, buf, endian='<'):
self._buffer = buf
self._length = len(buf)
self._endian = endian
self._offset = 0
self._error = False
@property
def error(self):
return self._error
def set_endian(... |
from pathlib import Path
from diot import Diot
from bioprocs.utils import shell2 as shell, logger
from bioprocs.utils.parallel import Parallel, distributeList
{%from os import path%}
{%from pyppl.utils import always_list%}
infile = {{i.infile | quote}}
afile = {{i.afile | ?path.isfile | =readlines | !always_lis... |
from unittest import TestCase
from string_utils import is_palindrome
class IsPalindromeTestCase(TestCase):
def test_non_string_objects_return_false(self):
# noinspection PyTypeChecker
self.assertFalse(is_palindrome(1))
# noinspection PyTypeChecker
self.assertFalse(is_palindrome([... |
from django.db import models
from django.utils import timezone
from django.db.models import Q
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from django.contrib.auth.models import AbstractBaseUser, UserManager, PermissionsMixin
import os
reward_threshold=100
reward_expir... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import calendar
import os
import pandas as pd
# Правила подсчета очков:
#
# за участие в матче – 2 очка, если сыграно 10 минут и больше; 1 очко, если сыграно меньше 10 минут
#
# за победу – 3 очка (в гостях); 2 очка (дома)
#
# за поражение – минус 3 очка (дома); минуc... |
from ete3 import Tree, TreeStyle
import sys, re
#read in the bootstrapped consensus tree from one of Cedric's families. Ask whether the candidate LGT has phylogenetic support at some bootstrap threshold by checking various tree-based criteria for LGTs
#Arguments: treefile target_sequence_tag
#euk_supergroups = ['Vir... |
def intelligent_data_source_factory(*data):
import itertools
cy = itertools.cycle(data)
_int = int
return lambda i: _int(i) if isinstance(i, str) else next(cy)
int = intelligent_data_source_factory(1985, 33067, 84)
# int = intelligent_data_source_factory(2012, 9, 30) # invalid
# int = intelligent_d... |
"""Tests for SwarmSpawner"""
from getpass import getuser
import pytest
from jupyterhub.tests.mocking import public_url
from jupyterhub.tests.test_api import add_user
from jupyterhub.tests.test_api import api_request
from jupyterhub.utils import url_path_join
from tornado.httpclient import AsyncHTTPClient
from dockers... |
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_group_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new")) > 0):
wd.find_element_by_link_text("groups").click()
... |
import matplotlib.pyplot as plt
import scipy.signal
import numpy as np
import math
import random
from matplotlib.backends.backend_pdf import PdfPages
samples = 51200
L = samples/512
fs = 512e6
dt = 1/fs
time = [i*dt for i in range(samples)]
def pfb_fir(x):
N = len(x)
T = 4
L = 512
bin_width_scale = 2.5
dx = T*... |
# (c) Copyright 2018-2019 SUSE 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 writ... |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from setuptools import setup, find_packages
from opps import infographics
install_requires = ["opps", 'opps-timelinejs']
classifiers = ["Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT Lic... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# Copyright 2019 DeepMind Technologies Ltd. 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import math
import Image
import numpy
ESC = '\033'
DELTA = 60
CONFIG_DATA = []
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[... |
# (C) British Crown Copyright 2012 - 2015, Met Office
#
# This file is part of Biggus.
#
# Biggus 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 version 3 of the License, or
# (at your option) a... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from pprint import pprint
import time
from utils import pairwise_distances, batchify
from config import opt, data, loaders
class SimpleClassifier(nn.Module):
def __init__(self):
... |
"""share URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... |
#!usr/bin/env python
import os
## Constants
## Constant values used in other files
TITLE = "Kanji by Radical" ## Window caption
SIZE = W,H = 800,600 ## Screen size
SMALL = W*2//3, H*2//3 ## Small screen
FPS = 60 ## Screen refresh rate
FONTSIZE = 108... |
import numpy as np
from core import *
from pic3d3v import *
from interp import *
from solvers import *
class Landau3D(object):
def __init__(self,
part_dims = (64, 64, 64),
grid_dims = (64, 64, 64),
cube_dims = (2*np.pi, 2*np.pi, 2*np.pi),
m... |
#!/usr/bin/env python
import logging
from functools import wraps
from collections import Sequence, namedtuple
from miasm2.jitter.csts import *
from miasm2.core.utils import *
from miasm2.core.bin_stream import bin_stream_vm
from miasm2.ir.ir2C import init_arch_C
hnd = logging.StreamHandler()
hnd.setFormatter(logging... |
#This program is distributed WITHOUT ANY WARRANTY; without even the implied
#warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#
#This file contains a Python version of Carl Rasmussen's Matlab-function
#minimize.m
#
#minimize.m is copyright (C) 1999 - 2006, Carl Edward Rasmussen.
#Python adaptation by ... |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted ... |
from sparktk.frame.row import Row
def drop_rows(self, predicate):
"""
Erase any row in the current frame which qualifies.
Parameters
----------
:param predicate: (UDF) Function which evaluates a row to a boolean; rows that answer True are dropped from
the frame.
Examples... |
# -*- coding: utf-8 -*-
import tempfile
import os
import shutil
import subprocess
from packaging.utils import canonicalize_name
from pip.download import unpack_url
from pip.index import Link
from piptools.resolver import Resolver
from piptools.repositories import PyPIRepository
from piptools.scripts.compile import g... |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
from telemetry import decorators
from telemetry.core import exceptions
from telemetry.testing import browser_test_case... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textw... |
import numpy as np
import cv2
# Copied from https://github.com/utiasSTARS/pykitti/blob/master/pykitti/utils.py
def read_calib_file(filepath):
"""Read in a calibration file and parse into a dictionary."""
data = {}
with open(filepath, 'r') as f:
for line in f.readlines():
key, value = li... |
# the implementation here is a bit crappy.
import time
from Directories import resolveFilename, SCOPE_CONFIG
from boxbranding import getBoxType
boxtype = getBoxType()
PERCENTAGE_START = 50
PERCENTAGE_END = 100
profile_start = time.time()
profile_data = {}
total_time = 1
profile_file = None
try:
f = open(resolveF... |
#import yt.mods as yt
import yt
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import glob
__all__ = ['future_snr', 'snr']
_core_collapse_labels = ["SNII", "II", "2", "SN_II", "TypeII", "Type 2",
"Type II", "type II", "typeII", 'core collapse']
_... |
from enum import IntEnum;
class OgreMeshChunkID(IntEnum):
"""
Definition of the OGRE .mesh file format
.mesh files are binary files (for read efficiency at runtime) and are arranged into chunks
of data, very like 3D Studio's format.
A chunk always consists of:
unsigned short CHUNK_ID ... |
#####################################
# Imports
#####################################
# Python native imports
from PyQt5 import QtCore, QtWidgets
import pythoncom
import win32com.client
from time import time
import socket
import json
#####################################
# Global Variables
############################... |
# oppia/gamification/models.py
import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from oppia.models import Course, Activity, Media
from oppia.quiz.models imp... |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... |
# -*- coding: utf-8 -*-
"""
raven.contrib.django.client
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import time
import logging
from django.conf import settings
from dj... |
import os
import subprocess
import tempfile
from scripts.test import shared
from . import utils
class AsyncifyTest(utils.BinaryenTestCase):
def test_asyncify_js(self):
def test(args):
print(args)
shared.run_process(shared.WASM_OPT + args + [self.input_path('asyncify-sleep.wat'), '... |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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... |
import wrapt
from pamagent.hooks.dbapi2 import (ConnectionWrapper as DBAPI2ConnectionWrapper,
ConnectionFactory as DBAPI2ConnectionFactory)
from pamagent.trace import register_database_client
from pamagent.transaction_cache import current_transaction
from pamagent.wrapper import Func... |
# -*- encoding:utf-8 -*-
#
# Copyright (C) 2014 Mathieu Leduc-Hamel
#
# Author: Mathieu Leduc-Hamel <mlhamel@mlhamel.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version ... |
import pytest
import json
import os.path
from fixture.application import Application
import ftputil
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), file)
with open(config_file) as f:
... |
# Copyright (C) 2007, One Laptop Per Child
# Copyright (C) 2014, Ignacio Rodriguez
#
# 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 la... |
# -*- coding: utf-8 -*-
from .utils import (
LogbookTestCase,
activate_via_push_pop,
activate_via_with_statement,
capturing_stderr_context,
get_total_delta_seconds,
make_fake_mail_handler,
missing,
require_module,
require_py3,
)
from contextlib import closing, contextmanager
from dat... |
#!/usr/bin/env python
# encoding: utf-8
import mongoengine
from .base import BaseMongoStorage
from config import DB_HOST, DB_PORT, DB_NAME
mongoengine.connect(DB_NAME, host=DB_HOST, port=DB_PORT)
class MusicStorage(BaseMongoStorage, mongoengine.Document):
"""store music info
key str
title ... |
"""Kraken Canvas - Canvas Graph Manager module.
Classes:
GraphManager -- Node management.
"""
import json
from kraken.core.kraken_system import ks
# import FabricEngine.Core as core
class GraphManager(object):
"""Manager object for taking care of all low level Canvas tasks"""
__dfgHost = None
__dfgBi... |
import click
from . import cli
from .. import io
@cli.command()
@click.argument(
"cool_paths",
metavar="COOL_PATHS",
type=str,
nargs=-1
)
@click.argument(
"out_path",
metavar="OUT_PATH",
type=click.Path(exists=False, writable=True),
nargs=1,
)
@click.option(
"--cworld-type",
he... |
from datetime import datetime
from rdr_service.code_constants import CONSENT_FOR_STUDY_ENROLLMENT_MODULE, EMPLOYMENT_ZIPCODE_QUESTION_CODE, PMI_SKIP_CODE,\
STREET_ADDRESS_QUESTION_CODE, STREET_ADDRESS2_QUESTION_CODE, ZIPCODE_QUESTION_CODE
from rdr_service.etl.model.src_clean import SrcClean
from rdr_service.model.... |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... |
import requests
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
api_url = 'https://api.github.com/repos/GliderGeek/PySoar/releases'
pysoar_releases = [] # List[{'name': <release_tag_name>, 'windows': 0, 'mac': 0, 'linux': 0}]
for release in requests.get(api_url).json():
pysoar_release = {'... |
from __future__ import division, print_function, unicode_literals
class Fret(object):
'''Represents an individual fret on a fretboard.'''
def __init__(self, string, fret, note):
self.string = string
self.number = fret
self.note = note
self.text = None
class FretboardDis... |
"""Learning with random sampling.
Pool-based. Binary class labels.
Matthew Alger
The Australian National University
2016
"""
import numpy
from .sampler import Sampler
class RandomSampler(Sampler):
"""Pool-based learning with random sampling."""
def sample_index(self):
"""Finds index of a random u... |
# coding: utf8
# Auntefication Library
from ColorAndSayLib import PrintWC, SayPrint
# Variables of userdata
logpass = {"hacker": "12345678"}
######################
PostLoginTrue = False
######################
# def SayPrint(text,speech = None,color= None,ttsd = "plyer"):
# if color == None:
# color =... |
from __future__ import absolute_import
import datetime
import unittest
import numpy as np
import pandas as pd
from copy import copy
import pytest
from bokeh.core.properties import (field, value,
NumberSpec, ColorSpec, Bool, Int, Float, Complex, String,
Regex, Seq, List, Dict, Tuple, Instance, Any, Interval, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import unittest
import base58
import binascii
from argparse import Namespace, HelpFormatter
import json
import threading
from six.moves.urllib.error import URLError
import mock
from datetime import datetime, timedelta
from downstream_farmer import ut... |
# This Python file uses the following encoding: utf-8
# Part of the Lookback project (https://github.com/lindegroup/lookback)
# Copyright 2015 The Linde Group Computer Support, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... |
'''
strength-envelope-uniform-crust.py
This script can be used for plotting strength envelopes for a lithosphere with
a uniform crust. The script includes a function sstemp() that can be used for
calculating the lithospheric temperature as a function of the input material
properties
dwhipp 01.16 (modified from code w... |
#imports
import tweepy
from tweepy import OAuthHandler
#keys
ckey='...'
csecret='...'
atoken='...'
asecret='...'
#error handling twitter let me draw only 5000 ids at a time
try:
auth = OAuthHandler(ckey, csecret)
auth.set_access_token(atoken, asecret)
api = tweepy.API(auth, wait_on_rate_limit=True, wait_o... |
# sandvich - simple html document generation
# Copyright (C) 2012 Austin Adams
#
# 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... |
import numpy as np
import copy
import time
from Kat import Kat
from Visualize import Visualizer
from SimManager import sim_manager
from hg_settings import *
from Hunger_Grid import hunger_grid
import sys
import os
STEP_SIZE = 10 # 0 = only last frame,
# 1 = every frame,
# N = every N ... |
#!/usr/bin/env python
#coding: utf-8
import unittest
import sort
class TestInsertionSort(unittest.TestCase):
def setUp(self):
print "start insertion sort test"
def tearDown(self):
print "end insertion sort test"
def test_case01(self):
A = [3,2,1]
print "origin A=%s" % A
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.