text stringlengths 17 737k |
|---|
84b0249c-2d5f-11e5-8296-b88d120fff5e |
#! /usr/bin/python
# Test script to show how to send position commands to servos attached to a CM-5 or CM-700
import serial
import optparse
import time
import sys
DEFAULT_MOTOR_SPEED = 100
#---------------------------------------------------------------------------------------------------
if sys.platform == "win32"... |
import csv
import json
from StringIO import StringIO
from vsm.corpus import Corpus
from vsm.model.beaglecomposite import BeagleComposite
from vsm.viewer.beagleviewer import BeagleViewer
from vsm.model.ldacgsmulti import LdaCgsMulti as LCM
from vsm.viewer.ldagibbsviewer import LDAGibbsViewer as LDAViewer
from bottle i... |
from __future__ import absolute_import, division, print_function
import numpy as np
from matplotlib.colors import ColorConverter
from glue import config
from qtpy import QtCore, QtWidgets, QtGui
from glue.external.echo import add_callback
from glue.utils import nonpartial
from glue.utils.qt.widget_properties import W... |
# vim: ts=4 et filetype=python
# This file is part of RCubic
#
# Copyright (c) 2012 Wireless Generation, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including ... |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from django.db import backend, transaction
from django.db.models import signals, get_model
from django.db.models.fields import AutoField, Field, IntegerField, get_ul_class
from django.db.models.related import RelatedObject
from django.utils.translation import gettext_lazy, string_concat
from django.utils.functional imp... |
from pyrad import packet,dictionary
import socket
import six
import select
class RadiusClientLibrary(object):
def __init__(self,addr,port,secret):
self.addr = (addr, int(port))
self.attributes = []
self.secret = str(secret)
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM... |
#!/usr/bin/env python
"""ChromeDesk.py: A simple chrome-cast desktop wallpaper parser that allows app to download set as wallpapers images casted by google ."""
__author__ = "Minos Galanakis"
__license__ = "LGPL"
__version__ = "2.1"
__email__ = "minos197@gmail.com"
import urllib2
import ctypes
import os
import ra... |
"""
Python code for calculating non-parametric morphological diagnostics
of galaxy images.
"""
# Author: Vicente Rodriguez-Gomez <v.rodriguez@irya.unam.mx>
# Licensed under a 3-Clause BSD License.
from __future__ import absolute_import, division, print_function
from pkg_resources import parse_version
import warnings
i... |
# Copyright 2016 Grist Labs, 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 writi... |
import numpy.random
import numpy as np
import scipy.integrate
import iccpy.constants as constants
def _mass_integrand(r, halo):
if (r==0): return 0
else: return r*r*halo.density(r)
def _potential_integrand(r, halo):
return r*halo.density(r)
class HaloRealisation:
def __init__(self, alpha, beta, ... |
import os
import mmap
import io
import pdb
from cStringIO import StringIO
from baseutils import string_to_unsigned
from baseutils import string_to_signed
elf = None
_read = None
#options
ELF_HEADER = 1 << 2
ELF_SYMBOL = 1 << 3
ELF_DYNAMIC = 1 << 4
ELF_RELA = 1 << 5
DWARF_INFO = 1 << 10
#types
ELF64 = 8
ELF32 = ... |
# 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 agreed... |
from typing import Optional, List
from .sep.ed25519_public_key_signer import Ed25519PublicKeySigner
from .strkey import StrKey
__all__ = ["Account"]
class Account:
"""The :class:`Account` object represents a single
account on the Stellar network and its sequence number.
Account tracks the sequence numb... |
import unittest
from alphametics import solve
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0
class TestAlphametics(unittest.TestCase):
def test_puzzle_with_three_letters(self):
self.assertEqual(solve("I + BB == ILL"), {"I": 1, "B": 9, "L": 0})
def test_solution_must_hav... |
# -*- coding: utf-8 -*-
"""
kintone上のデータを、バックアップを取ってから一括アップデートするスクリプト
オプション指定なし→ローカルキャッシュを用いてDry Run
-r(--real) →最新のデータを取得してバックアップし、更新
-f(--from-backup) →-rで問題が起きたとき用。バックアップを指定して、そのデータを元に更新する。
"""
from cache import get_all, get_app
import time
import argparse
from render import pretty
def concat_lines(x, y):
if... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import json
import re
from modgrammar import Grammar, OPTIONAL, G, WORD, OR, ParseError
from django import template
from django.template.loader import get_template
from django.core.ex... |
from django.conf import settings
from django.db import connection, router, transaction
from django.db.backends import util
from django.db.models import signals, get_model
from django.db.models.fields import (AutoField, Field, IntegerField,
PositiveIntegerField, PositiveSmallIntegerField, FieldDoesNotExist)
from dja... |
'''
Classes to solve canonical consumption-savings models with idiosyncratic shocks
to income. All models here assume CRRA utility with geometric discounting, no
bequest motive, and income shocks are fully transitory or fully permanent.
It currently solves three types of models:
1) A very basic "perfect foresight"... |
#!/usr/bin/env python
# encoding: utf-8
""".. module:: hid
This module contains the Device class. It allow users to modify keyboard
mode and lightning.
"""
from hid import device
from . import constants as c
from . import exception as e
class Device(object):
""".. class:: Device(vendor_id, product_id[... |
#!/bin/bash
"""The Emu object esentially wraps the George gaussian process code. It handles building, training, and predicting."""
import warnings
from itertools import izip
from collections import OrderedDict
from os import path
from time import time
from abc import ABCMeta, abstractmethod
import numpy as np
import ... |
import re
from unipath import Path
from pyolite.models.user import User
from pyolite.managers.manager import Manager
class UserManager(Manager):
def create(self, name, key=None, key_path=None):
if key is None and key_path is None:
raise ValueError('You need to specify a key or key_path')
user = Use... |
import datetime
from pprint import pprint
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from fo2.connections import db_cursor_so
from utils.functions.models import rows_to_dict_list
import logistica.models as models
class Command(BaseCommand):
help = 'Setin... |
import discord
from discord.ext import commands
from __main__ import settings, botdata
from cogs.utils import checks
import aiohttp
import asyncio
import async_timeout
import string
import dota2api
import datetime
from .mangocog import *
async def opendota_query(querystring):
async with aiohttp.get("https://api.opend... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... |
"""
base catalog building pipeline 3.0
"""
from itertools import chain
import numpy as np
from astropy.coordinates import SkyCoord
from astropy.table import vstack
from easyquery import Query, QueryMaker
from ..spectra import extract_nsa_spectra, extract_sdss_spectra
from ..utils import add_skycoord, fill_values_by_q... |
"""
This package contains the XML handlers to read the NineML files and related
functions/classes, the NineML base meta-class (a meta-class is a factory that
generates classes) to generate a class for each NineML cell description (eg.
a 'Purkinje' class for an NineML containing a declaration of a Purkinje
ce... |
from django import forms
from django.conf import settings
from django.contrib.sites.models import RequestSite
from django.core import signing
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.forms.forms import BoundField
from django.forms.widgets import PasswordInput
from ... |
from pypeerassets.kutil import Kutil
from pypeerassets.provider import *
from pypeerassets.__main__ import *
|
#!/usr/bin/python
import csv
import sys
import getopt
import array
class Cartel:
def __init__(self, row):
# TODO: set self._size as "large" or "small"
self._size = "large"
# TODO set other self._...
pass
def getSize(self):
return self._size
class Format:
def __init(self, width, height):
self._width = ... |
'''contains main protocol logic like assembly of proof-of-timeline and parsing deck info'''
import concurrent.futures
from binascii import unhexlify
from typing import Union, Generator
from .protocol import *
from .provider import *
from .pautils import (load_deck_p2th_into_local_node,
find_tx_... |
# -*- encoding: utf-8 -*-
from __future__ import print_function
import functools
import logging
from django.conf import settings
from django.core import mail
from django.utils import translation
try:
# Django >= 1.4.5
from django.utils.six import string_types
except ImportError:
# Django < 1.4.5
stri... |
from ctypes import *
import base64
import os
def generate_hex_sstr():
publicKey64 = "Not implemente"
privateKey64 = "Not implemente"
return (publicKey64,privateKey64)
|
import logging
import uuid
from datetime import timedelta
from typing import Dict, List, Optional
from django.apps import apps
from django.db import IntegrityError, models, transaction
from django.utils import dateformat, timezone
from django.utils.encoding import smart_str
from stripe.api_resources.abstract.api_resou... |
import os
import glob
import shutil
import sys
import math
import datetime as dt
import subprocess as sp
import numpy as np
import warnings
import xml.etree.ElementTree as ET
from astropy import __version__ as astropy_version
from astropy import wcs
from astropy.io import fits, votable
from astropy.table import Table, ... |
# Base class
IGNORE = {'p', 'pos'}
class Registry(type):
types = []
def __init__(cls, name, bases, dict):
Registry.types.append(cls)
class Node(object):
__metaclass__ = Registry
def __init__(self, pos):
self.pos = pos
def __repr__(self):
contents = sorted(self.__dict__.iteritems())
show = ('%s=%s' % (k,... |
from discord.ext import commands
import aiohttp
import isodate
import json
import math
import moviepy.editor
import pandas
import random
import re
import seaborn
import urllib
import xml.etree.ElementTree
import wolframalpha
import credentials
from modules import ciphers
from modules import utilities
from modules im... |
#!/usr/bin/python
import sys
import csv
import argparse
import ijson
csvwriter = csv.writer(sys.stdout)
with open(sys.argv[1], 'rb') as input_file:
cves = ijson.items(input_file, 'CVE_Items.item')
for cve in cves:
#print cve
id = cve['cve']['CVE_data_meta']['ID']
desc = cve['cve']['description']['descripti... |
import os
from flask import Flask, jsonify, request, url_for, make_response
from flask_api import status
import sys
from werkzeug.exceptions import NotFound
from create_wishlist import CustomerList, DataValidationError, Customer
# Create Flask application
app = Flask(__name__)
# Pull options from environment
DEBUG = ... |
from django.contrib.gis.db import models
#from django.db import models
from django import forms
import datetime
STATUS_CHOICES = (
('FR', 'Freshman'),
('SO', 'Sophomore'),
('JR', 'Junior'),
('SR', 'Senior'),
)
POSITION_TYPE_CHOICES = (
('O', 'Offense'),
('D', 'Defense'),
('S', 'Special Tea... |
#!/usr/bin/env python2
# -*- encoding: utf8 -*-
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2016 Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
#
# 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 Fr... |
from pyramid_okta import settings
from pyramid_okta.security.authentication import OktaAuthenticationPolicy
from pyramid_okta.security.authorization import OktaAuthorizationPolicy
from pyramid_okta.request import OktaRequestExtra
from pyramid_okta.session import OktaSessionFactory
def includeme(config):
settings.... |
import os
from .ruby_executor import RubyExecutor
class Executor(RubyExecutor):
name = 'RUBY2'
command_paths = (['ruby2.%d' % i for i in reversed(xrange(0, 5))] +
['ruby2%d' % i for i in reversed(xrange(0, 5))])
syscalls = ['pipe2', 'poll', ('write', lambda debugger: debugger.arg0 in... |
from http.server import BaseHTTPRequestHandler, HTTPServer
import RPi.GPIO as GPIO
HOST_NAME = ''
PORT_NUMBER = 8080
wc_busy = False
def isWCBusy():
return GPIO.input(17)
class RequestHandler(BaseHTTPRequestHandler):
def do_HEAD(s):
print("HEAD")
pass
def do_GET(s):
"""Respond to a GET request"""
s.send_... |
#!/usr/bin/env python
import argparse
import os
import sys
import subprocess
from datetime import datetime
import dxpy
from dxencode import dxencode as dxencode
import json
# NOTES: This command-line utility will run the DNA methylation for a single replicate
# - All results will be written to a folder /RESULT_F... |
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
from twisted.protocols.basic import LineReceiver
import socket,os,pprint
class Chat(LineReceiver):
def __init__(self, clients, liveIps):
self.clients = clients
self.liveIps = liveIps
self.name = Non... |
from SimPEG import Problem, Utils, np, sp, Solver as SimpegSolver
from scipy.constants import mu_0
from SurveyFDEM import Survey as SurveyFDEM
from FieldsFDEM import Fields, Fields_e, Fields_b, Fields_h, Fields_j
from SimPEG.EM.Base import BaseEMProblem
from SimPEG.EM.Utils import omega
class BaseFDEMProblem(BaseEMPr... |
from collections import OrderedDict
from typing import Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
class Bottleneck(nn.Module):
expansion = 4
def __init__(self, inplanes, planes, stride=1):
super().__init__()
# all conv layers have strid... |
"""
A series of packages/Django apps that load Philadelphia-specific data.
These packages, as applicable, have the following modules:
* .api: communicates directly with the external data source
* .adapter: adapts data from the external data source's format into a model
* .models: local representations of t... |
#!/usr/bin/python
#
# Copyright 2007 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
import datetime
import json
import os
from random import random
from time import sleep
from time import time
import requests
import shortuuid
from sickle import Sickle, oaiexceptions
from sickle.iterator import OAIItemIterator
from sickle.models import ResumptionToken
from sickle.oaiexceptions import NoRecordsMatch, B... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# gnetplus -- Python module for interfacing with PROMAG RFID card reader
# Copyright © 2013 Red Hat Inc.
#
# Authors:
#
# Chow Loong Jin <lchow@redhat.com>
# Harish Pillay <hpillay@redhat.com>
#
# Initial release: July 31, 2013
# Minor edits: July 31, 2013: giving an e... |
#!/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... |
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Whenever the configuration model changes we need to write code to
upgrade the on-disk format from previous releases. This module will
automatically detect such changes by failing a test, ensuring that upgrade
code is always implemented when necessary.
"""
... |
#!/usr/bin/env python
# Copyright (c) 2015, Juniper Networks, Inc.
# All rights reserved.
#
# Copyright (C) 2012 Martin Blech and individual contributors.
#
# See the LICENSE file for further information.
"""Converts XML to intelligent Python data structures, and converts Python data structures to XML.
For a quick sta... |
import sys
from typing import Generator, List, Optional, TextIO, Tuple
import pytest
if pytest.__version__ < '7.0.0':
from _pytest.config import Config
from _pytest.config.argparsing import Parser
from _pytest.reports import TestReport
from _pytest.runner import CallInfo
else:
from pytest import C... |
'''
Created on Apr 18, 2013
@author: jmht
'''
import copy
import glob
import logging
import os
import shutil
import sys
import unittest
# our imports
import ample_util
import pdb_edit
import run_spicker
import subcluster
class Ensembler(object):
"""Class to generate ensembles from ab inito models (all models mu... |
import math
from django.db.models import Count
from phrasebook.models import UserLanguage, Language, Category, UserProgress
def get_sidebar_args(request, extras):
# print(request.session.)
userlangs = list(UserLanguage.objects.filter(user=request.user))
langs = [lang.language for lang in userlangs]
l... |
__author__ = "Kozo Nishida"
__email__ = "knishida@riken.jp"
__version__ = "0.1.0"
__license__ = "MIT"
API_BASE = "http://rest.kegg.jp/"
import requests
import pandas as pd
from StringIO import StringIO
def search_pathway_object(cpd_ids):
map_list = requests.get('http://rest.kegg.jp/list/pathway/map')
map_ids... |
from trajectory import *
import ik
import config
from collections import deque
import math
def set_cartesian_constraints(x,constraints,solver):
"""For x a workspace parameter setting (achieved via config.getConfig(constraints)),
a set of constraints, and a IKSolver object, modifies the constraints
and the solver so... |
#! /usr/bin/env python3
"""A simple python script that grades MC output from Scantron forms.
Requires two files. (1) The grading key, a matrix with point values for
each answer deliminated by spaces, one row per question. Zeroes must be
included. (2) The raw output from IT. Correctly handles blank answers
("."). The S... |
#! /usr/bin/env python3
from __future__ import print_function
import json
import os
import glob
import sys
import argparse
import string
import logging
class QueryInfo:
def __dict__(self):
info_dict = {
"commands" : self.commands,
"substring" : self.substring,
"tokens": ... |
#
#
# Copyright (C) 2006, 2007, 2010 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is ... |
import boto
import functools
import json
import logging
import random
import requests
import urllib
from urlparse import urlparse
from boto.connection import AWSAuthConnection
from boto.s3.connection import S3Connection
log = logging.getLogger(__name__)
class Endpoint(object):
def __init__(self, host, port, secu... |
import json
import re
import os
import os.path
from collections import OrderedDict
# Regular expression for comments in config file
comment_re = re.compile(
'(^)?[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?',
re.DOTALL | re.MULTILINE
)
# Config dictionary
c = {}
def fixup(adict, k, v):
"""
Fix up a k... |
# Original work Copyright 2013 Arnaud Porterie
# Modified work Copyright 2016 Frazer McLean
#
# 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 decimal import Decimal
import discord
from discord.ext import commands
from django.utils.timezone import activate
from cogs.utils.converters import UserRaidEndTime
from orm.models import BotOnlyChannel
class Admin:
"""Commands for the owner, admins, and mods."""
def __init__(self, bot):
self.b... |
import inspect
import traceback
from contextlib import redirect_stdout
from discord.ext import commands
# Everything is imported to put it in /debug scope
from nabbot import NabBot
from utils import checks
from utils.config import *
from utils.database import *
from utils.discord import *
from utils.general import *
... |
from .utils import config, checks, formats
import discord
from discord.ext import commands
import discord.utils
import random, json, asyncio
from urllib.parse import unquote
class Radio:
"""The radio-bot related commands."""
def __init__(self, bot):
self.bot = bot
if not discord.op... |
# No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
#
# 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
#
# U... |
#
# Copyright (c) 2004-2006 rpath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/... |
#!/usr/bin/env python3
"""
PyLink IRC Services launcher.
"""
import os
import sys
import signal
import time
from pylinkirc import world, conf, __version__, real_version
try:
import psutil
except ImportError:
psutil = None
def main():
import argparse
parser = argparse.ArgumentParser(description='Star... |
#!/usr/bin/env python3
import pygame
from Tile import Grass, Path
def main():
""" Set up the game and run the main game loop """
pygame.init() # Prepare the pygame module for use
surface_sz = 500 # Desired physical surface size, in pixels.
# Create surface of (width, height), and its window.
... |
import os
import sys
current_path = os.getcwd()
sys.path.insert(0, os.path.join(current_path, "../pymunk-4.0.0"))
import pygame
from pygame.locals import *
from pygame.color import *
import pymunk as pm
from pymunk import Vec2d
import math
from pymunk.pygame_util import from_pygame
import time
class Pig():
def _... |
#! coding: utf-8
# pylint: disable-msg=W0311, W0611, E1103, E1101
#@PydevCodeAnalysisIgnore
from raven.contrib.flask import Sentry
from flask import (Flask, request,
render_template, render_template_string,
redirect as redirect_to,
abort,
... |
#!/usr/bin/env python
#
# copy_tests.py: testing the many uses of 'svn cp' and 'svn mv'
#
# Subversion is a tool for revision control.
# See http://subversion.tigris.org for more information.
#
# ====================================================================
# Copyright (c) 2000-2004 CollabNet. All righ... |
# Headers
__author__ = 'Somsubhra Bairi'
__email__ = 'somsubhra.bairi@gmail.com'
# All imports
from webapp import WebApp
from txtdump import TxtDump
from logger import Logger
from sanitizer import Sanitizer
from stemmer import Stemmer
from tf import TermFrequency
from tficf import TFICF
from psycholinguistic_db impor... |
# -*- coding: utf-8 -*-
# Author: Florian Mayer <florian.mayer@bitsrc.org>
# pylint: disable=C0103,R0903
from __future__ import absolute_import
from datetime import datetime
from sunpy.net.attr import (
Attr, ValueAttr, AttrWalker, AttrAnd, AttrOr, DummyAttr, ValueAttr
)
from sunpy.util.util import to_angstrom,... |
#!/usr/bin/env python
# web framework
from bottle import *
# python built-ins
import uuid, hashlib, shutil, string
import random, subprocess, sys, os, re
import cgi, urllib2, json, smtplib, time
# other local modules
import config, uploads, process
import scheduler, scheduler_mp
import apps as appmod
import plots as p... |
import sys
import os
import argparse
import pygments
import json
from argparse import ArgumentParser
from pygments.token import *
from pygments.lexers import guess_lexer, guess_lexer_for_filename
from src.todo import TODO
global_error_list = []
def parse_args():
'''
Argument Parsing Helper Function
Setup... |
"""This is the Bokeh charts interface. It gives you a high level API to build
complex plot is a simple way.
This is the Dot class which lets you build your Dot charts just
passing the arguments to the Chart class and calling the proper functions.
It also add detection of the incomming input to see if it is a pandas da... |
#/usr/bin/env python
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import time
import requests
import argparse
import gevent
import os
import sys
import urlparse
from gevent.pool import Pool
from gevent.socket import gethostbyname
from collections import defaultdict
from sys import exit
HTTP... |
from newt.views import JSONRestView
from common.response import json_response
from django.conf import settings
import urllib
job_adapter = __import__(settings.NEWT_CONFIG['ADAPTERS']['JOB'], globals(), locals(), ['adapter'], -1)
import logging
logger = logging.getLogger(__name__)
class JobRootView(JSONRestView):
... |
#!/usr/bin/python3
import sys
import csv
import os.path
import urllib.request
helpmessage = """Usage:
install <package name>
remove <package name>
update
upgrade"""
if len(sys.argv) >= 2 and len(sys.argv) <= 3:
if sys.argv[1] == "install":
print("Installing...")
if os.path.isfile("pkglist.csv") == True:
p... |
"""
Provides information about elements.
Eg. atomic mass, radius, etc.
@author: Chris Scott
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import sys
import logging
from ..visutils.utilities import dataPath, createDataFile
import s... |
# -*- test-case-name: imaginary.test.test_objects,imaginary.test.test_actions -*-
"""
This module contains the core, basic objects in Imaginary.
L{imaginary.objects} contains the physical simulation (L{Thing}), objects
associated with scoring (L{Points}), and the basic actor interface which allows
the user to perform... |
#!/usr/bin/env python
from __future__ import division
import cluster_labeling.optemo_django_models as optemo
import subprocess
import time
import re
output_subdir = 'cluster_labeling/cc_boostexter_files/'
boostexter_subdir = 'cluster_labeling/BoosTexter2_1/'
boosting_fields = [
('title', 'text'),
('brand', ... |
# Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
import base64
import os
import time
import mimetypes
from collections import namedtuple
from contextlib import contextmanager
from odoo import api, fields, models, _
from odoo.tools import safe_eval
from odoo.e... |
#! /usr/bin/env python
"""Londiste setup and sanity checker.
"""
import sys, os, skytools
from pgq.cascade.admin import CascadeAdmin
__all__ = ['LondisteSetup']
class LondisteSetup(CascadeAdmin):
"""Londiste-specific admin commands."""
initial_db_name = 'node_db'
extra_objs = [ skytools.DBSchema("londi... |
#!/usr/bin/env python3
import wpilib
from wpilib.cantalon import CANTalon
class MyRobot(wpilib.SampleRobot):
def robotInit(self):
self.servo= wpilib.Servo(6)
##INITIALIZE JOYSTICKS##
self.joystick1 = wpilib.Joystick(0)
self.joystick2 = wpilib.Joystick(1)
##IN... |
import sys
from twisted.application import service, internet
from twisted.conch import manhole_ssh
from twisted.conch.checkers import SSHPublicKeyDatabase
from twisted.cred import portal
from twisted.internet.protocol import ServerFactory
from twisted.internet.ssl import ClientContextFactory
from twisted.python import... |
#!/usr/bin/python
import serial
import time
import sys
import terminal_colors as tc
response_wait = 0.1
s = None
debug_mode = False
macro_count = 0
def flush_input():
s.flushInput()
def wait_for... |
"""Learn to estimate functions from examples. (Chapters 18-20)"""
from utils import *
import agents, random, operator
#______________________________________________________________________________
class DataSet:
"""A data set for a machine learning problem. It has the following fields:
d.examples A li... |
# -*- coding: utf-8 -*-
"""ThreatConnect Common Case Management"""
from tcex.case_management.common_case_management_collection import CommonCaseManagementCollection
class CommonCaseManagement:
"""Common Class for Case Management.
Args:
tcex ([type]): [description]
api_endpoint ([type]): [desc... |
# 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... |
# File: pig_latin.py
# Purpose: Implement a program that translates from English to Pig Latin
# Programmer: Amal Shehu
# Course: Exercism
# Date: Monday 26 September 2016, 12:40 AM
def translate(english):
pyg = 'ay'
if len(english) > 0 and english.isalpha():
word = english.lowe... |
import itertools
import copy
import numpy as np
from spinn import util
# PyTorch
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
from spinn.util.blocks import BaseSentencePairTrainer, Reduce
from spinn.util.blocks import LSTMState, Em... |
import argparse
import os
from isort import isort
def main(argv=None):
def imports_incorrect(filename):
return isort.SortImports(filename, check=True).incorrectly_sorted
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='*', help='Filenames to run')
parser.add_argumen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.