src stringlengths 721 1.04M |
|---|
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
# Copyright 2011 OpenStack Foundation
#
# 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 l... |
# Copyright 2013 Daniel Narvaez
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
'''
Created on 08/11/2013
@author: mmpe
'''
class DualKeyDict(object):
def __init__(self, unique_key_att, additional_key_att):
self._unique_key_att = unique_key_att
self._additional_key_att = additional_key_att
self._dict = {}
self._unique_keys = set()
def __getitem__(self, ke... |
"""
The command line interface requires some persistent global state to operate
effectively. It stores this state in a JSON file in a hidden directory in the
user's home folder. The following is a record of all of the keys in that JSON
file and what they mean.
config["cloud_server"] - Holds information about the cloud... |
from django import forms
from django.core.exceptions import FieldError
from .models import Skills
class SearchForm(forms.Form):
search = forms.CharField(
widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Username', 'required': ''}),
max_length=12, label=False)
def clean_s... |
'''
author Lama Hamadeh
'''
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import matplotlib
#
# TODO: Parameters to play around with
PLOT_TYPE_TEXT = False # If you'd like to see indices
PLOT_VECTORS = True # If yo... |
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... |
from check_k_best_trees import k_best_trees
from meta_graph_stat import MetaGraphStat, build_default_summary_kws_from_path
from datetime import datetime
from collections import Counter
def format_time(dt):
if dt.year < 1900:
return str(dt)
else:
return datetime.strftime(dt, '%Y-%m-%d %H:%M:%S'... |
from application.mongo import Connection
from application.twitter.interface import TwitterInterface
from application.twitter.tweets.fetcher import TweetsFetcher
from application.processmanager import ProcessManager
from application.utils.helpers import what_time_is_it
import logging
class TweetCollector(TwitterInterf... |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Author: ryanss <ryanssdev@icl... |
# -*- encoding: utf-8 -*-
from supriya.tools.ugentools.UGen import UGen
class ToggleFF(UGen):
r'''A toggle flip-flop.
::
>>> trigger = ugentools.Dust.kr(1)
>>> toggle_ff = ugentools.ToggleFF.ar(
... trigger=trigger,
... )
>>> toggle_ff
ToggleFF.ar()
... |
#!/usr/bin/env python
import cv2
import sys
import yaml
import signal
import numpy as np
#import utm
import matplotlib as mpl
import matplotlib.cm as cm
import rospy
import argparse
import actionlib
from cosmos_msgs.msg import KrigInfo
from cosmos_msgs.srv import CompareModels
import kriging_exploration.map_c... |
"""Commands: "@[botname] XXXXX"."""
from cleverwrap import CleverWrap
from bot.commands.abstract.speech import Speech, Chatbot
class CleverbotSpeech(Speech):
"""Natural language by using cleverbot."""
def __init__(self, bot):
"""Initialize variables."""
if "cleverbot_key" in bot.config and b... |
import traceback
import unittest
from pprint import pformat
from context import get_testdata, TESTS_DATA_DIR, woogenerator
from woogenerator.namespace.core import (MatchNamespace, ParserNamespace,
SettingsNamespaceProto,
UpdateNamespace)... |
import functools
import json
import os
import subprocess
import sys
import threading
import sublime
import sublime_plugin
def main_thread(callback, *args, **kwargs):
sublime.set_timeout(functools.partial(callback, *args, **kwargs), 0)
class CliThread(threading.Thread):
def __init__(self, command, command_d... |
"""
:Authors: - Wilker Aziz
"""
import random
import os
import itertools
import numpy as np
import grasp.ptypes as ptypes
import grasp.semiring as semiring
from grasp.loss.fast_bleu import DecodingBLEU
from grasp.mt.segment import SegmentMetaData
import grasp.mt.cdec_format as cdeclib
from grasp.mt.input import mak... |
from kivy.properties import ObjectProperty
from kivy.uix.boxlayout import BoxLayout
from controller.add_update_form.add_form import AddFriendForm
from controller.add_update_form.friend_form import ImageChooser
from controller.friend_info.friend_carousel import FriendInfoCarousel
from model.friend import Friend
from .a... |
#!/usr/bin/python
from assistant.python_list import create_square_list_1
from assistant.python_list import create_square_list_2
from assistant.python_list import list_comprehensions
from assistant.python_list import nested_list_comprehensions
from assistant.python_list import list_delete
from assistant.python_iterato... |
#
# 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... |
# 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 ... |
import os
import hashlib
import inspect
from lib import BaseTest
def strip_processor(output):
return "\n".join([l for l in output.split("\n") if not l.startswith(' ') and not l.startswith('Date:')])
class PublishSnapshot1Test(BaseTest):
"""
publish snapshot: defaults
"""
fixtureDB = True
fix... |
#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... |
"""Push updates to LDAP."""
import ldap as _ldap
import ldap.modlist as _modlist
import logging
from __init__ import sanitize, fileToRedmine
from unidecode import unidecode
from canned_mailer import CannedMailer
from insightly_updater import InsightlyUpdater
from fuzzywuzzy.process import extractOne
class ForgeLDAP(o... |
# -*- 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 'ExamplesConfig'
db.create_table(u'examples_examplesconfig', (
(u'datacollectorco... |
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.codec.der.encoder import encode as der_encoder
... |
"""SCons.Tool.swig
Tool-specific initialization for swig.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Fou... |
import socket
import time
import machine
led1 = machine.Pin(5, machine.Pin.OUT)
led2 = machine.Pin(4, machine.Pin.OUT)
adc = machine.ADC(0)
s = socket.socket()
host = "To Do: Enter ip-address of remote server"
port = 12344
counter = 0
while True:
try:
while True:
s = socket.socket()
... |
#!/usr/bin/env python
#
# vim: tabstop=4 shiftwidth=4
# 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; only version 2 of the License is applicable.
#
# This program is distributed in the hope th... |
# !/usr/bin/env python
# encoding: utf-8
import os
import pandas as pd
import pygal
import networkx as nx
import json
import re
import csv
from datetime import date, datetime
from collections import OrderedDict
# import folium
# from folium import plugins
# def plot_results(res, svg_filepath):
# results = pd.Dat... |
"""This module provides a function for reading dxf files and parsing them into a useful tree of objects and data.
The convert function is called by the readDXF fuction to convert dxf strings into the correct data based
on their type code. readDXF expects a (full path) file name as input.
"""
# --------------------... |
# This Python file uses the following encoding: utf-8
# Part of the Lookback project (https://github.com/lindegroup/lookback)
# Copyright 2015 The Linde Group Computer Support, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... |
from MaKaC.webinterface.rh import conferenceModif
def index( req, **params ):
return conferenceModif.RHConfModifSchedule( req ).process( params )
def graphic( req, **params ):
return conferenceModif.RHConfModifScheduleGraphic( req ).process( params )
def entries( req, **params ):
return conferenceModif.... |
"""HTTP end-points for the User API. """
import copy
from opaque_keys import InvalidKeyError
from django.conf import settings
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.core.exceptions import ImproperlyConfigured, NON_FIELD_... |
#!/usr/bin/env python
"""
Factory for Environments.
This file contains some static classes that represents environments in real
life. If Baxter for example is placed somewhere in a real environment let's
name it "Robotics Lab" then we wish to define obstacles around Baxter in this
specific environment. In... |
#
# $Id: canvas.py,v 1.2 2017/08/11 06:06:48 tyamamot Exp $
#
import re, sys, time
from Tkinter import *
from Module import *
from Hinstance import *
from settings import *
class MyCanvas:
def __init__(self, root):
self.root = root
framemid = Frame(root, relief="flat")
#framemid["re... |
#!/usr/bin/python
import urllib2
import sys
from lxml import etree
BASE_URL = 'http://www.dictionaryapi.com/api/v1/references/collegiate/xml/'
API_KEY = 'deba86d4-5a0c-4de7-88ed-a33cbbd47e7c'
reload(sys)
sys.setdefaultencoding("utf-8")
class WordDefine:
def __init__(self):
self.pr = ""
self.fl = ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Convertit les barèmes de l'IPP au format XLSX vers le format XML des paramètres d'OpenFisca.
Nécessite l'installation de :
- ssconvert :
- Debian : `apt install gnumeric`
- macOS : `brew install gnumeric`
- xlrd : `pip install xlrd`
"""
import argparse
imp... |
from django import forms
from django.contrib import messages
from django.utils import timezone
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from crispy_forms.layout import Layout, Div, HTML, Field
from crispy_forms.he... |
#!/usr/bin/env ipython
from pylab import *
import numpy as np
import console_colors as ccl
from scipy.io.netcdf import netcdf_file
import os, sys
import matplotlib.patches as patches
import matplotlib.transforms as transforms
from numpy import array
from matplotlib.gridspec import GridSpec
import matplotlib.pyplot as p... |
"""
Case-insentitive ordered dictionary (useful for headers).
Copyright (C) 2013-2020 Byron Platt
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)... |
#!/usr/bin/env python
# vim:fileencoding=utf-8
import argparse
import datetime
import os
import socket
import subprocess
import sys
import etcd
from . import DEFAULT_PREFIX
ETCD_KEY_TMPL = '{prefix}/{hostname}/{key}'
USAGE = """%(prog)s [options]
Splat some metadata into etcd!
"""
def main(sysargs=sys.argv[:]):... |
#!/usr/bin/env python
def main():
parsestring(uptime1)
sumsec(stats)
parsestring(uptime2)
sumsec(stats)
parsestring(uptime3)
sumsec(stats)
parsestring(uptime4)
sumsec(stats)
def yrs2sec(numyrs):
seconds = numyrs * 12 * 4 * 7 * 24 * 60 * 60
stats['years'] = seconds
def mth2sec(nummth):
seconds = nummth ... |
from genericFunctions import *
import pygame as pg
from pygame.locals import *
from pygame import gfxdraw
from math import *
from random import randrange
from rigidBody import *
from levels import *
import sys
PI = pi
class Spaceship(rigidBody):
def __init__(self,pos,d = [0.,0.]):
rigidBody.__init__(self,p... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Grenouille - An online service for weather data.
# Copyright (C) 2014 Cédric Bonhomme - http://cedricbonhomme.org/
#
# 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 th... |
"""
Test whether a process started by lldb has no extra file descriptors open.
"""
import lldb
from lldbsuite.test import lldbutil
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
def python_leaky_fd_version(test):
import sys
# Python random module leaks file descriptors on som... |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
__date__ = "2015-03-16"
__author__ = "Makhalova, Nazarov"
__email__ = "tpmakhalova@edu.hse.ru, innazarov@edu.hse.ru"
__status__ = "Alpha"
__version__ = "0.9"
__dscription__ = """Основной модуль работы по курсу "Структурн... |
#!/usr/bin/env python3
import re
import regex
def parse_tags(subject):
tags = regex.TAGS.findall(subject)
new_tags = []
for tag in tags:
new_tags.append(re.split(r'\s|[\'-]', tag))
tags = list(new_tags)
del new_tags
return tags
def parse_title(subject):
title = regex.TITLE.find... |
# -*- coding: utf-8 -*-
from translator.api import translate, HTTPException
import pytest
import json
def test_translate_1():
"""Tests translation where source language and target language are
identical."""
actual = translate('This is a test', '1', 'en', 'en')['translated_text']
expected = 'This is... |
from __future__ import print_function
from __future__ import print_function
import qelos as q
import json, re
from nltk.corpus import stopwords
from IPython import embed
def run(trainp="../../../../datasets/webqsp/webqsp.train.json",
testp="../../../../datasets/webqsp/webqsp.test.json",
corechains_onl... |
# Copyright (c) 2012-2013 Benjamin Bruheim <grolgh@gmail.com>
# This file is covered by the LGPLv3 or later, read COPYING for details.
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from fk.models import FileFormat
from fk.models import Orga... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.patches import *
import pdb
print("""
MatPlotLib Advanced Tutorial
----------------------------
This is a tutorial covering the features and usage of the matplotlib package
in more detail. In truth, no... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from flask import Flask
from flask import request
from flask import Response
from werkzeug.routing import BaseConverter
import requests
import io_file
import urllib
import time
#import sys
#reload(sys)
#sys.setdefaultencoding('utf8')
class MyanyConverter(BaseConverter):
we... |
#!/usr/bin/env python3
# the structure of the help files is:
# - ANY_DIR/help/LANG/help.html (files generated by deltachat-pages)
# - ANY_DIR/help/help.css (file is should be provided by deltachat-UI, not generated by deltachat-pages)
from shutil import copyfile
import sys
import os
import re
# list all files t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import tornado.web
import tornado.autoreload
import tornado
import os
import shutil
from sky.crawler import crawl
from sky.crawler.crawling import get_image_set
from sky.configs import DEFAULT_CRAWL_CONFIG
from sky.helper import extractDomain
from sky.scraper import Scr... |
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of connector, an Odoo module.
#
# Author: Stéphane Bidoul <stephane.bidoul@acsone.eu>
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# connector is free software: you ca... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack Foundation
# Copyright 2012 University Of Minho
#
# 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
#
# ... |
#
# SourceTracker.py
#
"""
packge oompa.tracking
"""
import datetime
import logging
import os
import random
import re
import shutil
import sys # for stdout
from oompa.tracking import file_utils
from oompa.tracking.Project import Project
from oompa.tracking import vcs_utils
from... |
# GUI Application automation and testing library
# Copyright (C) 2006 Mark Mc Mahon
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your opti... |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
from waflib import Task
from waflib.Configure import conf
from waflib.TaskGen import feature,before_method,after_method
import sys
LIB_CODE='''
#ifdef _MSC_VER
#define testEXP... |
# Little app to generate AS3 image embed code.
# The image will be available from an eponymous static variable, without the file type suffix.
# If it's fed a directory, it wil create embed code for every image file in the directory
import os, sys
imageExtensions = ['.jpg', '.png', '.gif']
def printEmbed(filename):
... |
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------
import numpy
import os
from collections import OrderedDict
from orangecontrib.xoppy.util import srundplug
from orangecontrib.xo... |
#!/usr/bin/env python3
#
import sys
if len(sys.argv) <= 2:
print("Usage: %s ref new" % sys.argv[0])
sys.exit(1)
reff = sys.argv[1]
newf = sys.argv[2]
class BenchRes:
def __init__(self, name, time_ms, mem_mb):
self.name = name
self.time_ms = time_ms
self.mem_mb = mem_mb
def ... |
from django.contrib.auth.models import User
from django.test import RequestFactory
from django.urls import reverse
from rest_framework.test import APIRequestFactory
from gallery.api_views import PatientListCreateView
from gallery.models import Patient
from gallery.serializers import PatientSerializer
class TestPati... |
#!/usr/bin/env python
'''
File: search.py
Author: Corey Prophitt <prophitt.corey@gmail.com>
Class: CS440, Colorado State University.
License: GPLv3, see license.txt for more details.
Description:
The iterative deepening search algorithm.
'''
#
# Stand... |
#!/usr/bin/env python
desc = """
Checks the status of the most recent MongoDB backup or, with the --snap option,
checks that the snapshots for the most recent backup were completed.
"""
import kazoo
from kazoo.client import KazooClient
from kazoo.client import KazooState
import yaml
import argparse
import time
from d... |
# -*- coding: utf-8 -*-
import fudge
local_cache = {}
def patch_identifier_index(result):
""" Patches ambry search identifier to return given result. """
from ambry.library.search import Search
# convert each dict in the result to the hit expected by searcher.
class MyDict(dict):
pass
... |
#!/usr/bin/env python
import os
import platform
import sys
import fnmatch
import re
# Preamble: to try and reduce friction set up include of the scripts. This
# means we don't have to worry about the python path
this_script_dir = os.path.dirname(__file__)
grapl_root = os.path.normpath(this_script_dir)
output_dir = o... |
#!/usr/bin/env python3
# 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
# "L... |
# Copyright 2016 OpenStack Foundation.
# 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 requ... |
"""
Creates a table with efficiency metrics (running time, peak memory
footprint) from SLURM output generated from sbatch_align.sh.
"""
from __future__ import print_function
import glob
import sys
from collections import defaultdict
nslurm, nsam = 0, 0
sam_names = defaultdict(int)
tab_wrapped = defaultdict(lambda: d... |
from django.urls import path, include
from django.conf.urls import url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from ft.views import *
urlpatterns = [
path('admin/', admin.site.urls),
path('.well-known/<uri>', well_known_uris, name='well_kno... |
# -*- coding: utf-8 -*-
from functools import partial
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from .models import Submission, Contract, UserProfile, Deadline
from django.contrib.auth.models import User
from crispy_forms.helper import FormHelper
from crispy_forms.layout import S... |
# coding=utf-8
"""
The Unsubscribes Report API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/unsubscribed/
Schema: https://api.mailchimp.com/schema/3.0/Reports/Unsubs/Instance.json
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
fro... |
from django.shortcuts import render, HttpResponseRedirect, reverse, HttpResponse
from django.contrib.auth import authenticate, login, logout
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.hashers import make_password
from django.contrib.auth.backends import ModelBackend
from users.models... |
from threading import Thread
from pkg_resources import *
from django.core.management.base import BaseCommand, CommandError
from yolk.setuptools_support import get_pkglist
from yolk.yolklib import get_highest_version, Distributions
from yolk.pypi import CheeseShop
from eggnog.models import Update
class Command(BaseC... |
from pyqrllib.pyqrllib import bin2hstr, QRLHelper
from qrl.generated import qrl_pb2
from qrl.core.misc import logger
from qrl.core.StateContainer import StateContainer
from qrl.core.PaginatedData import PaginatedData
from qrl.core.txs.multisig.MultiSigVote import MultiSigVote
from qrl.core.State import State
class V... |
import unittest
from math import degrees
from pythagoras import cosineRule, angleA
class TestPythagoras(unittest.TestCase):
def setUp(self):
pass
def test_cosineRule_2_3_4(self):
angle = cosineRule(2, 3, 4)
angle_as_string = "{0:.2f}".format(angle)
self.assertEqual(angle_as_st... |
# 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 u... |
#!/usr/bin/env python3
"""
To run: python3 nb2to3.py notebook-or-directory
"""
# Authors: Thomas Kluyver, Fernando Perez
# See: https://gist.github.com/takluyver/c8839593c615bb2f6e80
# found at https://stackoverflow.com/questions/20651502/ipython-code-migration-from-python-2-to-python-3
import argparse
impo... |
import os
from sys import maxsize
# Minimum relevance (in per cent of the total amount of documents) to accept a classifier
MIN_RELEVANCE = 0.001
# Max amount of reviews to retrieve
MAX_REVIEWS = maxsize
# Max amount of movies to analyze
MOVIES_TO_ANALYZE = 1500
# Movies to classify after the model is trained
MOVIE... |
#!/usr/bin/env python
__author__ = "Adam Simpkin, and Felix Simkovic"
__contributing_authors__ = "Jens Thomas, and Ronan Keegan"
__credits__ = "Daniel Rigden, William Shepard, Charles Ballard, Villi Uski, and Andrey Lebedev"
__date__ = "05 May 2017"
__email__ = "hlasimpk@liv.ac.uk"
__version__ = "0.1"
import argparse... |
# Copyright 2019 Virgil Dupras
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
import weakref
from datetime import date
from core.util import first
from... |
"""
Django settings for server project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... |
# #
# Copyright 2009-2014 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test settings views."""
from __future__ import absolute_import, print_function
f... |
#!/usr/bin/env python2
# Copyright (c) 2014 The BeCoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test node handling
#
from test_framework.test_framework import BeCoinTestFramework
from test_framework.uti... |
from rest_framework import generics, permissions
from rest_framework import serializers
from django.contrib.auth.models import User
from .models import Post, Photo
class UserSerializer(serializers.ModelSerializer):
posts = serializers.HyperlinkedIdentityField('posts', view_name='userpost-list', lookup_field='user... |
import logging
import math
from pajbot.managers.handler import HandlerManager
from pajbot.modules import BaseModule
from pajbot.modules import ModuleSetting
from pajbot.modules.chat_alerts import ChatAlertModule
log = logging.getLogger(__name__)
class CheerAlertModule(BaseModule):
ID = __name__.split(".")[-1]
... |
import random
import numpy
from matplotlib import pyplot
from util import logger, progressbar, file_util
def plot(predictions_list, prediction_names, classes, roc_curve_plot_file, shuffle=True, seed=42):
actives_list = []
inactives_list = []
auc_list = []
for i in range(len(predictions_list)):
... |
''' Parses crunchyroll URLs and provides a string command line argument to
download them.
Utilizing youtube-dl to split sub and video files but livestreamer functionality
can be added with minimal effort
-h, --help Output this help document
-u, --url Provide a single url
-f, --file Provide location of... |
import os
from fabric.api import env, task, local, hide, put, run, get
from fabric.contrib.project import rsync_project
import pipes
import xmlrpclib
import functools
APACHE_START_SCRIPT = r"""
#!/bin/bash
/home/frinat/bin/envdir /home/frinat/webapps/{appname}/conf \\
/home/frinat/webapps/{appname}/apache2/b... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# Frederic Mohier, frederic.mohier@alignak.net
#
"""
Alignak - Checks pack for EXAMPLE
"""
# Package name
__pkg_name__ = u"alignak_checks_EXAMPLE"
# Checks types for PyPI keywords
# Used for:
# - PyPI keywords
# - directory where to store... |
__version__ = '0.3.0'
class SchemaError(Exception):
"""Error during Schema validation."""
def __init__(self, autos, errors):
self.autos = autos if type(autos) is list else [autos]
self.errors = errors if type(errors) is list else [errors]
Exception.__init__(self, self.code)
@pro... |
# GenListOfUrls.py
import sys
sys.path.append('..')
def GenListOfUrls(Segments, PIXELS_X, PIXELS_Y, PrependPath='', minimal_length=20, custom=False):
'''
Iterates over the segment list and returns a list of urls needed for download
Outputs list of tripples in [ (<url>, <filename>, <edge id>), ... ]
'''... |
from graphysio.dialogs import askOpenFilePath
from .csv import CsvReader
from .edf import EdfReader
from .parquet import ParquetReader
file_readers = {'csv': CsvReader, 'parquet': ParquetReader, 'edf': EdfReader}
class FileReader:
def __init__(self):
super().__init__()
self.reader = None
... |
'''Generate necessary dump files'''
#options
size = 100
regenerate_graph = False
days = 1
force_layout = False
default = str(size)+'.dat'
###
import igraph, pickle, random, os
import math
from collections import OrderedDict
def process(fout):
output = os.path.join('data',fout)
try:
#load graph if... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.