src
stringlengths
721
1.04M
import json import requests import datetime import time import sys import re import plotly.plotly as py import plotly.graph_objs as graph from time import mktime from datetime import date from pprint import pprint from bug_backlog import Backlog from bug_components import Component from bug_developers import Assignee ...
""" Author: A. Alfonsi Date : 11/17/2017 """ import numpy as np import math from PluginBaseClasses.ExternalModelPluginBase import ExternalModelPluginBase class SumOfExponential(ExternalModelPluginBase): # Example External Model plugin class ################################# #### RAVEN API methods BEGIN ...
Simple Server python3 -m http.server # 8000 # --bind 127.0.0.1 python2 -m SimpleHTTPServer # 8000 Python'ā atstares ir svarīgas.' #Single line coment """ Multiline comment. Apostrofi apzīmē string, tāpat kā pēdiņas. \ zīme ļauj to labot. There\'s a snake. Ir Python'am saprotami. """ Operators: = - * / ** % // #// flo...
# Copyright 2015 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 applicable law or a...
#!/usr/local/bin/python import unittest from hw1 import BurritoFoo class TestBurrito(unittest.TestCase): def setUp(self): self.burrito = BurritoFoo('head_orders.tsv') self.orders = self.burrito.orders def test_the_world_is_sane(self): self.assertEquals(1+1, 2) def test_toppings(self): self.assertEqua...
# 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 ...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Research.is_complete' db.add_column(u'scientist_research', 'is_complete', ...
#!/usr/bin/env python # # Created by: Pearu Peterson, March 2002 # """ Test functions for linalg.matfuncs module """ from __future__ import division, print_function, absolute_import import functools import random import warnings import numpy as np import scipy.linalg import scipy.linalg._expm_frechet from numpy impo...
# -*- coding: utf-8 -*- # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 ############################################################################### # OpenLP - Open Source Lyrics Projection # # -------------------------------------------------------...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('enhance', '0001_initial'), (b'auth', b'__first__'), # This line and the next line is for fixi...
# -*- coding: utf-8 -*- from math import cos from math import pi from math import sin import timeit #import numpy import ctypes import random from sys import argv from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * global esqdir,cimabaixo global mouseX, mouseY,mouseX_ant, mouseY_ant global dis...
""" The central part of the tool: Core """ import datetime import fnmatch import glob import importlib as il import json import logging import os import shutil import socket import tempfile import time import traceback import threading import pkg_resources import sys import platform import yaml from builtins import s...
''' (c) 2014 Brendan Bulik-Sullivan and Hilary Finucane Estimators of heritability and genetic correlation. Shape convention is (n_snp, n_annot) for all classes. Last column = intercept. ''' from __future__ import division import numpy as np import pandas as pd from scipy.stats import norm, chi2 import jackknife as ...
# test_bucketlist.py import unittest import os import json from app import create_app, db class BucketlistTestCase(unittest.TestCase): """This class represents the bucketlist test case""" def setUp(self): """Define test variables and initialize app.""" self.app = create_app(config_name="testi...
import pytest import doctest from insights.parsers import aws_instance_type from insights.parsers.aws_instance_type import AWSInstanceType from insights.tests import context_wrap from insights.parsers import SkipException, ParseException from insights.core.plugins import ContentException AWS_TYPE = "r3.xlarge" AWS_TYP...
# -*- coding: utf-8 -*- """Setup the Brie application""" import logging import transaction from tg import config from brie.config.environment import load_environment __all__ = ['setup_app'] log = logging.getLogger(__name__) def setup_app(command, conf, vars): """Place any commands to setup brie here""" l...
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import division, absolute_import, print_function import sys import numpy as np from numpy.compat import sixu from numpy.testing import ( TestCase, run_module_suite, assert_, assert_equal ) class TestArrayRepr(object): def test_nan_inf(self): ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import import json import requests from django.contrib.auth.models import AbstractUser from django.core.urlresolvers import reverse from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.tra...
''' Provides scenarios for testing the estimation of the parameters (error variances and mean map parameters, which correspond to generalized calibration constants) The simulated data are drawn from SkewNormal distributions, whereas normal distributions are assumed in the estimation. The results are described in testEs...
"""@author: Bryan Silverthorn <bcs@cargo-cult.org>""" import os.path import csv import borg import borg.distributors logger = borg.get_logger(__name__, default_level = "INFO") def features_for_path(domain, task_path): # bring back relevant globals import os.path import borg logger = borg.get_logger(...
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: release-1.18 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import si...
# Copyright 2015 - StackStorm, 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 agr...
""" Tests for tools Author: Chad Fulton License: Simplified-BSD """ from __future__ import division, absolute_import, print_function import numpy as np import pandas as pd from dismalpy.ssm import tools from statsmodels.tsa.api import acovf # from .results import results_sarimax from numpy.testing import ( asser...
#!/usr/bin/python3 import sys from random import randint import numpy as np import matplotlib import matplotlib.pyplot as plt def catchBond(netPower): if 0<=netPower<=100: chance = randint(0,100) if(chance < netPower): return 1 else: return 0 else: raise ...
#!/usr/bin/env python import os,sys import PIL def recursive_dirlist(rootdir): walkedlist = [] for dirname, dirnames, filenames in os.walk(rootdir): # print path to all subdirectories first. #for subdirname in dirnames: #print os.path.join(dirname, subdirname) # print path...
""" 88b d88 88 88 888b d888 "" 88 88`8b d8'88 88 88 `8b d8' 88 88 8b,dPPYba, 88 ,d8 ,adPPYba, 88 `8b d8' 88 88 88P' `"8a 88 ,a8" a8P_____88 88 `8b d8' 88 88...
""" Django admin pages for student app """ from config_models.admin import ConfigurationModelAdmin from django import forms from django.contrib import admin from django.contrib.admin.sites import NotRegistered from django.contrib.auth import get_user_model from django.contrib.auth.admin import UserAdmin as BaseUserAdmi...
""" Django settings for demo project. Generated by 'django-admin startproject' using Django 1.11.8. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os #...
# -*- coding: utf-8 -*- # Copyright (c) 2014, imageio contributors # imageio is distributed under the terms of the (new) BSD License. """ Storage of image data in npz format. Not a great format, but at least it supports volumetric data. And its less than 100 lines. """ from __future__ import absolute_import, print_fu...
#!/usr/bin/env python # # Kenwood Morse Beacon - turns a Kenwood TS-480 into a heli beacon # # Copyright (C) 2016 by Mir Rodriguez <mir.rodriguez@greenpeace.org> # # 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...
""" create partitions on bare metal server for zfs storage expected bare metal server with two *empty* HDDs /dev/sda and /dev/sdb in LiveCD mode $ fab server_create_partitions create partitions, /boot mdraid and LVM volumes on top of mdraid: GPT: /dev/sda1, /dev/sdb1 - 2014s - bios_grub partitions /dev/sda2, /d...
""" pagnation.py: Pagination class Copyright 2014-2015, Outernet Inc. Some rights reserved. This software is free software licensed under the terms of GPLv3. See COPYING file that comes with the source code, or http://www.gnu.org/licenses/gpl.txt. """ import math class Paginator(object): min_per_page = 5 m...
import httplib import random import string import sys import mimetypes import urllib2 import httplib import time import re def random_string(length): return ''.join(random.choice(string.letters) for ii in range(length + 1)) def encode_multipart_data(data, files, binary): boundary = random_stri...
from __future__ import unicode_literals from django.core.management import call_command from model_mommy import mommy from kb.tests.test import SearchViewTestCase from kb.models import Article from kb.views import SearchView class SearchArticleTestCase(SearchViewTestCase): view_function = SearchView view_n...
# Copyright 2020 The TensorFlow Probability 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 law o...
""" Example of running a NEO node, receiving smart contract notifications and integrating a simple REST API. Smart contract events include Runtime.Notify, Runtime.Log, Storage.*, Execution.Success and several more. See the documentation here: http://neo-python.readthedocs.io/en/latest/smartcontracts.html This example...
ALLOWED_HOSTS = ['*'] ###################### # MEZZANINE SETTINGS # ###################### # The following settings are already defined with default values in # the ``defaults.py`` module within each of Mezzanine's apps, but are # common enough to be put here, commented out, for convenient # overriding. Please consult...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
""" SALTS XBMC Addon Copyright (C) 2014 tknorris This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. T...
import pandas as pd import numpy as np import matplotlib.pyplot as plt import os description = ''' This script merges series of the same product within each region. Also for plotting. Author: Ching-Chia ''' wholesale_daily = True retail_daily = False retail_weekly = False output_by_city = F...
import csv import datetime import pickle import psutil import os import sys # Locations for storage and export files DATA_STORE_FILE = 'data.pik' # Add folder path for data pickle SYSTEM_DATA_EXTRACT_FILE = 'system_log.csv' # Add folder path for system data CSV extract PROCESS_DATA_EXTRACT_FILE = 'process_log.csv' # ...
import pytest from datetime import datetime, timedelta import numpy as np import pandas as pd import matplotlib.pyplot as plt from aneris.control.factory import InterfaceFactory from dtocean_core.core import (AutoFileInput, AutoFileOutput, AutoPlot, ...
# -*- 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...
# -*- coding: utf-8 -*- #% $Id$ # # # Copyright (C) 2002-2007 # The MeqTree Foundation & # ASTRON (Netherlands Foundation for Research in Astronomy) # P.O.Box 2, 7990 AA Dwingeloo, The Netherlands # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public Lic...
# OpenRTS - Copyright (C) 2006 The OpenRTS Project # # OpenRTS 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. # # OpenRTS is d...
# Sonar import random import sys def drawBoard(board): # Draw the board data structure. hline = ' ' # initial space for the numbers down the left side of the board for i in range(1, 6): hline += (' ' * 9) + str(i) # print the numbers across the top print(hline) print(' ' + ('0123456789' * 6)) print() # p...
# -*- coding: utf-8 -*- CROSSPM_ERRORCODES = ( CROSSPM_ERRORCODE_SUCCESS, CROSSPM_ERRORCODE_UNKNOWN_ERROR, CROSSPM_ERRORCODE_WRONG_ARGS, CROSSPM_ERRORCODE_FILE_DEPS_NOT_FOUND, CROSSPM_ERRORCODE_WRONG_SYNTAX, CROSSPM_ERRORCODE_MULTIPLE_DEPS, CROSSPM_ERRORCODE_NO_FILES_TO_PACK, CROSSPM_ER...
from datetime import datetime import logging from sqlalchemy import or_ from adhocracy import model from adhocracy.model import Delegation log = logging.getLogger(__name__) # REFACT: Rename: DelegationTraverser? Maybe thats also a new object # that does the traversing in different ways # That may become a Strategy ...
#!/usr/bin/env python # MIT License # Copyright (c) 2017 Massimiliano Patacchiola # https://mpatacchiola.github.io/blog/ # # 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...
from __future__ import division, absolute_import, print_function __all__ = ['atleast_1d', 'atleast_2d', 'atleast_3d', 'block', 'hstack', 'stack', 'vstack'] import functools import operator import warnings from . import numeric as _nx from . import overrides from ._asarray import array, asanyarray from .mu...
# -*- coding: ISO-8859-15 -*- # ============================================================================= # Copyright (c) 2008 Tom Kralidis # # Authors : Tom Kralidis <tomkralidis@gmail.com> # # Contact email: tomkralidis@gmail.com # ============================================================================= fro...
# Python's standard date + time object. from datetime import datetime # HTTP status code exception for "302 Found" redirection. from webob.exc import HTTPFound # MongoDB exceptions that may be raised when manipulating data. from pymongo.errors import DuplicateKeyError # Get a reference to our Article resource class ...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
"""Config flow to configure homekit_controller.""" import json import logging import os import re import homekit from homekit.controller.ip_implementation import IpPairing import voluptuous as vol from homeassistant import config_entries from homeassistant.core import callback from .connection import get_accessory_n...
#! /usr/bin/env python # # example2_qt.py -- Simple, configurable FITS viewer. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # from __future__ import print_function im...
import kbr.run_utils as run_utils def commit(msg:str, filename:str=None) -> None: cmd = f"git commit -m'{msg}'" if filename is not None: cmd += f" {filename}" run_utils.launch_cmd(cmd) def push() -> None: cmd = f"git push" run_utils.launch_cmd(cmd) def commit_and_push(msg:str, filen...
__author__ = 'sdjoum' # Copyright 2016 DECaF Project Group # This file is part of the DECaF project and originally derives from OpenMANO # # 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 # # ...
# encoding: utf-8 from django.http.response import HttpResponseRedirect, Http404 from django.views.generic.detail import DetailView from userflow.models import UserEmail class RequestConfirmEmailView(DetailView): model = UserEmail def get_queryset(self): return super(RequestConfirmEmailView, self)....
# -*- coding: utf-8 -*- # Copyright (c) 2016-present, CloudZero, Inc. All rights reserved. # Licensed under the BSD-style license. See LICENSE file in the project root for full license information. import multiprocessing import signal import sys import time from functools import wraps ###############################...
import time from urllib import quote_plus, urlencode import api import utils import xbmc import xbmcplugin from xbmcgui import ListItem fanart = utils.addon.getAddonInfo('fanart') class Navigation: def __init__(self): self.lang = utils.addon.getLocalizedString self.api = api.Api() self.c...
from __future__ import unicode_literals from django.db import models from django.utils.translation import ugettext_lazy as _ # for Python 2 & 3 compat from django.utils.six import with_metaclass from django.utils import six from . import forms # cPickle for speed try: import cPickle as pickle except ImportError...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
# 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 u...
""" django admin pages for certificates models """ from __future__ import absolute_import from operator import itemgetter from config_models.admin import ConfigurationModelAdmin from django import forms from django.conf import settings from django.contrib import admin from lms.djangoapps.certificates.models import (...
import json import logging from contextlib import contextmanager import mock import responses from django.conf import settings from django.contrib.auth.models import User from django.db.utils import ConnectionHandler, DatabaseError from django.test import TestCase from django.test.utils import override_settings from ...
# -*- coding: utf-8 -*- import mock from nose.tools import assert_equal from .. import scrapers class TestBufferingSourceAdapter(object): def __init__(self): self.elements = None self.scraper = None self.source = None self.n = None def setup(self): self.elements = x...
#!/usr/bin/env python # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Django settings for OMERO.web project. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Copyright (c) 2008 University of Dundee. # # This progr...
"""Support for Amcrest IP cameras.""" import asyncio from datetime import timedelta from functools import partial import logging from amcrest import AmcrestError from haffmpeg.camera import CameraMjpeg import voluptuous as vol from homeassistant.components.camera import ( CAMERA_SERVICE_SCHEMA, SUPPORT_ON_OFF...
# 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 # d...
from JumpScale import j import signal import time from multiprocessing import Pool from threading import Thread from JumpScale.baselib.jobcontroller.models.JobsCollections import JobsCollection import requests def run_action(repo_path, service_key, action_name, args=None): """ run_action execute a single acti...
# -*- coding: utf-8 -*- import os from shutil import copy from random import shuffle from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User from projects.models import Project from images.models import ImageLabel class Command(BaseCommand): """ Usage ex...
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt """Config file for coverage.py""" import collections import os import re import sys from coverage.backward import configparser, iitems, string_class from coverage...
# importing libraries: import maya.cmds as cmds import dpBaseControlClass as BaseControl reload(BaseControl) # global variables to this module: CLASS_NAME = "ClipStraight" TITLE = "m109_clipStraight" DESCRIPTION = "m099_cvControlDesc" ICON = "/Icons/dp_clipStraight.png" dpClipStraightVersion = 1.1 class ClipStra...
import os import sys import urllib2 import xbmc import xbmcgui import xbmcplugin import socket import traceback from quasar.logger import log from quasar.config import QUASARD_HOST from quasar.addon import ADDON, ADDON_ID from quasar.util import notify, getLocalizedString, getLocalizedLabel, system_information try: ...
# pylint: disable=E1101 """ Contains Broker, WorkerRepresentative, and ServiceQueue classes. """ import sys import logging import zmq from zmq.eventloop.zmqstream import ZMQStream from zmq.eventloop.ioloop import IOLoop, PeriodicCallback from cps2zmq.gather import mdp, log HB_INTERVAL = 1000 HB_LIVENESS = 3 class Bro...
''' Created on Feb 22, 2014 @author: waltj ''' from numbers import Number import numpy as np import os import glob import sys import simplekml import ctypes as ct import pylib.pose as pose import pylib.filterTools as ft # Profiling code import time as systime from numpy import uint8 as u8 from numpy import uint16 as...
# -*- test-case-name: twisted.test.test_sip -*- # Copyright (c) 2001-2009 Twisted Matrix Laboratories. # See LICENSE for details. """Session Initialization Protocol. Documented in RFC 2543. [Superceded by 3261] This module contains a deprecated implementation of HTTP Digest authentication. See L{twisted.cred.cred...
# a simple parser for python. use get_number() and get_word() to read def parser(): while 1: data = list(input().split(' ')) for number in data: if len(number) > 0: yield (number) input_parser = parser() def get_word(): global input_parser return next(input_pa...
#!/usr/bin/env python """App Engine request handler for Readability API project. -------------------------------------------------------------------------------- Readability API - Clean up pages and feeds to be readable. Copyright (C) 2010 Anthony Lieuallen This program is free software: you can redistribute it and...
#!/usr/bin/env python # # Copyright 2005 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) ...
import json import uuid import datetime import os import socket class jsonprocesser: def __init__(self): self.client_mac = str(hex(uuid.getnode())) self.filestamp = datetime.datetime.now().strftime("%H-%M_%d-%m-%y") self.timestamp = str(datetime.datetime.utcnow()) pri...
import unittest import sys import os sys.path.insert( 0, os.path.abspath( os.path.join( os.path.dirname(__file__), ".."))) from emotion.axis import AxisState class TestStates(unittest.TestCase): def setUp(self): pass def test_states(self): # empty st...
""" The core application. """ import asyncio import logging import traceback from asphalt.core import Context, run_application from werkzeug.exceptions import NotFound, MethodNotAllowed, HTTPException, InternalServerError, \ BadRequestKeyError from werkzeug.routing import RequestRedirect, Map from werkzeug.wrappe...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'UserProfile' db.create_table('accounts_userprofile', ( ('id', self.gf('django.db...
# # Copyright 2008-2015 Red Hat, 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 distributed ...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import time, properties from GLOBAL import * from re import escape try: import keyring except Exception as error: class Keyring: def set_password(self, *args): pass def get_password(self, *args): return "" keyring = Keyring() properties.log.warning...
from HTMLParser import HTMLParser import MySQLdb from scrapy.linkextractors import LinkExtractor from lxml.html.clean import Cleaner from lxml.html.soupparser import fromstring from lxml.etree import tostring import re import BeautifulSoup from scrapy.spiders import Rule, CrawlSpider from database_access import * im...
#! /usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2015 Quentin De Coninck # # 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...
## begin license ## # # "Meresco Distributed" has components for group management based on "Meresco Components." # # Copyright (C) 2018, 2021 Seecr (Seek You Too B.V.) https://seecr.nl # Copyright (C) 2021 Data Archiving and Network Services https://dans.knaw.nl # Copyright (C) 2021 SURF https://www.surf.nl # Copyright...
# This file is part of PRAW. # # PRAW 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. # # PRAW is distributed in the hope that it will ...
from PyQt5.QtCore import QAbstractListModel, Qt, QModelIndex import sqlite3 class sqlistmodel(QAbstractListModel): def __init__(self, conn): super().__init__() self._conn = conn self._data = [(0, '')] self._rolesindex = { Qt.DisplayRole: 1, Qt.UserRole: 0} def printData(self): print(self._data) def...
from copy import deepcopy import numpy as np import pandas as pd from krisk.plot.make_chart import insert_series_data, round_list from krisk.util import future_warning d_annotate = {'normal': {'show': True, 'position': 'top'}} def set_full_style_condition(chart, data, c, **kwargs): if kwargs['full']: ...
import random import matplotlib.pyplot as plt from numpy.random import normal import numpy as np import math import random """ k = 1024 values = [(chi, k / chi, k % chi) for chi in xrange(1, 100)] for index in xrange(1, len(values)): prev_chi, prev_d, prev_r = values[index - 1] chi, d, r = values[index] de...
# 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 t...
import os, wx, threading, vlc, shutil, time class SubProces(threading.Thread): def __init__(self, function, lag = 0, *args, **kwargs): threading.Thread.__init__(self) self.function = function self.a = args self.k = kwargs ...
#! /usr/bin/python import sys,socket from threading import Thread PORT=50607 USAGE="\n \t usage: tcpchat.py server|client <ip address of server>" if len(sys.argv)==1: print USAGE else: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def ClientRecv(sock): while True: data = sock.recv(1024) if not dat...
from rpip.output import Output exit0 = {'exit_code': 0, 'stdout': 'yes', 'stderr': ''} exit1 = {'exit_code': 1, 'stdout': '', 'stderr': 'ERROR'} o0 = {'host1': exit0, 'host2': exit0, 'host3': exit0} o1 = {'host1': exit0, 'host2': exit1, 'host3': exit0} o2 = {'host1': exit0, 'host2': exit1, 'host3': exit1} def test_...
# Coursera Online Machine Learning Course # Exercise 7 -- Principal Component Analysis and K-Means Clustering import pandas as pd import numpy as np from scipy.optimize import minimize from ex7_utils import * import scipy.io import matplotlib.pyplot as plt # Part 1 -- Find Closest Centroids raw_mat = scipy.io.loadmat...
''' A simple Rock Paper Scissors game Algorithm: 1. Have the user input r, p, or s 2. Have the computer choose a random integer (1-3) 3. Tell the user the result of the game Todo: - Finish mode business - Detect if a user is repeatedly throwing the same thing and counter that - Sweet graphics(?) - ??? - Profit? ''' #...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from _collections import deque import unittest from hwt.simulator.simTestCase import SimTestCase from hwtLib.peripheral.i2c.intf import I2cAgent from hwtLib.peripheral.i2c.masterBitCntrl import I2cMasterBitCtrl, \ NOP, START, READ, WRITE from hwtSimApi.constants impo...