text
stringlengths
17
737k
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import _, api, fields, models from ast import literal_eval from odoo.exceptions import UserError class MailResendMessage(models.TransientModel): _name = 'mail.resend.message' _description = 'Email rese...
# -*- coding: utf-8 -*- from django.core.mail import mail_admins from django.http import HttpResponse, Http404 from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST from intellectmoney import settings from intellectmoney.forms imp...
# -*- coding: utf-8 -*- """ SECURITY ENDPOINTS CHECK Add auth checks called /checklogged and /testadmin """ import abc import jwt import hmac import hashlib import base64 import pytz import socket from rapydo.utils.uuid import getUUID from datetime import datetime, timedelta from flask import current_app, request fr...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2015-2018 GEM Foundation # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the Licen...
""" Django settings for sew_django 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, ...)...
#!/usr/bin/env python import fnmatch import os import sys import re import math import platform import xml.etree.ElementTree as ET ################################################################################ # Config # #########################...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of MaliceIO - https://github.com/malice-plugins/pdf # See the file 'LICENSE' for copying permission. __description__ = 'Malice PDF Plugin' __author__ = 'blacktop - <https://github.com/blacktop>' __version__ = '0.1.0' __date__ = '2018/01/29' import has...
# ERPNext - web based ERP (http://erpnext.com) # Copyright (C) 2012 Web Notes Technologies Pvt Ltd # # 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 yo...
import signal, errno from contextlib import contextmanager import fcntl import sys from cwbot.main import main @contextmanager def timeout(seconds): def timeout_handler(signum, frame): pass original_handler = signal.signal(signal.SIGALRM, timeout_handler) try: signal.alarm(seconds) ...
from datetime import timedelta from celery.schedules import crontab from kombu import Exchange, Queue import os class Config(object): DEBUG = False ADMIN_BASE_URL = os.environ['ADMIN_BASE_URL'] ADMIN_CLIENT_USER_NAME = os.environ['ADMIN_CLIENT_USER_NAME'] ADMIN_CLIENT_SECRET = os.environ['ADMIN_CLIENT...
"""ML component.""" from feature_extraction import entry2mat, url2mat from collections import namedtuple from content_extraction import entry2url from datastores import training_db, model_db from flask import g import gc import logging as log import numpy as np import sklearn.linear_model as lm Feedback = namedtuple("...
import json import os from django.test import SimpleTestCase from mock import patch from corehq.apps.app_manager.models import Application, CaseList, Module from corehq.apps.app_manager.tests.app_factory import AppFactory @patch('corehq.apps.app_manager.models.validate_xform', return_value=None) @patch('corehq.app...
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config: APP_NAME = 'IdleFreePhilly' SECRET_KEY = os.environ.get('SECRET_KEY') or \ 'SjefBOa$1FgGco0SkfPO392qqH9%a492' SQLALCHEMY_COMMIT_ON_TEARDOWN = True SSL_DISABLE = True MAIL_SERVER = 'smtp.googlemail.com' MAIL_...
"""DistributedLevel.py: contains the DistributedLevel class""" from ClockDelta import * from PythonUtil import Functor, sameElements, list2dict, uniqueElements import ToontownGlobals import DistributedObject import Level import LevelConstants import DirectNotifyGlobal import EntityCreator import OnscreenText import Ta...
#!/usr/bin/env python2.7 """ MO A simple utility to organize music files into directories based on tags. Requires Python 2.7 and the Mutagen tagging library. """ import os import unicodedata import shutil import argparse import mutagen def main(): parser = argparse.ArgumentParser(prog='MO', descripti...
# Copyright (C) 2009-2011 Wander Lairson Costa # # The following terms apply to all files associated # with the software unless explicitly disclaimed in individual files. # # The authors hereby grant permission to use, copy, modify, distribute, # and license this software and its documentation for any purpose, provi...
import ConfigParser import shutil import threading, time, os from db import DB from preprocessing import Preprocessor class PostprocessingWorker(threading.Thread): """ Python script for Postprocessing worker... runs until cancelled or till max waiting time """ pause_time = 2 max_waiting_time = 60 * 6...
"""DistributedLevel.py: contains the DistributedLevel class""" from ClockDelta import * from PythonUtil import Functor, sameElements, list2dict, uniqueElements import ToontownGlobals import DistributedObject import Level import LevelConstants import DirectNotifyGlobal import EntityCreator import OnscreenText import Ta...
''' Created on Nov 13, 2014 @author: Daniel Nam dwn28 ''' import math import pickle from Artistdata import * def nb(traindata, testdata): trainlabel = [] testlabel = [] trainfeature = [] testfeature = [] trainfile = open('traindata.txt','a') for d in traindata: if d.label==0: ...
import os from xml.etree import ElementTree import requests from usgs import USGS_API, USGSError, USGSConnectionError from usgs import soap, xsi TMPFILE = os.path.join("/", "tmp", "usgs") NAMESPACES = { "SOAP-ENV": "http://schemas.xmlsoap.org/soap/envelope/", "ns1": "https://earthexplorer.usgs.gov/inventory...
import os import shutil import random import socket import tempfile import json import base64 import requests import subprocess import re from time import sleep, time from datetime import datetime from hashlib import sha256 from StringIO import StringIO from tempfile import NamedTemporaryFile from netaddr import IPSet,...
""" OSPC Tax-Calculator policy Parameters class. """ # CODING-STYLE CHECKS: # pep8 --ignore=E402 parameters.py # pylint --disable=locally-disabled parameters.py from .utils import expand_array import os import json DEFAULT_START_YEAR = 2013 class Parameters(object): """ Constructor for federal income tax p...
""" St. George Game person.py Sage Berg Created: 7 Dec 2014 """ import abc from collections import namedtuple import actions from raffle import Raffle Pronouns = namedtuple("Pronouns", ["subj", "obj", "tense"]) class Person(object): """ abstract class """ __metaclass__ = abc.ABCMeta @abc.abst...
"""Convolutional network example. Run the training for 50 epochs with ``` python __init__.py --num-epochs 50 ``` It is going to reach around 0.8% error rate on the test set. """ import logging import numpy from argparse import ArgumentParser from theano import tensor from blocks.algorithms import GradientDescent, S...
# Test enhancements related to descriptors and new-style classes from test_support import verify, vereq, verbose, TestFailed, TESTFN from copy import deepcopy import warnings warnings.filterwarnings("ignore", r'complex divmod\(\), // and % are deprecated$', DeprecationWarning, r'(<string>|%s)$' % __...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
#!/usr/bin/env python # -*- coding: utf-8 -*- from sqlalchemy import * #from sqlalchemy import create_engine from sqlalchemy.orm import relation, sessionmaker from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.sql import text import sys reload(sys) sys.setdefaultencoding("utf-8") # Create connec...
from django.db import models from django.conf import settings from django.contrib.auth.signals import user_logged_in import json from model_utils.choices import Choices from model_utils.fields import StatusField from model_utils.models import TimeStampedModel from model_tenants.exceptions import TenantNotFoundError ...
import os import mimetypes import botocore.session from pulsar.apps.greenio import GreenPool, getcurrent from .sock import wrap_poolmanager, StreamingBodyWsgiIterator # 8MB for multipart uploads MULTI_PART_SIZE = 2**23 class Botocore(object): '''An asynchronous wrapper for botocore ''' def __init__(se...
import discord import aiohttp import json from __main__ import send_cmd_help from discord.ext import commands BASEURL = 'http://dnd5eapi.co/api/' class DND: '''D&D Lookup Stuff''' def __init__(self, bot): self.bot = bot @commands.group(pass_context=True) async def dnd(self, ctx): if ...
""" Copyright 2013 Shine Wang 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...
############################################################################### # actionAngle: a Python module to calculate actions, angles, and frequencies # # class: actionAngleIsochroneApprox # # Calculate actions-angle coordinates for any potential by using # an isochrone potential ...
# Create your views here. # -*- coding: UTF-8 -*- from django.http import HttpResponse, HttpResponseRedirect import json from datetime import datetime from django.contrib import auth from ..serializers import * from ..forms import * from .. import tablefactory def session(request): if request.method == 'POST': ...
import xml.sax import xml.sax.handler import types try: _StringTypes = [types.StringType, types.UnicodeType] except AttributeError: _StringTypes = [types.StringType] START_ELEMENT = "START_ELEMENT" END_ELEMENT = "END_ELEMENT" COMMENT = "COMMENT" START_DOCUMENT = "START_DOCUMENT" END_DOCUMENT = "END_DOCUMENT" ...
""".""" import time as _time from functools import partial as _partial import numpy as _np import numpy.polynomial.polynomial as _np_pfit import matplotlib.pyplot as _mplt import matplotlib.gridspec as _mgs import scipy.optimize as _scy_opt import scipy.integrate as _scy_int from siriuspy.devices import BPM, CurrInfo...
""" test audiofileIO module """ import os from glob import glob import pytest from scipy.io import wavfile import numpy as np import hvc.audiofileIO import hvc.evfuncs import hvc.koumura import hvc.parse.ref_spect_params from hvc.utils import annotation @pytest.fixture() def has_window_error(): filename = os.p...
''' ------------------------------------------------------------------------ Last updated 7/15/2014 Python version of Evans/Philips 2014 paper This program solves for transition path of the distribution of wealth and the aggregate capital stock using the time path iteration (TPI) method This py-file calls the followi...
#!python """Bootstrap setuptools installation If you want to use setuptools in your package's setup.py, just include this file in the same directory with it, and add this to the top of your setup.py:: from ez_setup import use_setuptools use_setuptools() If you want to require a specific version of setuptools...
# -*- coding: utf-8 -*- ''' Connection module for Amazon VPC .. versionadded:: 2014.7.0 :configuration: This module accepts explicit VPC credentials but can also utilize IAM roles assigned to the instance trough Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no fur...
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm as mplcm from matplotlib.colors import Normalize, LogNorm from astropy import constants as c, units as u, table as t from astropy.io import fits import os from scipy.interpolate import interp1d from scipy.optimize import minimize from statsm...
import os from cumulusci.tasks.salesforce import BaseSalesforceApiTask from cumulusci.tasks.bulkdata import LoadData from cumulusci.tasks.bulkdata.utils import generate_batches from cumulusci.utils import temporary_dir from cumulusci.core.config import TaskConfig from cumulusci.core.utils import import_global from cumu...
""" predict the estimated arrival time based on the """ # import module import pandas as pd from geopy.distance import great_circle import os from datetime import datetime, timedelta path = '../' def calculate_arrival_time(stop_dist, prev_dist, next_dist, prev_timestamp, next_timestamp): """ Calculate the...
VERSION = '1.3.4.1'
# -*- coding: utf-8 -*- # # Debian Changes Bot # Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the...
import sys import urllib import getopt import random import logging import simplejson as json import re import webbrowser import os import Tkinter from PyQt4 import QtCore import time # Just used for debugging. Double check before removing. ######################################## ## Imports part of FlatCAM ...
""" Main program code - where all the magic happens """ from datetime import datetime, timedelta from navigator import Navigator from driver import Driver from laser import Laser from gyro import Gyro from ir import IR from communicator import Communicator from eventbus import EventBus from position import Position ...
#!/usr/bin/env python # # 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 ...
# -*- coding: utf-8 -*- """UnitTests for airwaveapiclient.""" import unittest from httmock import all_requests, response, HTTMock from airwaveapiclient import AirWaveAPIClient # pylint: disable=unused-argument # pylint: disable=too-many-instance-attributes # pylint: disable=protected-access class UnitTests(unittest...
# coding=utf-8 # # Copyright © 2011-2015 Splunk, 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 ...
# -*- coding: utf-8 -*- ''' The networking module for Non-RH/Deb Linux distros ''' from __future__ import absolute_import import salt.utils from salt.ext.six.moves import zip __virtualname__ = 'ip' def __virtual__(): ''' Confine this module to Non-RH/Deb Linux distros ''' if salt.utils.is_windows(): ...
###################################################################### # # Copyright (C) 2013 # Associated Universities, Inc. Washington DC, USA, # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Fo...
from preferences import * # Names of Python resources PREFNAME_NAME="PythonPreferenceFileName" # Resource IDs in the preferences file PATH_ID = 128 DIR_ID = 128 POPT_ID = 128 GUSI_ID = 10240 # Override IDs (in the applet) OVERRIDE_PATH_ID = 129 OVERRIDE_DIR_ID = 129 OVERRIDE_POPT_ID = 129 OVERRIDE_GUSI_ID = 10241 #...
# -*- coding: utf-8 -*- # Copyright (c) 2014 by Ecreall under licence AGPL terms # avalaible on http://www.gnu.org/licenses/agpl.html # licence: AGPL # author: Amen Souissi import os from pyramid.events import ApplicationCreated, subscriber from pyramid.settings import asbool from pyramid.request import Request from ...
import sys, wx, logging import string, numpy, math from sans.guicomm.events import NewPlotEvent, StatusEvent from sans.guiframe.calcthread import CalcThread import park from park.fitresult import FitHandler DEFAULT_BEAM = 0.005 import time import thread print "main",thread.get_ident() class Console...
# -*- coding: utf-8 -*- """ ### iRODS abstraction for FS virtualization with resources ### My irods client class wrapper. Since python3 is not ready for irods official client, we based this wrapper on plumbum package handling shell commands. """ from __future__ import absolute_import import os import inspect impo...
import mysql.connector import os from ... import config # FIXME: use proper config files if os.environ.get('PAAS_MANAGER_ENV') == 'test': config['mysql']['database'] += '_test' def db_action(fn): def wrapped(*args, **kwargs): res = fn(*args, **kwargs) DatabaseConnector.connect.commit() ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re import datetime import random import urlparse import urllib from strings import * import util """ Class that represents a response from an RSVPCommand. Every call to an RSVPCommand instance's execute() method is expected to return an instance ...
# -*- coding: utf-8 -*- # noinspection PyCompatibility import sys import math import regex from difflib import SequenceMatcher from urllib.parse import urlparse, unquote_plus from itertools import chain from collections import Counter from datetime import datetime import time import os import os.path as path # noinsp...
""" picture.py Author: David Wilson Credit: <list sources used, if any> Assignment: Use the ggame library to "paint" a graphical picture of something (e.g. a house, a face or landscape). Use at least: 1. Three different Color objects. 2. Ten different Sprite objects. 3. One (or more) RectangleAsset objects. 4. One (...
import math from PIL import Image, ImageTk from .manager import Manager from .hitbox import Hitbox import inspect class SpriteClass(object): image_dictionary = { "":"codestersLogo", "person1":"Character2", "person2":"Character1", "person3":"", #CANNOT FIND THIS IMAGE IN SPRITES ...
#!/usr/bin/python import ezid_api import logging import psycopg2 from lxml import etree as e #import datacite_validator as dv import datetime import sys, os import getopt opts, _ = getopt.getopt(sys.argv[1:], "l:ntU:P:d:u:p:") LOG_DEST = None NOMINT = False TEST = False EZID_USER = None EZID_PASS = None DATABASE = No...
def dbg(ui, client, rest): ui.redraw_userlist() ui.chatbuffer_add(str(client.ui.userlist)) client.client.call('setOnline', []) def hot(ui, client, rest): ui.chatbuffer_add(', '.join(client.hot_channels_name)) client.client.call('getHotChannels', [], client.set_hot_channels_name) def join(ui, clien...
import re class FindSpam: rules = [ {'regex': "\\b(baba(ji)?|vashikaran|here is|porn)\\b", 'all': True, 'sites': [], 'reason': "Bad keyword detected"}, {'regex': "\\+\\d{10}|\\+?\\d{2}[\\s\\-]?\\d{8,11}", 'all': True, 'sites': ["patents.stackexchange.com"], 'reason': "Phone number detected"}, {'re...
# Copyright 2016 - 2021 Ternaris. # SPDX-License-Identifier: AGPL-3.0-only """Marv config parsing.""" import sys import sysconfig from configparser import ConfigParser from enum import Enum from functools import partial from logging import getLogger from pathlib import Path from typing import Any, Dict, Optional, Tu...
from django.conf.urls.defaults import * from satori.core.models import * import os PROJECT_PATH = os.path.abspath(os.path.split(__file__)[0]) # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # (r'^$', 'satori.client.web.main.loa...
# -*- coding: utf-8 -*- ''' The Saltutil module is used to manage the state of the salt minion itself. It is used to manage minion modules as well as automate updates to the salt minion. :depends: - esky Python module for update functionality ''' # Import python libs import os import hashlib import shutil import si...
from collections import namedtuple from operator import attrgetter from datetime import timedelta from django.contrib.auth.decorators import login_required from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.db import connection from django.db.models import Ma...
import jwt import base64 import os from functools import wraps from flask import Flask, request, jsonify, _request_ctx_stack from werkzeug.local import LocalProxy from dotenv import Dotenv from flask_cors import cross_origin env = None try: env = Dotenv('./.env') client_id = env["AUTH0_CLIENT_ID"] client...
import numpy as np from robo.task.base_task import BaseTask class Camelback(BaseTask): def __init__(self): X_lower = np.array([-3, -2]) X_upper = np.array([3, 2]) opt = np.array([[0.0898, -0.7126], [-0.0898, 0.7126]]) fopt = -1.03162842 super(Camel...
import os import jug.backends.redis_store import jug.backends.file_store import jug.backends.dict_store from jug.backends.redis_store import redis from nose.tools import with_setup from nose import SkipTest import six _storedir = 'jugtests' def _remove_file_store(): jug.backends.file_store.file_store.remove_store(...
import re from itertools import chain #import chain function from itertools module #an tokens dictionary with all valid tokens tokens ={ 'SUM' : 'SUM','SQUARE':'SQUARE','VALUE':'VALUE','TRUE':'TRUE','FALSE':'FALSE', 'IF':'IF','INDEXTOKEN':'INDEXTOKEN','ELSE':'ELSE','FOR':'FOR','EQUALS':'EQUALS', 'AND':'AND','OR':'OR'...
""" conway.py Author: Glen Passow Credit: Adam Glueck Assignment: Write and submit a program that plays Conway's Game of Life, per https://github.com/HHS-IntroProgramming/Conway-Life """ from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame blue = Color(0x0000ff, 1.0) black = Color(0x0000...
# -*- coding: utf-8 -*- ''' The Saltutil module is used to manage the state of the salt minion itself. It is used to manage minion modules as well as automate updates to the salt minion. :depends: - esky Python module for update functionality ''' from __future__ import absolute_import # Import python libs import os...
""" conway.py Author: Glen Passow Credit: Assignment: Write and submit a program that plays Conway's Game of Life, per https://github.com/HHS-IntroProgramming/Conway-Life """ from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame blue = Color(0x0000ff, 1.0) black = Color(0x000000, 1.0) gr...
import os import re import xml.etree.ElementTree as ET import iso8601 import rdflib import codecs import chardet import unicodedata import logging from datetime import datetime from models import * # rdflib complains a lot. logging.getLogger("rdflib").setLevel(logging.ERROR) # RDF terms. RDF = u'http://www.w3.org...
import fedmsg.tests.test_meta import arrow import os class TestMeetbotConglomerateByURL( fedmsg.tests.test_meta.ConglomerateBase): expected = [{ 'subtitle': u'alexove, echevemaster, and 4 others participated in Fedora Latam Ambassadors Meeting in #fedora-meeting-2', 'subjective': u'alexov...
#!/usr/bin/env python3 # 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 re import sys import hashlib import json import os import time from collections import defa...
# -*- coding: utf-8 -*- import regex import phonenumbers class FindSpam: bad_keywords = ["baba ?ji", "fifa.*coins?", "fifabay", "Long Path Tool", "fifaodell", "brianfo", "tosterone", "bajotz", "vashi?k[ae]r[ae]n", "kolcak" "porn", "molvi", "judi bola", "...
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.meta.base import MetaBase class Meta(MetaBase): name = 'Evil Inc.' language = 'en' url = 'http://www.evil-comic.com/' start_date = '2005-05-30' rights = 'Brad J. Guigar - Colorist: Ed Ryzowski' class Crawler(CrawlerBase): ...
import json from multiprocessing import Value import datetime import itertools import re import dash_html_components as html import dash_core_components as dcc import dash_flow_example import dash_dangerously_set_inner_html import dash import time from dash.dependencies import Input, Output from dash.exceptions impor...
from django.db import transaction from rest_framework import serializers from common.consts import ( FINANCIAL_CONTROL_SYSTEM_CHOICES, METHOD_ACC_ADOPTED_CHOICES, FUNCTIONAL_RESPONSIBILITY_CHOICES, PARTNER_TYPES, POLICY_AREA_CHOICES, ) from common.models import Point from common.countries import CO...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_ntpdatetime ---------------------------------- Tests for `ntpdatetime` module. """ import unittest from datetime import datetime from socket import gaierror from mock import patch from ntplib import NTPClient, NTPException, NTPStats from ntpdatetime import conf...
from datetime import datetime import codd from splicer import Schema from urlparse import urlparse, urljoin from urlnorm import norm as urlnorm import json from collections import Counter def size(doc): """Returns size of the payload""" kilobytes = len(doc['payload']) / 1024 yield 'size_in_kilobytes', kilobyte...
import numpy as np import matplotlib.pyplot as plt from astropy.wcs import WCS from astropy import units as u import pyspeckit import pylab import matplotlib.pyplot as plt from astropy.io import fits import sys def get_flux_values(data): flux_unit = u.erg / (u.cm**2 * u.s * u.AA) flux = data * flux_unit * 1e16...
#import forecastiopy import geocoder import json import discord import datetime from forecastiopy import * from darksky import forecast from discord.ext import commands from utils.sharding import darkskyapi api_key = darkskyapi class Weather(): def __init__(self, bot): self.bot = bot @commands.comma...
""" fizzbuzz.py Author: Hagin Credit: Morgan Assignment: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. We will use a variation...
from ..base import ClassifierMixin, RegressorMixin from ..linear_model.base import CoefSelectTransformerMixin from .base import BaseLibLinear, DenseBaseLibSVM class LinearSVC(BaseLibLinear, ClassifierMixin, CoefSelectTransformerMixin): """Linear Support Vector Classification. Similar to SVC with parameter ke...
# -*- test-case-name: vumi.transports.smpp.clientserver.tests.test_client -*- from random import randint from twisted.internet import reactor from twisted.internet.protocol import Protocol, ClientFactory from twisted.internet.task import LoopingCall from twisted.internet.defer import inlineCallbacks, returnValue, Def...
""" http://amoffat.github.io/sh/ """ # =============================================================================== # Copyright (C) 2011-2022 by Andrew Moffat # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to de...
# -*- coding: utf8 -*- import silp import os import sys def compile_include(folder): lines = [] root = os.path.abspath(folder) silp.term.info('Adding files to compile include: %s' % root) files = [os.path.join(dirpath, f) for dirpath, dirnames, files in os.walk(root) for f i...
import time import datetime from flairnames import * # PREPARE OUTPUT # ------------------------------------------------------------------------------------------ output = '' output_source = '' load_by_id = """ for (var key in flair.names) { if (flair.names.hasOwnProperty(key)) { var data = ke...
# coding=utf-8 from __future__ import absolute_import, division, print_function __author__ = "Gina Häußge <osd@foosel.net>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" fr...
#!/usr/bin/env python # import httplib2 import logging import os from apiclient import discovery from oauth2client import appengine from oauth2client import client from google.appengine.api import memcache from google.appengine.api import users from google.appengine.ext import ndb import webapp2 impor...
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import Colormap from astropy import constants as c, units as u, table as t from astropy.io import fits import os from scipy.interpolate import interp1d from scipy.optimize import minimize from statsmodels.nonparametric.kde import KDEUnivariate ...
# coding: utf-8 try: unicode() except NameError: unicode = str import sys import os import hashlib import imp import json import subprocess import traceback import webbrowser from collections import defaultdict import sublime_plugin import sublime try: import ssl assert ssl except ImportError: ss...
"""Spawn a command with pipes to its stdin, stdout, and optionally stderr. The normal os.popen(cmd, mode) call spawns a shell command and provides a file interface to just the input or output of the process depending on whether mode is 'r' or 'w'. This module provides the functions popen2(cmd) and popen3(cmd) which r...
# Copyright (c) 2010-2014 Bo Lin # Copyright (c) 2010-2014 Yanhong Annie Liu # Copyright (c) 2010-2014 Stony Brook University # Copyright (c) 2010-2014 The Research Foundation of SUNY # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files #...
from lightning.types.base import Base from lightning.types.decorators import viztype from lightning.types.utils import array_to_lines, vecs_to_points, check_colors, mat_to_links, array_to_im @viztype class Generic(Base): @staticmethod def clean(data): return {'data': data} @viztype class Scatter(Ba...
# -*- coding: utf-8 -*- # noinspection PyCompatibility import sys import math import regex from difflib import SequenceMatcher from urllib.parse import urlparse, unquote_plus from itertools import chain from collections import Counter from datetime import datetime import time import os import os.path as path # noinsp...
#!/usr/bin/python3 #-- Content-Encoding: UTF-8 -- """ PSEM2M Forker control script (could be used as an init.d script) :author: Thomas Calmant """ import logging import os import sys # ------------------------------------------------------------------------------ # Computation of the path of this file, to be able t...