src stringlengths 721 1.04M |
|---|
"""Implement SeshetBot as subclass of ircutils3.bot.SimpleBot."""
import logging
import os
from io import StringIO
from datetime import datetime
from ircutils3 import bot, client
from .utils import KVStore, Storage, IRCstr
class SeshetUser(object):
"""Represent one IRC user."""
def __init__(self, nick... |
import cv2
import dbr
import time
import threading
import Queue
import os
q = Queue.Queue(1)
class BarcodeReaderThread (threading.Thread):
def __init__(self, name, isRunning):
threading.Thread.__init__(self)
self.name = name
self.isRunning = isRunning
def run(self):
global q
... |
from django import forms
from speech.models import Feedback
from speech import config
ERROR_MESSAGES = {
'required': 'Это поле обязательно к заполнению.',
'max_length': 'Слишкое длинное значение.',
'min_length': 'Слишком короткое значение.',
'invalid': 'Некорректное значение.',
}
class FeedbackFor... |
#!/usr/bin/env python
#
# Copyright 2012, 2013 Nick Galbreath
# nickg@client9.com
# BSD License -- see COPYING.txt for details
#
"""
Converts a libinjection JSON data file to a C header (.h) file
"""
import sys
def toc(obj):
""" main routine """
print """
#ifndef LIBINJECTION_SQLI_DATA_H
#define LIBINJEC... |
import py
from ..base import BaseTopazTest
E = 0.00000000000001
class TestConstraintVariableObject(BaseTopazTest):
def execute(self, space, code, *libs):
return [space.execute("""
require "%s"
%s
""" % (lib, code)) for lib in libs]
def test_midpoint(s... |
import power4
#def test_final():
# assert power4.isOver([
# [0, 1, 2, 1, 2, 1, 1],
# [0, 2, 1, 1, 1, 2, 2],
# [0, 1, 2, 2, 2, 1, 1],
# [1, 2, 1, 1, 1, 2, 2],
# [2, 1, 1, 2, 2, 2, 1],
# [1, 2, 2, 1, 2, 1, 2],
# ]) == True
def test_p1_win_one_line():
assert power4.isOve... |
from itertools import count
from typing import Callable, Iterable, List
from .number_theory.primes import primes_sequence # noqa: F401
def fibonacci_sequence() -> Iterable[int]:
a, b = 0, 1
while True:
yield a
a, b = b, a + b
def collatz_sequence(n: int=13) -> Iterable[int]:
while n ... |
# PyTweeps: Simple Python program to help manage your twitter followers.
# https://github.com/samw3/PyTweeps
import pkg_resources
import tweepy
import webbrowser
import shelve
import pprint
import sys
import traceback
import time
import collections
from datetime import datetime
from datetime import timedelta
from conf... |
#!/usr/bin/python
# coding: UTF-8
import sys
from socket import *
import struct
import raid_pb2
import wanyaogu_pb2
import login_pb2
import cast_skill_pb2
import move_direct_pb2
import team_pb2
import datetime
import get_one_msg
import scene_transfer_pb2
import horse_pb2
WATCH_PLAYER = {8589935415}
HOST='127.0.0.1'
... |
# _*_ coding: utf-8 _*_
"""
-------------------------------------------------
@File Name: apptools
@Description:
@Author: caimmy
@date: 2020/1/13 17:06
-------------------------------------------------
Change Activity:
-------------------------------------------------
"""
import os
from gensim.models import Word2Vec
... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... |
"""
hellostats sample API
author: Alex G.S.
Utils for use by the hello app such as html formatting
getting loadavg of the server and ipaddress
"""
import os, socket, re
import requests
import json
# server tools and stats
def get_ip():
"""get the ip address for the server"""
aws_url="http://169.254.169.254... |
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ValueAPIEmptyClassTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test(self):
self.build()
exe = self.getBuildArtifact("a.out")
line = ... |
<<<<<<< HEAD
<<<<<<< HEAD
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <z... |
#!/usr/bin/env python
#
# Copyright 2014 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 requir... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
from data.game import Game
from data.player import Player
from utils import random_string
from config import uid_length
games = {}
def game_new(id):
# if games does not exist, create id
if id not in games:
games[id] = Game(id)
if games[id].getPlayerCount() < 2:
player = Player(random_st... |
#!/usr/bin/env python
# coding=utf-8
from setuptools import setup
import codecs
# Patch distutils if it can't cope with the
# `classifiers` or `download_url` keywords
from sys import version
if version < '2.2.3':
from distutils.dist import DistributionMetadata
DistributionMetadata.classifiers = None
Distr... |
# coding: utf-8
"""
weasyprint.layout.tables
------------------------
Layout for tables and internal table boxes.
:copyright: Copyright 2011-2016 Simon Sapin and contributors, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division, unicode_literals
from ..compa... |
# -*- coding: utf8
'''
Methods for comparing Top-K lists. See [1]_
References
----------
.. [1] Comparing top k lists.
Ronald Fagin, Ravi Kumar, D. Sivakumar
SIAM J. Discrete Mathematics 17, 1 (2003). PP/ 134-160
'''
from __future__ import division, print_function
import itertools
def kendall_tau_dist... |
'''
import what we need'''
# os provides a portable way of using operating system dependent functionality
import os
from os.path import join
# nltk is a leading platform for building python programs to work with human language data, you'll need to install it
import nltk
from dictionaries import dictionary_sho
'''
... |
#! /usr/bin/env python
import atexit
import errno
from multiprocessing import Process
import os
import sys
import state
try:
import fcntl # @UnresolvedImport
except:
pass
class singleinstance:
"""
Implements a single instance application by creating a lock file at appdata.
This is based upon th... |
""" Learned classification model """
import tensorflow as tf
from PeriodicClassification import ModelConfig as myConfig
from PeriodicClassification import Preprocess as pre
def _model(X, keep_prob):
# input
W1 = tf.Variable(tf.random_normal([myConfig.INPUT_SIZE, myConfig.HIDDEN_SIZE]), name="weight1")
b1 ... |
#!/usr/bin/env python
#
# Created on 9/27/2012 Pat Cappelaere - Vightel Corporation
#
# Requirements:
# gdal, numpy pytrmm...
#
# Access and Process MODIS Active Fires
#
# https://firms.modaps.eosdis.nasa.gov/active_fire/text/Central_America_7d.csv
# http://firms.modaps.eosdis.nasa.gov/active_fire/text/Central_America_... |
"""
Django settings for capomastro project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to assume a role using AWS Security Token Service (AWS STS) credentials.
"""
import json
import time
import sys
import boto3
from botocore.exceptions import ClientError
def progress_bar(... |
from tkinter import ttk
from porcupine import get_tab_manager, utils
# i have experimented with a logging handler that displays logging
# messages in the label, but it's not as good idea as it sounds like,
# not all INFO messages are something that users should see all the time
# this widget is kind of weird
class ... |
import hashlib
import time
from collections import namedtuple, OrderedDict
from copy import copy
from itertools import chain
import gevent
import six
from six.moves import xrange
from . import events
from .exception import StopLocust
from .log import console_logger
STATS_NAME_WIDTH = 60
"""Default interval for how ... |
# 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
# distrib... |
#!/usr/bin/env python3.4
import sys
from PyQt4 import QtGui
import re
import os, sys
import subprocess
import urllib.request
import urllib.error
import hashlib
#TODO
#-input for the link of xdcc server
#-dl button ? or automatize the action
#- /!\ Configuration file /!\
def get_hash(name):
readsize = 64 * 1024
... |
import numpy as np
def genEstimates(rank_data, key):
"""takes in rank data from expandSeaData and returns a
list of matrices for each year"""
rank_values = rank_data[["team", key]].values
data_dict = {}
for row_i in rank_values:
data_dict[row_i[0]] = {}
for row_j in rank_values:
... |
# -*- encoding: utf-8 -*-
"""
Usage::
hammer sunscription [OPTIONS] SUBCOMMAND [ARG] ...
Parameters::
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands::
delete-manifest Delete manifest from Red Hat provider
list ... |
import ctypes
import time #test only
#init
kdtree = ctypes.cdll.LoadLibrary("c_optimized/kdtree.so")
kdtree3 = ctypes.cdll.LoadLibrary("c_optimized/kdtree3.so")
kdtree.call_this()
#types
vector2 = ctypes.c_double*2
vector2p = ctypes.c_double*3
vector3 = ctypes.c_double*3
vector3p = ctypes.c_double*4
kdtree_p = ctypes... |
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... |
from flask import Flask
from flask import (request,
redirect,
url_for,
session,
render_template,
jsonify)
import gensim
import numpy as np
from scipy.spatial.distance import cosine
from nltk.tokenize import PunktSentenceTok... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import functools
from testcase import DocumentTranslationTest
from preparer import DocumentTranslationPreparer, DocumentTranslationClientPreparer as _Doc... |
# -*- coding: utf-8 -*-
import imp
import sys
import gettext
import tasks_list
import metrics
import statistics_plotter
def metric_module_import(metric_name):
"""
импортирует модуль, который
обеспечивает работу с метрикой.
"""
try:
#module=importlib("metrics.metric_"+metric_name)
... |
from statsmodels.tsa import arima_model
import numpy as np
from pug.invest import util
y = util.simulate(poly=100, sinusoids=(10, 100, -20)).values
hr = np.arange(365*96)*.25
t = hr * 3600
sinusoids = [
np.random.normal(0.0, 0.1, 365*96)+10 + 3*np.sin(hr*2*np.pi/96/.25),
np.random.normal(0.0, 0.1, 365*96)+15 ... |
#!/usr/bin/env python
#
# Copyright (C) 2012 LeZiZi Studio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
from ctypes import c_void_p
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import OGRException
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
from django.utils import six
from django.utils.encoding import force_bytes, force_text
class Driver(GDALBase... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-02-21 00:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionarios', '0001_initial'),
]
operations = [
migrations.RemoveField(
... |
import numpy as np
import math
import pprint
# dynamic programming for peak alignment
#
# dp: y -> sizes
# x -> retention_time
#
#
#
def estimate_z( peak_pairs, degree = 3 ):
""" estimate z and rss based on [y, x]
x: rtime
y: ladder sizes
return (z, rss)
z is polynomial coeff... |
from itertools import chain
from flask import request
class Navigation:
mapping = {}
selected_class = "selected"
def __init__(self):
self.mapping = {
navigation: {
# if not specified, assume endpoints are all in the `main` blueprint.
self.get_endpoint... |
# encoding: utf-8
'''
MSFN demo 2D
++++++++++++
'''
from __future__ import absolute_import
import time
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse import csr_matrix
from medianshape.simplicial.meshgen import distmesh2d
from medianshape.simplicial.mesh import Mesh2D
from medianshape.simplici... |
"""Helper functions for the NAPALM base."""
# std libs
import os
import re
import sys
import itertools
import logging
from collections.abc import Iterable
# third party libs
import jinja2
import textfsm
from netaddr import EUI
from netaddr import mac_unix
from netaddr import IPAddress
from ciscoconfparse import CiscoC... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# home
#
#
# vim:fileencoding=utf-8:sw=4:et -*- coding: utf-8 -*-
#
# 测试 pyalgotrade 回测
#
import _index
from energy.libs.MongoStock import Feed
from energy.libs.eAlgoLib import eAlgoLib as eal
from pyalgotrade import strategy
from pyalgotrade import bar
from pyalgotrade.tec... |
# DEPRECATED
# import json
# import time
# import multiprocessing
# from .generic_kafka_processor import GenericKafkaProcessor
# from ..imgio.imgio import buffer_to_B64
#
# default_prefix = "KIP_"
# default_prefix_frompkl = "KIPFP_"
#
# # TODO: This class should be rewritten to actually extract features from images...
... |
import numpy as np
import warnings
from nose.tools import assert_raises
from theano.compat import exc_message
from theano.compat.python2x import OrderedDict
from theano import shared
from theano import tensor as T
from pylearn2.costs.cost import Cost
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 13 13:02:41 2015
Copyright 2015 Nicolo' Navarin
This file is part of scikit-learn-graph.
scikit-learn-graph 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 ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Lean Reference Manual documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 17 21:46:05 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are presen... |
"""Xml functions for helping in convertion of data"""
def xml_station_status_wrapper(xmlnode):
"""Convert Station status xml
to a usable dict"""
def node_value(name):
return xmlnode.getElementsByTagName(name)[0].childNodes[0].data
return {'total': int(node_value('total')),
'availa... |
from rest_framework import status
from rest_framework.response import Response
from app.plugins import PluginBase, Menu, MountPoint, get_current_plugin
from app.plugins.views import TaskView
from django.shortcuts import render
from django import forms
class TestForm(forms.Form):
testField = forms.CharField(label=... |
#-*- coding: utf-8 -*-
'''
Created on 2017. 11. 06
Updated on 2017. 11. 06
'''
from __future__ import print_function
import os
import cgi
import re
import time
import codecs
import sys
import subprocess
import math
import dateutil.parser
from datetime import datetime
from commons import Subjects
from x... |
"""zibawa URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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-bas... |
#!/usr/bin/python
# 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 distributed in the hope that it wi... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Justin Santa Barbara
# 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.apach... |
#!/usr/bin/env python
#
# 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
# "... |
import configparser
import os
from pathlib import Path
import sys
DEFAULTS = {
"mwfn": "Multiwfn",
"jmol": "jmol",
"packmol": "packmol",
}
# First try to read pysisyphusrc path an environment variable
try:
pysisrc_env = os.getenv("PYSISRC", default=None)
config_fn = Path(pysisrc_env).resolve()
... |
# -*- coding: utf-8 -*-
"""
Shikin review page and associated API
"""
from sqlalchemy import func
import datetime
import random
from flask import render_template, abort, request, jsonify, session
from . import app, ocrfix
from .model import DocSegment, DocSegmentReview, User
from .util import dologin
def get_user_o... |
bl_info = {
"name": "LeoMoon TextCounter",
"author": "LeoMoon Studios - www.LeoMoon.com and Marcin Zielinski - www.marcin-zielinski.tk/en/",
"version": (1, 3, 4),
"blender": (2, 80, 0),
"location": "Font Object Data > LeoMoon TextCounter",
"description": "Text counter for displays, HUDs etc.",
... |
# -*- coding: utf-8 -*-
"""`PEP 3101`_ introduced the :meth:`str.format` method, and what
would later be called "new-style" string formatting. For the sake of
explicit correctness, it is probably best to refer to Python's dual
string formatting capabilities as *bracket-style* and
*percent-style*. There is overlap, but ... |
#!/usr/bin/env python3
import sys
import requests
import json
import unittest
import datetime
from util import TestCase
import config
import common
class TestApiBulletinAdminCross(TestCase):
url = '%s/api/groups/1/bulletins/'%(config.base_url)
cross_url = None
token = common.get_user_info({'account': confi... |
import unittest
from perfrunner.__main__ import get_options
from perfrunner.helpers.memcached import MemcachedHelper
from perfrunner.helpers.remote import RemoteHelper
from perfrunner.helpers.rest import RestHelper
from perfrunner.settings import ClusterSpec, TestConfig
from perfrunner.tests import TargetIterator
cl... |
# Copyright (c) 2018 Phil Birkelbach
#
# 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... |
# ===============================================
# MODULE STUDY: platform
import platform
################################ Cross Platform ################################
platform.architecture() # Returns a tuple (bits, linkage)
platform.machine() # Returns the machine type, e.g. 'i386'
platform.node(... |
"""
Play scales on the Lego NXT.
Copyright (C) Sarah Mount, 2008.
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 progra... |
"""This file contains code used in "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import thinkstats2
import thinkplot
import math
import random
def WriteFile(data, filename):
"""Writes a list of numb... |
#!/usr/bin/env python
# Copyright 2016 Criteo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
import datetime
from django.conf import settings
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
from django.cor... |
# UT| python2 {src_file}
from __future__ import print_function
# UT[ ../unte.py * compile_file
def compile_file(dst, src, tags_master, tags_db):
f = open(src)
tag_iter = iter(enumerate_tags(tags_master))
try:
tag = next(tag_iter)
except StopIteration:
tag = None
line_no = 0
in... |
"""
Regression test for fd.o #20442, where the XMPP error returned by a server that
doesn't like the avatar you tried to set was not mapped to a TP error before
being sent over the bus.
"""
from twisted.words.xish import domish
from servicetest import call_async
from gabbletest import exec_test, expect_and_handle_get... |
import ConfigParser
from r515.basic_functions import BasicFunctions
from r515.basic_settings import BasicSettings
from r515.connection import Connection
config = ConfigParser.ConfigParser()
config.read(['r515.cfg'])
conn = Connection(config.get('Connection', 'IP'), config.get('Connection', 'USR'), config.get('Connect... |
import dolfin as df
import os
from . import *
from common.io import mpi_is_root, load_mesh
from common.bcs import Fixed, Pressure, Charged
from ufl import sign
import numpy as np
__author__ = "Gaute Linga"
class PeriodicBoundary(df.SubDomain):
# Left boundary is target domain
def __init__(self, Ly, grid_spaci... |
#!/usr/bin/env python
__all__ = ['qq_download']
from ..common import *
from .qie import download as qieDownload
from urllib.parse import urlparse,parse_qs
def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False):
info_api = 'http://vv.video.qq.com/getinfo?otype=json&appver=3%2E2%2E19%2E333... |
import ide
abjad_ide = ide.AbjadIDE(test=True)
scores = ide.configuration.test_scores_directory
def test_AbjadIDE_color_01():
"""
Colors clefs in segment directory.
"""
with ide.Test():
path = ide.Path(
scores, "green_score", "green_score", "segments", "01", "illustration.ly"
... |
from nose.tools import *
import numpy as np
import dit
import networkx as nx
def test_distribution_from_bayesnet_nonames():
# Smoke test without rv names.
x = nx.DiGraph()
d = dit.example_dists.Xor()
cdist, dists = d.condition_on([0, 1])
x.add_edge(0, 2)
x.add_edge(1, 2)
x.node[2]['dist'] ... |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 requir... |
import logging
import re
import time
import json
import traceback
import os
import raven
from slacker import Slacker
from slackclient import SlackClient
from asq.initiators import *
from phabricator import Phabricator
from functools import wraps
class memo:
def __init__(self, fn):
self.fn ... |
import base64
import datetime
import logging
import os
import pickle
import re
import hiyapyco
import sarge
from simple_salesforce import Salesforce
import yaml
import requests
from distutils.version import LooseVersion # pylint: disable=import-error,no-name-in-module
from github3 import login
from Crypto import Ra... |
'''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
---------------------------... |
"""
Sprites for attacks.
"""
import sys
import pygame as pg
from .. import setup, tools
#Python 2/3 compatibility.
if sys.version_info[0] == 2:
range = xrange
class Fire(pg.sprite.Sprite):
"""
Fire animation for attacks.
"""
def __init__(self, x, y):
super(Fire, self).__init__()
se... |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
import sys, os
from optparse import OptionParser, OptionGroup
import xml.etree.ElementTree as ET
## Importing Utils from parent path
file_path = os.path.dirname(__file__)
join_path = os.path.join(file_path, '../Utils')
abs_path = os.path.abspath(join_path)
sys.path.app... |
import sensor_msgs.msg as sm
import numpy as np
import copy
import rospy
class DetectRobotMove:
JOINT_TO_WATCH = ['fl_caster_rotation_joint', 'fl_caster_l_wheel_joint',
'fl_caster_r_wheel_joint', 'fr_caster_rotation_joint',
'fr_caster_l_wheel_joint', 'fr_caster_r_w... |
# Copyright (C) 2010-2015 GRNET S.A. and individual contributors
#
# 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... |
# Title: Simulating Non-Determinism
# Each regular expression can be converted to an equivalent finite state
# machine. This is how regular expressions are implemented in practice.
# We saw how non-deterministic finite state machines can be converted to
# deterministic ones (often of a different size). It is also pos... |
# -*- coding: utf-8 -*-
'''
@author: Gabriele Girelli
@contact: gigi.ga90@gmail.com
@description: contains Series wrapper, which in turn contains Nucleus.
'''
# DEPENDENCIES =================================================================
import math
import os
import matplotlib.pyplot as plt
import numpy as np
fro... |
from abc import ABCMeta, abstractmethod
class BaseStorage(metaclass=ABCMeta):
@abstractmethod
def get(self, blueprint):
return None
@abstractmethod
def set(self, blueprint, token):
return None
@abstractmethod
def delete(self, blueprint):
return None
class NullStorag... |
def override(cls):
"""Annotation for documenting method overrides.
Arguments:
cls (type): The superclass that provides the overriden method. If this
cls does not actually have the method, an error is raised.
"""
def check_override(method):
if method.__name__ not in dir(cls)... |
##########################################################################
#
# Copyright (c) 2014, John Haddon. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions... |
#!/usr/bin/env python
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2012 Raik Gruenberg & Johan Leckner
##
## 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 Softwar... |
# -*- 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
# module gtk._gtk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/_gtk.so
# by generator 1.135
# no doc
# imports
import atk as __atk
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
from VBox import VBox
from RecentChooser import RecentChooser
cla... |
#!/usr/bin/env python
#
# Installing Example
#
# build.py
#
# Requirements:
#
# Ubuntu: sudo apt install gcc ccache
#
# To install your build, use the Copy executor and set "inputs_from=" to the generating phase,
# as well as "output_strip_prefix_from=" if you want to strip the original output path.
#
# Run with th... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 - 2016 CoNWeT Lab., Universidad Politécnica de Madrid
# This file belongs to the business-charging-backend
# of the Business API Ecosystem.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License... |
#!/usr/bin/env python
"""
This will show russian text in koi8-r encoding.
"""
from xml.parsers import expat
import string
# Produces ImportError in 1.5, since this test can't possibly pass there
import codecs
class XMLTree:
def __init__(self):
pass
# Define a handler for start element events
de... |
from edc_appointment.models import Appointment
from edc_constants.constants import YES, NO, NOT_APPLICABLE
from django import forms
from django.apps import apps as django_apps
from ..models import (MaternalArvPreg, MaternalArv, MaternalLifetimeArvHistory)
from .base_maternal_model_form import BaseMaternalModelForm
... |
from teafacto.blocks.seq.rnn import SeqEncoder, MaskMode
from teafacto.blocks.seq.rnu import GRU
from teafacto.blocks.basic import IdxToOneHot, Embedder, VectorEmbed
from teafacto.blocks.lang.wordvec import Glove
from teafacto.core.base import *
from teafacto.core.base import tensorops as T
class WordEmbed(Embedder):... |
# Copyright (c) 2019 Dassault Systemes. All rights reserved.
import h5py
import sdf
import numpy as np
import os
import sys
def _to_python_str(s):
""" Convert to Python string """
if isinstance(s, bytes):
return s.decode('utf-8')
else:
return s
def load(filename, obje... |
"""
"""
import os, sys
import py
class Checkers:
_depend_on_existence = 'exists', 'link', 'dir', 'file'
def __init__(self, path):
self.path = path
def dir(self):
raise NotImplementedError
def file(self):
raise NotImplementedError
def dotfile(self):
return self.pa... |
import urllib
import urllib2
import urlparse
import socket
import time
import json
import sys
import logging
logger = logging.getLogger(__name__)
import pprint
pp = pprint.PrettyPrinter(indent=4)
# we need to make sure we don't follow redirects so build a new opener
class NoRedirection(urllib2.HTTPErrorProcessor):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.