src stringlengths 721 1.04M |
|---|
#!/usr/bin/python
#
# Copyright 2014 Microsoft 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... |
from django import forms
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.urlresolvers import resolve, reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template.loader import get_templat... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test descendant package tracking code."""
from test_framework.test_framework import BitcoinTestFramewo... |
import pytest
import os
from astropy.io import fits
from threeML.plugins.OGIPLike import OGIPLike
from threeML.plugins.spectrum.pha_spectrum import PHASpectrum
from threeML.classicMLE.joint_likelihood import JointLikelihood
from threeML.plugins.OGIP.response import OGIPResponse
from threeML.data_list import DataList
... |
"""
The MIT License (MIT)
Copyright (c) 2015-2021 Kim Blomqvist
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, ... |
from django import forms
from unicoremc.models import Project, Localisation
from django.forms import widgets
class ProjectForm(forms.ModelForm):
ga_profile_id = forms.CharField(required=False)
frontend_custom_domain = forms.CharField(
required=False,
widget=forms.TextInput(attrs={'class': 'inp... |
#!/usr/bin/env python3
import argparse
import fnmatch
import hashlib
import json
import os
import re
import shutil
import sys
import time
from typing import Dict, List, Optional, Set, Tuple
FILE_CHUNK_SHA1_SIZE = 8192
REPORT_FILE_FORMAT_TEXT = "text"
REPORT_FILE_FORMAT_JSON = "JSON"
REPORT_FILE_FORMAT_JSON_SEPARATORS... |
###############################################################################
# #
# 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 ... |
# coding: utf-8
import json
import requests
from hanlder import RequestHandler as BaseRequestHandler
import tornado.web
from tornado.web import authenticated
from ..utils import deal_errors, get_local_time, get_local_time_string
from .forms import BlogWriterForm, BlogCatalogWriterForm
class RequestHandler(BaseRequ... |
# -*- coding: utf-8 -*-
#
# NRGMapping documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 7 00:20:20 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... |
import os
import math
import numpy as np
from PlummerGalaxy import PlummerGalaxy
from InitialConditions import InitialConditions
import imp
try:
imp.find_module('matplotlib')
matplotlibAvailable = True
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
except ImportError:
matplo... |
from os import chdir,mkdir
from os.path import join,exists
class Generator:
def __init__(self,generator_type,root_dir,basepackage,java_source_dir,model=None):
if generator_type:
self.type=generator_type
if root_dir:
self.root_dir=root_dir
if basepackage:
... |
#!/usr/bin/env python2
QUEUE_NUM = 5
#hush verbosity
import logging
l=logging.getLogger("scapy.runtime")
l.setLevel(49)
import os,sys,time
from sys import stdout as out
import nfqueue,socket
from scapy.all import *
import GeoIP
gi = GeoIP.open("GeoLiteCity.dat",GeoIP.GEOIP_STANDARD)
lastip=""
def DoGeoIP(pkt):
gl... |
# -*- 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... |
from breathe.renderer.rst.doxygen.base import Renderer
class DoxygenTypeSubRenderer(Renderer):
def render(self):
compound_renderer = self.renderer_factory.create_renderer(self.data_object, self.data_object.compounddef)
nodelist = compound_renderer.render()
return [self.node_factory.bloc... |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... |
from __future__ import print_function
import unittest
import gridpp
import numpy as np
lats = [60, 60, 60, 60, 60, 70]
lons = [10,10.1,10.2,10.3,10.4, 10]
"""Simple check
20 21 22 23 24
15 16 17 18 19
10 11 12 13 nan
5 6 7 nan 9
0 1 2 3 4
"""
values = np.reshape(range(25), [5, 5]).astype(float)
values[1, 3] ... |
import factory
from PIL import Image
import StringIO
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.core.files import uploadedfile
from django.db.models.signals import post_save
from booki.editor.models import Book, BookStatus, Lan... |
import sys
import os
from shutil import copyfile
import unittest
from click.testing import CliRunner
sys.path.append("../scripts")
import srcget
from srcget import _make_dest
class TestSrcGet(unittest.TestCase):
def setUp(self):
runner = CliRunner()
result = runner.invoke(srcget.init)
self... |
""" Python library for interacting with Project Vote Smart API.
Project Vote Smart's API (http://www.votesmart.org/services_api.php)
provides rich biographical data, including data on votes, committee
assignments, and much more.
"""
__author__ = "James Turk (jturk@sunlightfoundation.com)"
__version__ = "0... |
# -*- coding: utf-8 -*
import re
from django.shortcuts import render
from django.conf import settings
from django import forms
from django.utils import timezone
from django.template import Context
from django.template.loader import get_template
from django.core.mail import EmailMultiAlternatives
from lots_admin.models... |
#!/usr/bin/env python
"""
Reads a stream of twitter data and writes out data for the top 10 retweets.
Use the --results option to change the number of results.
"""
from __future__ import print_function
import json
import optparse
import fileinput
def main():
retweets = []
parser = optparse.OptionParser()
... |
"""
Titanic client example
Implements client side of http:rfc.zeromq.org/spec:9
Author : Min RK <benjaminrk@gmail.com>
"""
import sys
import time
from mdcliapi import MajorDomoClient
def service_call (session, service, request):
"""Calls a TSP service
Returns reponse if successful (status code 200 OK),... |
import datetime as ft
import pickle
from multiprocessing import Pool as Reserva
from warnings import warn as avisar
import numpy as np
from tinamit.config import _, conf_mods
from .corrida import Corrida, Rebanada
from .extern import gen_extern
from .res import ResultadosGrupo, ResultadosSimul
from .vars_mod import V... |
"""
Contains tests for pulp_python.plugins.importers.importer.
"""
from gettext import gettext as _
import unittest
import mock
from pulp_python.common import constants
from pulp_python.plugins import models
from pulp_python.plugins.importers import importer
class TestEntryPoint(unittest.TestCase):
"""
Test... |
#!/usr/bin/env python
import sys
import urllib2
import subprocess
import re
import time
import os
import hashlib
import random
import requests
import urllib2
#=================================================
# MAIN FUNCTION
#=================================================
def main():
# depenency check
if ... |
"""
Provides support for iTerm2 variables, which hold information associated
with various objects such as sessions, tabs, and windows.
"""
import asyncio
import enum
import json
import typing
import iterm2.connection
import iterm2.notifications
class VariableScopes(enum.Enum):
"""Describes the scope in which a ... |
from lib import solution
from lib.point import Point2D
from lib.map import Map
import copy
class Solution(solution.Solution):
def __init__(self, nr):
super().__init__(nr)
self.instructions = []
self.directions = ['N', 'E', 'S', 'W']
self.face = 0
self.source = Point2D(0, 0)... |
#
# Library for accessing the REST API from Netflix
# Represents each resource in an object-oriented way
#
import sys
import os.path
import re
import oauth as oauth
import httplib
import time
from xml.dom.minidom import parseString
import simplejson
from urlparse import urlparse
HOST = 'api-public.netfli... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... |
# -*- coding: utf-8 -*-
# Copyright 2020 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... |
# 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 'Item.unusable'
db.add_column('Machine_item', 'unusable', self.gf('django.db.models.fields.... |
import scrapy
import logging
from scrapy.spiders import Spider
from scrapy.selector import Selector
from iherb.items import IherbItem
class IherbSpider(Spider):
name = "iherbspider"
allowed_domains = ["iherb.cn"]
max_page = 5
cur_page = 1
start_urls = [
"http://www.iherb.cn/Supplements... |
import json
from django.shortcuts import render, redirect
from django.views.generic.edit import UpdateView, DeleteView
from .models import Project
from ..videos.models import Video, VideosSequence
from ..videos.views import new_sequence, get_sequence
from django.contrib.auth.decorators import login_required
from django... |
"""
Copyright (C) 2018 MuadDib
----------------------------------------------------------------------------
"THE BEER-WARE LICENSE" (Revision 42):
@tantrumdev wrote this file. As long as you retain this notice you can do
whatever you want with this stuff. Just Ask first when not released through... |
# Copyright 2020 Tensorforce Team. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
"""Algorithms for partial fraction decomposition of rational functions. """
from __future__ import print_function, division
from sympy.polys import Poly, RootSum, cancel, factor
from sympy.polys.polytools import parallel_poly_from_expr
from sympy.polys.polyoptions import allowed_flags, set_defaults
from sympy.polys.p... |
# -*- coding: 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):
# Deleting field 'Profile.is_pseudonymous'
db.delete_column('profiles_profile', 'is_pseudonymous')
... |
import ConfigParser
import os.path
PROJECTDIR = os.path.dirname(os.path.abspath(__file__))
if os.path.isfile(PROJECTDIR + '/masters_project.cfg'):
CONFIGFILE = PROJECTDIR + '/masters_project.cfg'
else:
CONFIGFILE = PROJECTDIR + '/masters_project-default.cfg'
#print CONFIGFILE
config = ConfigParser.ConfigPar... |
from django.conf.urls.defaults import *
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
from job_board.models import Job
from job_board.feeds import JobFeed
from job_board.forms import JobForm
from job_board.views import JobFormPreview, job_list, job_detail, job_search
feeds = {
'jobs': JobFee... |
import unittest
from mock import Mock
import random
import string
import arrow
import redditstats.connect as connect
import redditstats.subreddit as subreddit
import redditstats.comments as comments
import redditstats.stats as stats
from collections import namedtuple
class ConnectionTests(unittest.TestCase):
MAX... |
#!/usr/bin/python3
#
# Copyright 2017 ghostop14
#
# This 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, or (at your option)
# any later version.
#
# This software is distributed in the hope ... |
# -*- coding: utf8 -*-
from phystricks import *
def IllusionNHwEtp():
pspict,fig = SinglePicture("IllusionNHwEtp")
pspict.dilatation(0.7)
perspective=ObliqueProjection(45,sqrt(2)/2)
l=2
P=(0,0)
cubesP=[]
cubesL=[]
cubesH=[]
profondeur=7
longueur=4
hauteur=4
for i in ran... |
# gPrime - A web-based genealogy program
#
# Copyright (C) 2009 Brian G. Matherly
#
# 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) a... |
import copy
import datetime
import math
import random
from collections import defaultdict
import matplotlib as mpl
import matplotlib.animation
from matplotlib.ticker import FormatStrFormatter
import numpy as np
import scipy
import seaborn as sns
import traces
# local imports
from kalman import Estimate, Reading
from... |
import os, logging, threading, time
from Queue import Queue, Empty
from galaxy import model
from paste.deploy.converters import asbool
import pkg_resources
try:
pkg_resources.require( "DRMAA_python" )
DRMAA = __import__( "DRMAA" )
except:
DRMAA = None
log = logging.getLogger( __name__ )
if DRMAA is not... |
from __future__ import unicode_literals
from future.builtins import str
from future.utils import native
import os
from shutil import rmtree
from uuid import uuid4
from zhiliao.conf import settings
from zhiliao.core.templatetags.mezzanine_tags import thumbnail
from zhiliao.galleries.models import Gallery, GALLERIES_UP... |
from flask_wtf import Form
from wtforms import TextField,DecimalField,SelectField
from decimal import Decimal
from wtforms.validators import InputRequired,NumberRange,Optional
from models import Category,Product
from wtforms.validators import ValidationError
from wtforms.widgets import html_params,Select, HTMLString
fr... |
"""
Sponge Knowledge Base
MIDI generate sound
"""
from javax.sound.midi import ShortMessage
from org.openksavi.sponge.midi import MidiUtils
class SameSound(Trigger):
def onConfigure(self):
self.withEvent("midiShort")
def onRun(self, event):
midi.sound(event.message)
class Log(Trigger):
de... |
import unittest2
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
THREAD_COUNT = 5
def gather_... |
import os
import json
from pgeo.utils.json import dict_merge_and_convert_dates
from pgeo.metadata.db_metadata import DBMetadata
from pgeo.metadata.search import MongoSearch
from pgeo.utils import log
from pgeo.config.metadata.core import template as core_template
from pgeo.config.metadata.raster import template as rast... |
#!/usr/bin/env python3
#
# Copyright (c) 2012 Brian Yi ZHANG <brianlions at gmail dot com>
#
# This file is part of pynebula.
#
# pynebula 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 th... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup, find_packages
from tarbell import __VERSION__ as VERSION
APP_NAME = 'tarbell'
settings = dict()
# Publish Helper.
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
settings.upda... |
# 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/.
import mock
import random
import uuid
from distutils.version import LooseVersion
from elasticsearch.helpers import bulk
... |
import urllib,urllib2,re,cookielib,os,sys
import xbmc, xbmcgui, xbmcaddon, xbmcplugin,time
from resources.libs import main
#Mash Up - by Mash2k3 2012.
from t0mm0.common.addon import Addon
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon('plugin.video.movie25', sys.argv)
art = ma... |
from nansat.mappers.sentinel1 import Sentinel1
from nansat.mappers.mapper_netcdf_cf import Mapper as NetCDF_CF_Mapper
class Mapper(Sentinel1, NetCDF_CF_Mapper):
def __init__(self, filename, gdal_dataset, gdal_metadata, *args, **kwargs):
NetCDF_CF_Mapper.__init__(self, filename, gdal_dataset, gdal_metadata... |
from __future__ import print_function
import os
from numpy import dot,round
from .abinittask import AbinitTask
__all__ = ['AbinitWfnTask']
class AbinitWfnTask(AbinitTask):
"""Charge density calculation."""
_TASK_NAME = 'Wavefunction task'
_input_fname = 'wfn.in'
_output_fname = 'wfn.out'
def __... |
import copy
from HARK import distribute_params
from HARK.ConsumptionSaving.ConsAggShockModel import (
AggShockConsumerType,
SmallOpenEconomy,
init_cobb_douglas,
)
from HARK.distribution import Uniform
import numpy as np
import unittest
class testSmallOpenEconomy(unittest.TestCase):
def test_small_open... |
# tmax_peakfind_example.py
"""
Demonstration of some of the primary functions in pygaero, including Tmax finding and elemental analysis.
"""
# Module import
from pygaero import pio
from pygaero import therm
from pygaero import gen_chem
import os
import matplotlib.pyplot as plt
def example1():
# -----------------... |
import numpy as np
import hyperspy.api as hs
from hyperspy_gui_ipywidgets.tests.utils import KWARGS
from hyperspy.signal_tools import (Signal1DCalibration, ImageContrastEditor,
EdgesRange)
class TestTools:
def setup_method(self, method):
self.s = hs.signals.Signal1D(1 ... |
#
# AdoptionView.py
# - simple test for a view
import plotly
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.graph_objs as go
from plotly.graph_objs import *
class AdoptionView:
"""Take a Adoption object and generate a plot"""
def __init__(self,adoption=None):
... |
from __future__ import division
import numpy as np
import numbers
from warnings import warn
def initialize_sigma2(X, Y):
(N, D) = X.shape
(M, _) = Y.shape
diff = X[None, :, :] - Y[:, None, :]
err = diff ** 2
return np.sum(err) / (D * M * N)
class EMRegistration(object):
"""
Expectation m... |
# Copyright (c) 2020 DDN. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
"""Chroma services may subscribe to named queues using this module. The `ServiceQueue` class is a wrapper
around an AMQP queue."""
import threading
from chroma_core.... |
import re
import datetime
from django.db import models
from hansard.models.base import HansardModelBase
from core.models import Person
class AliasQuerySet(models.query.QuerySet):
def unassigned(self):
"""
Limit to aliases that have not been assigned.
"""
return self.filter(person_... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 27 14:47:00 2015
@author: aaron
"""
import argparse
import textwrap
import timeit
import os
from snptools import *
#########################################################
#### Need to add retention list filtering for DSF and PED
#######################################... |
class PythonWriter:
def __init__(self, constants):
self.constants = constants
def write(self, out):
out.write("# This file was generated by generate_constants.\n\n")
out.write("from enum import Enum, unique\n\n")
for name, enum in self.constants.enum_values.items():
... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib.contenttypes.models import ContentType
from django.contrib.flatpages.models import FlatPage
from django.contrib.postgres.fields import JSONField
from mptt.models import MPTTModel, T... |
import string
import unittest
from email import _header_value_parser as parser
from email import errors
from email import policy
from test.test_email import TestEmailBase, parameterize
class TestTokens(TestEmailBase):
# EWWhiteSpaceTerminal
def test_EWWhiteSpaceTerminal(self):
x = parser.EWWhiteSpace... |
#!/usr/bin/env python
#TheZero
#This code is under Public Domain
#ref: https://gist.github.com/TheZ3ro/7255052
from threading import Thread
import socket
import os, re, time, sys, subprocess
class bc:
HEADER = '\033[0;36;40m'
ENDC = '\033[0m'
SUB = '\033[3;30;45m'
WARN = '\033[0;31;40m'
GREEN = '\033[0;32;40m'
o... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
from django.conf import settings
from django.http import HttpResponse
from django.test import TestCase
from mock import patch
from zerver.lib.test_helpers import MockLDAP
from confirmation.models import Confirmation
from zilencer.models i... |
"""This module handles picking resource from available resource."""
from game import resource
class ResourcePickerError(Exception):
pass
class ResourcePicker(object):
def __init__(self):
self._available = None
self._picked_resource = resource.Resource()
def SetAvailableResource(self, res):
self._a... |
# Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 30 14:46:38 2014
@author: junz
"""
import os
import matplotlib.pyplot as plt
import corticalmapping.core.FileTools as ft
import corticalmapping.RetinotopicMapping as rm
trialName = '160208_M193206_Trial1.pkl'
names = [
['patch01', 'V1'],
['patch02', '... |
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login
from bootcamp.auth.forms import SignUpForm
from django.contrib.auth.models import User
from bootcamp.feeds.models import Feed
from django.utils.translation import ugettext_lazy as _
def signup(request):
if request.met... |
# -*- coding: utf-8 -*-
##
# Copyright (c) 2009-2017 Apple 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 ... |
# -*- coding: utf-8 -*-
"""
The :mod:`audiotsm.base.analysis_synthesis` module provides a base class for
real-time analysis-synthesis based audio time-scale modification procedures.
"""
import numpy as np
from audiotsm.utils import (windows, CBuffer, NormalizeBuffer)
from .tsm import TSM
EPSILON = 0.0001
class An... |
import fractions
import itertools
from django import forms
from django.utils.safestring import mark_safe
from django.http import HttpResponse
from faculty.event_types import fields, search
from faculty.event_types.base import BaseEntryForm
from faculty.event_types.base import CareerEventHandlerBase
from faculty.event... |
import os
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '..'))
from models import lstm_stacked_bidirectional
from helpers import checkpoint
# Get the review summary file
review_summary_file = 'extracted_data/review_summary.csv'
# Initialize Checkpointer to ensure checkpointing
checkpoint... |
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
# more details.
#
# You should have received a copy of the GNU General Public License... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .elements.point import Point
from .elements.line import Line
from .elements.polygon import Polygon
import os
class Project(object):
def __init__(self, messages):
self.messages = messages
self.points = []
self.lines = ... |
from django import template
from django.contrib import admin
from django.contrib.admin import AdminSite
from django.core.handlers.wsgi import WSGIRequest
from django.core.urlresolvers import reverse, resolve
try:
from django.utils.six import string_types
except ImportError:
# For Django < 1.4.2
string_type... |
"""
The main job wrapper for the server side.
This is the core infrastructure. Derived from the client side job.py
Copyright Martin J. Bligh, Andy Whitcroft 2007
"""
import getpass, os, sys, re, stat, tempfile, time, select, subprocess, platform
import traceback, shutil, warnings, fcntl, pickle, logging, itertools, ... |
################################################################################
#
# This file is part of the General Hidden Markov Model Library,
# GHMM version __VERSION__, see http://ghmm.org
#
# file: mixture.py
# authors: Alexander Schliep
#
# Copyright (C) 1998-2004 Alexander Schl... |
__author__ = 'flx'
from apiclient.discovery import build
import httplib2
from oauth2client import tools
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.file import Storage
from oauth2client.tools import run_flow
# For this example, the client id and client secret are command-line arguments.
c... |
import unittest
import pinion
from pinion import parse_hosts, create_packet
class BaseTestCase(unittest.TestCase):
def test_parse_hosts(self):
expected = [("127.0.0.1", 4730)]
self.assertEqual(parse_hosts([("127.0.0.1", "4730")]), expected)
self.assertEqual(parse_hosts(["127.0.0.1"]), ex... |
# 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.
#
# This program is distributed in the hope that it will be useful
# but... |
from os import path
from sqlalchemy import (create_engine,
Column,
String,
Integer,
Boolean,
Table,
ForeignKey)
from sqlalchemy.orm import sessionmaker, relationship
from sql... |
import string
import pickle
import os
import utilities
class Keyfile:
LENGTH = 32
CHARACTERS = string.digits + string.letters + string.punctuation + ' '
@staticmethod
def create(path, database_path, **kwargs):
k = Keyfile()
k.path = path
k.database_path = os.path.abspath(dat... |
# -*- encoding: utf-8 -*-
# vim: ts=4 sw=4 expandtab ai
"""
Usage::
hammer gpg [OPTIONS] SUBCOMMAND [ARG] ...
Parameters::
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands::
create Create a GPG Key
delete ... |
"""Generate ssdp file."""
from collections import OrderedDict, defaultdict
import json
from typing import Dict
from .model import Integration, Config
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
SSDP = {}
""".strip()
def sort_dict(value):
"""Sort a di... |
import numpy as np
import os
import csv
with open(TRAIN_LABELS_PATH, 'r') as f:
reader = csv.reader(f, delimiter=",")
train_ids = []
for k, line in enumerate(reader):
if k == 0: continue # skip header
train_ids.append(int(line[0]))
isEndClass = np.asarray([0,0,1,
0,0,
0,0,
0,0,
0,0... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'view/ui_estimated_energy_demand_dialog.ui'
#
# Created: Mon Aug 3 17:56:39 2015
# by: qgis.PyQt UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from qgis.PyQt import QtCore, QtGui
try:
_fromUtf8 ... |
#-*- coding: utf-8 -*-
'''
Created on 2017. 02. 12
Updated on 2017. 02. 12
'''
from __future__ import print_function
import os
import re
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
from scipy.stats import mannwhitneyu, pearsonr
from ExpBase import ExpBase
... |
import pygame
import stale
class Enemy(pygame.sprite.Sprite):
walking_frames_l = []
walking_frames_r = []
def __init__(self):
super().__init__()
image = pygame.image.load("knight.png").convert()
image.set_colorkey(stale.WHITE)
self.walking_frames_l.append(image)
... |
from pymongo import MongoClient
from matplotlib import pyplot as plt
import os
from datetime import datetime, date, time, timedelta
client = MongoClient()
# using wowtest.auctiondata
db = client.wowtest
posts = db.auctiondata
auctions = posts.find().limit(10)
#time.time() into datetime --->
#datetime.datetime.fromti... |
from zipfile import ZipFile
import numpy as np
from sets.core import Embedding
class Glove(Embedding):
"""
The pretrained word embeddings from the Standford NLP group computed by the
Glove model. From: http://nlp.stanford.edu/projects/glove/
"""
URL = 'http://nlp.stanford.edu/data/glove.6B.zip'
... |
import pytest
import numpy as np
def test_ImageArrayUInt8ToFloat32():
from batchup.image.utils import ImageArrayUInt8ToFloat32
x = np.array([[0, 127, 255], [30, 60, 90]], dtype=np.uint8)
xf32 = x.astype(np.float32) * np.float32(1.0 / 255.0)
assert x.shape == (2, 3)
x_wrapped = ImageArrayUInt8To... |
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ... |
/*
Esta archivo pertenece a la aplicación "practica 3" bajo licencia GPLv2.
Copyright (C) 2014 Jaime Torres Benavente.
Este programa es software libre. Puede redistribuirlo y/o modificarlo bajo los términos
de la Licencia Pública General de GNU según es publicada por la Free Software Foundation,
bien de l... |
''' -- Imports from python libraries -- '''
# import os, re
import json
''' -- imports from installed packages -- '''
from django.http import HttpResponse
from django.shortcuts import render_to_response # , render #uncomment when to use
from django.template import RequestContext
from django.contrib.auth.decorators i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.