code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from time import time
from os import remove
from matplotlib.image import imread
import json
import subprocess
import numpy as np
import matplotlib.pyplot as plt
def time_a_function(program, args):
start = time()
subprocess.call([program] + [args])
end = time()
return float(end - start)
def clean... | sebasvega95/HPC-assignments | CUDA/grayscale/timing.py | Python | mit | 2,425 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# This file is part of qutebrowser.
#
# qutebrowser 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 So... | t-wissmann/qutebrowser | qutebrowser/qutebrowser.py | Python | gpl-3.0 | 9,154 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# __init__.py
# ccorp_account
# First author: Carlos Vásquez <carlos.vasquez@clearcorp.co.cr> (ClearCorp S.A.)
# Copyright (c) 2010-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All rights reserved.
#... | ClearCorp-dev/odoo-clearcorp | TODO-6.1/ccorp_account/report/__init__.py | Python | agpl-3.0 | 1,991 |
# Copyright 2016 The TensorFlow Authors. 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 applica... | krikru/tensorflow-opencl | tensorflow/tools/test/run_and_gather_logs.py | Python | apache-2.0 | 3,586 |
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can redistribute it and/or mo... | Rademade/taiga-back | taiga/auth/serializers.py | Python | agpl-3.0 | 2,267 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Test QiBuild Find """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ im... | aldebaran/qibuild | python/qibuild/test/test_qibuild_find.py | Python | bsd-3-clause | 3,244 |
#!/usr/bin/env python3
import urllib.request
import json
import argparse
import time
parser = argparse.ArgumentParser()
parser.add_argument('-B', '--base-url',
default = 'https://api.github.com',
help = 'base URL for issues API')
parser.add_argument('-O', '--owner',
... | StanfordLegion/legion | tools/fetch_github_issues.py | Python | apache-2.0 | 4,029 |
import ConfigParser
import os
global_conf_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'global_conf.cfg')
## Defining the parser
conf_parser = ConfigParser.SafeConfigParser()
conf_parser.read(global_conf_file)
## main project folder
project_folder = conf_parser.get('folder_conf','project_folder')
... | frzdian/jaksafe-engine | jaksafe/jaksafe/jakservice/config_folder.py | Python | gpl-2.0 | 1,043 |
#! /usr/bin/python
# Usage:
# ./emulecollector.py COLLECTION_FILE
# a quick&dirty GUI for `ed2k -l` and `ed2k`.
import pygtk
import sys
import subprocess
#pygtk.require("2.0")
import gtk
import gobject
class Interface:
def __init__(self):
self.linklist = []
self.window = gtk.Window(... | shintakezou/miscellanea | emulecollector/emulecollector.py | Python | cc0-1.0 | 3,850 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.racing.DistributedProjectile
from panda3d.core import NodePath
from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import *
from direct.gui.DirectGui import *
from direct.fsm import FSM
from direct.distributed.Distribu... | DedMemez/ODS-August-2017 | racing/DistributedProjectile.py | Python | apache-2.0 | 1,543 |
'''
Example of how to use Multilayer Perceptrons.
'''
import sys, os, time
import gzip, pickle
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
# from matplotlib.backends.backend_pdf import PdfPages
# %cd C:/Users/g1rxf01/Downloads/New folder/simpleml/examples
# %cd M:/Libraries/Documents/... | rogerfan/simpleml | examples/multilayer_perceptron_mnist.py | Python | mpl-2.0 | 1,641 |
# -*- coding: utf-8 -*-
#
# Copyright Kevin Deldycke <kevin@deldycke.com> and contributors.
# All Rights Reserved.
#
# 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 Lic... | kdeldycke/plumage | plumage/webassets.py | Python | gpl-2.0 | 2,808 |
#!/usr/bin/python
"""
This is a tool to verify checksum hashes produced by LOCKSS against hashes
provided by a BagIt manifest document.
Invoke with -h for usage help.
Written by Stephen Eisenhauer
At University of North Texas Libraries
On 2013-04-17
Notes:
* The LOCKSS hash list will have more entries than we ac... | MetaArchive/metaarchive-qa-tools | lockss-manifest-validate/lockss-manifest-validate.py | Python | bsd-3-clause | 2,391 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.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 Free Software Foundation, eith... | jitka/weblate | weblate/test_openshift.py | Python | gpl-3.0 | 2,837 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | goddardl/gaffer | python/GafferSceneTest/SceneSwitchTest.py | Python | bsd-3-clause | 4,249 |
# 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/.
from marionette.wait import Wait
class TelephonyTestCommon(object):
returnable_calls = """
window.wrapped... | cr/fxos-certsuite | webapi_tests/telephony/telephony_test.py | Python | mpl-2.0 | 21,066 |
import random
from itertools import combinations
class Person:
mu = 0.5
sigma = 0.2
initial_amount = 100
max_money = 100
max_children = 5
def __init__(self, police=False, criminal=False, stoicity=None):
if stoicity is None:
self.stoicity = random.gauss(Person.mu, Person.si... | theSage21/corruption-simulation | source/society.py | Python | gpl-2.0 | 7,272 |
# Copyright 2015 The TensorFlow Authors. 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 applica... | HaebinShin/tensorflow | tensorflow/__init__.py | Python | apache-2.0 | 936 |
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html')),
url(r'^jquery/$', TemplateView.as_view(template_name='jquery/index.html')),
... | pevzi/django-debug-toolbar | example/urls.py | Python | bsd-3-clause | 666 |
import json
from uuid import uuid4
import pytest
import transaction
from osgeo import gdal, ogr
from nextgisweb.auth import User
from nextgisweb.models import DBSession
from nextgisweb.spatial_ref_sys import SRS
from nextgisweb.vector_layer import VectorLayer
from nextgisweb.wfsserver.model import Service as WFSServ... | nextgis/nextgisweb | nextgisweb/wfsserver/test/test_data.py | Python | gpl-3.0 | 3,485 |
#############################################################################
# read_parameter_cfg.py
# this file is part of GEOCUBIT #
# #
# Created by Emanuele Casarotti ... | casarotti/GEOCUBIT--experimental | geocubitlib/read_parameter_cfg.py | Python | gpl-3.0 | 14,030 |
# Functional test that boots a Leon3 machine and checks its serial console.
#
# Copyright (c) Philippe Mathieu-Daudé <f4bug@amsat.org>
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
from avocado_qemu import Test
from avocado_qemu import ... | dslutz/qemu | tests/acceptance/machine_sparc_leon3.py | Python | gpl-2.0 | 1,283 |
#!/usr/bin/env python3
"""
This script has two arguments. A sitemap url and a api profile.
It will download the entire profile from the NPO Front end api, and it will also download the entire sitemap.
Then, it compares the found URL's in both. They should represent the same set.
If there are URL in the API which are... | npo-poms/scripts | python/clean_from_page_api.py | Python | gpl-2.0 | 2,736 |
from .template_render import render_template
from .template_render import load_data
def load_parameters():
return load_data('parameters.json')
| Statoil/libres | python/res/fm/templating/__init__.py | Python | gpl-3.0 | 148 |
""" Thermo Scientific 'Gallery'
"""
from lims import bikaMessageFactory as _
from lims.utils import t
from lims.exportimport.instruments.resultsimport import \
AnalysisResultsImporter, InstrumentCSVResultsFileParser
class ThermoGalleryTSVParser(InstrumentCSVResultsFileParser):
def __init__(self, tsv):
... | sciCloud/OLiMS | lims/exportimport/instruments/thermoscientific/gallery/__init__.py | Python | agpl-3.0 | 4,280 |
import math
import numpy as np
from math import sin, cos, pi
def baumstamm(radius, texture, koords, height):
L=[]
for x in range(12):
x/6.*pi
verts=[np.array([sin(x/6.*pi), cos(x/6.*pi), 0]), np.array([sin((x+1)/6.*pi),
cos((x+1)/6.*pi), 0]), np.array([sin((x+1)/6.*pi), cos((x+1)/6.*pi), height]),
np.array(... | bradparks/procedural_city_generation | procedural_city_generation/building_generation/Baeume.py | Python | mpl-2.0 | 632 |
"""Computes the average Jenson-Shannon Divergence between attention heads."""
import argparse
import numpy as np
import utils
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--attn-data-file", required=True,
help="Pickle file containing extracted attention maps.")... | clarkkev/attention-analysis | head_distances.py | Python | mit | 1,460 |
#! /usr/bin/python
"""
@fileoverview Ping message sending script
@author David Parlevliet
@version 20130305
@preserve Copyright 2013 David Parlevliet.
Pinger
======
Sends ping messages to all known Elastic Firewall servers
"""
import os
import sys
import json
import socket
import re
import time
from ext.encryption imp... | dparlevliet/elastic-firewall | pinger.py | Python | mit | 2,076 |
from validate_app import validateApp
import os
from distutils import spawn
import sys
from parse_files import parseOutHTseq, bringTogether
from bashSub import bashSub
def checkPreprocessApplications():
applications = ["samtools", "htseq-count"]
source = ["http://samtools.sourceforge.net/", "http://www-huber.e... | msettles/expHTS | expHTS/htseqcountCMD.py | Python | apache-2.0 | 4,188 |
# -*- 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):
# Changing field 'TNLCompletionTrack.registration_date'
db.alter_column('tnl_completion_track', 'registrati... | EduPepperPDTesting/pepper2013-testing | lms/djangoapps/tnl_integration/migrations/0004_auto__chg_field_tnlcompletiontrack_registration_date.py | Python | agpl-3.0 | 6,772 |
# -*- coding: utf-8 -*-
import unittest
import six
from w3lib.encoding import resolve_encoding
from scrapy.http import (Request, Response, TextResponse, HtmlResponse,
XmlResponse, Headers)
from scrapy.selector import Selector
from scrapy.utils.python import to_native_str
from scrapy.exception... | Parlin-Galanodel/scrapy | tests/test_http_response.py | Python | bsd-3-clause | 26,643 |
import logging
import os
import commands
from autotest.client.shared import error
from virttest import libvirt_vm, virsh, data_dir
from virttest.libvirt_xml import xcepts, vm_xml
from virttest.libvirt_xml.devices import disk
class MFError(Exception):
pass
class MFCheckDiskError(MFError):
def __init__(self,... | PandaWei/tp-libvirt | libvirt/tests/src/multifunction.py | Python | gpl-2.0 | 10,299 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-11 20:52
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('namubufferiapp', '0006_auto_20170129_163... | oangervuori/namubufferi | namubufferiapp/migrations/0007_auto_20170211_2052.py | Python | mit | 746 |
from django.db import models
from django.conf import settings
from products.models import Variation
from django.core.urlresolvers import reverse
from django.db.models.signals import pre_save, post_save,post_delete
from decimal import Decimal
class CartItem(models.Model):
cart=models.ForeignKey("Cart")
item=models.F... | abhijitbangera/ecommerce | src/carts/models.py | Python | mit | 2,330 |
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404, redirect
import numpy
from .admin import RoundReportResource, TeamResource, CompetitionResource
from .forms import TeamForm, RoundReportForm, CompetitionForm, CompetitionSelectForm
from .models import Team, RoundReport, Competi... | Team4761/Scattergun | scattergun/scattergun_coreapp/views.py | Python | mit | 8,417 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - Frank Lin
from skrutil import string_utils
from skrutil.string_utils import indent
_JNI_BR = '\n\n'
_JNI_SPACE = ' '
class JniClass:
"""JNI part generator, responsible for generating JNI source code for Object and ObjectManager.
"""
... | DaYeSquad/worktilerwdemo | model-builder/skr_jni_builder/jni_class.py | Python | mit | 13,021 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import asyncio
import os
from azure.identity.aio import DefaultAzureCredential
from azure.keyvault.certificates import CertificateContentType, CertificatePolicy, WellKno... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-certificates/samples/import_certificate_async.py | Python | mit | 3,725 |
from lcapy import R, C, L
((R(1) + L(2)) | C(3)).s_model().draw('pickup-s.png')
| mph-/lcapy | doc/examples/networks/pickup-s.py | Python | lgpl-2.1 | 81 |
#!/usr/bin/env python -t
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Jonathan Delvaux <pyshell@djoproject.net>
# 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... | djo938/supershell | pyshell/arg/accessor/test/abstract_test.py | Python | gpl-3.0 | 790 |
# -*- coding: utf-8 -*-
from gitdh.modules import Module
class DatabaseSource(Module):
def isEnabled(self, action):
return action == 'cron' and not self.dbBe is None
def source(self):
return self.dbBe.getQueuedCommits()
| seoester/Git-Deployment-Handler | gitdh/modules/databasesource.py | Python | mit | 229 |
#!/usr/local/bin/python3
""" Demonstrates an opportunity for refactoring. """
def list_multiply(LIST_A, LIST_B):
""" Sums two lists of integers and multiplies them together
>>> list_multiply([3,4],[3,4])
49
>>> list_multiply([1,2,3,4],[10,20])
300
"""
TOTAL_A = 0
for i in LIST... | ceeblet/OST_PythonCertificationTrack | Python1/python1/refactor.py | Python | mit | 675 |
# -*- coding: utf-8 -*-
TITLE = "SUUUUPPPEEERRR Paper Plane v01"
HOME_OPTION_PLAY = "Play !"
HOME_OPTION_PLAY_LVL = "Level"
HOME_OPTION_PLAY_SHORT_LVL = "LVL"
HOME_OPTION_OPTIONS = "Options"
HOME_OPTION_OPTIONS_COLOR = "Color"
HOME_OPTION_OPTIONS_COLOR_BLUE = "Blue"
HOME_OPTION_OPTIO... | ghighi-du63000/Paper-Plane-Projekt | Source/lang/en_EN.py | Python | mit | 1,092 |
# -*- coding: latin1 -*-
################################################################################################
#
#
import snap, datetime, sys, time, json, os, os.path, shutil, time, random, math
import numpy as np
from math import*
# Script auxiliar para cálculos matemáticos que deve estar no mesmo diretóri... | amaurywalbert/twitter | net_structure/hashmap_clustering_coefficient_global_v1.py | Python | gpl-3.0 | 9,021 |
# coding=utf-8
__author__ = 'stasstels'
import cv2
import sys
image = sys.argv[1]
targets = sys.argv[2]
# Load an color image in grayscale
img = cv2.imread(image, cv2.IMREAD_COLOR)
with open(targets, "r") as f:
for line in f:
print line
(_, x, y) = line.split()
cv2.circle(img, (int(x), int(y))... | OsipovStas/ayc-2013 | ayc/show.py | Python | gpl-2.0 | 455 |
from .fangraphs_stats_base import FangraphsStatsBase
class FangraphsFieldingStats(FangraphsStatsBase):
COMMON = 'c'
LINE_BREAK = '-1'
NAME = '0'
TEAM = '1'
SEASON = '2'... | jldbc/pybaseball | pybaseball/enums/fangraphs/fielding_data_enum.py | Python | mit | 4,344 |
from os.path import exists, join
import shutil
import tempfile
import time
from lwr.managers.queued import QueueManager
from lwr.managers.stateful import StatefulManagerProxy
from lwr.tools.authorization import get_authorizer
from .test_utils import TestDependencyManager
from galaxy.util.bunch import Bunch
from galax... | jmchilton/lwr | test/persistence_test.py | Python | apache-2.0 | 1,526 |
# Copyright 2016 The TensorFlow Authors. 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 applica... | sandeepgupta2k4/tensorflow | tensorflow/python/kernel_tests/linalg_ops_test.py | Python | apache-2.0 | 8,265 |
# -*- coding: utf-8 -*-
# This file is part of periscope3.
# Copyright (c) 2013 Roman Hudec <black3r@klikni.cz>
#
# This file contains parts of code from periscope.
# Copyright (c) 2008-2011 Patrick Dessalle <patrick@dessalle.be>
#
# periscope is free software; you can redistribute it and/or modify
# ... | black3r/periscope3 | periscope/plugins/__init__.py | Python | gpl-2.0 | 1,976 |
'''Module to calculate combinations of elements
This module contains a function to calculate all subsets of a given length of
a set of n elements.
E.g. All subsets of length 2 from a set of 5 elements.
There exist 10 subsets:
>>> ncombinations(5, 2)
10
And the subsets are:
>>> list(combination... | mikekestemont/ruzicka | code/ruzicka/combinations.py | Python | mit | 4,154 |
import _plotly_utils.basevalidators
class HoverinfosrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="hoverinfosrc", parent_name="funnel", **kwargs):
super(HoverinfosrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... | plotly/python-api | packages/python/plotly/plotly/validators/funnel/_hoverinfosrc.py | Python | mit | 452 |
# This file is part of pybliographer
#
# Copyright (C) 1998-2004 Frederic GOBRY
# Email : gobry@pybliographer.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 Free Software Foundation; either version 2
# of t... | matthew-brett/pyblio | Pyblio/Output/html.py | Python | gpl-2.0 | 1,954 |
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, models
from openerp.addons.hr_attendance.hr_attendance import hr_attendance
@api.multi
def _altern_si_so(self):
return True
class HrAttendanceMonkeypatch(model... | open-synergy/opnsynid-hr | hr_attendance_monkeypatch/models/hr_attendance_monkeypatch.py | Python | agpl-3.0 | 561 |
from __future__ import absolute_import
import re
from copy import copy
import numpy as nm
from sfepy.base.base import assert_, Struct
import six
from six.moves import range
_depends = re.compile('r\.([a-zA-Z_\-0-9.]+)').findall
def get_parents(selector):
"""
Given a region selector, return names of regions ... | lokik/sfepy | sfepy/discrete/common/region.py | Python | bsd-3-clause | 23,393 |
import os
from collections import namedtuple
Request = namedtuple('Request', 'id proxy_id function args kwargs')
Response = namedtuple('Response', 'id exception return_value')
ProxyHandle = namedtuple('ProxyHandle', 'id obj_type exposed')
DispatcherState = namedtuple('DispatcherState', 'state')
def generate_id(obj=N... | ekarulf/pymp | src/pymp/messages.py | Python | mit | 435 |
"""replace"""
from runtime import *
def main():
a = 'abc'
b = a.replace('a', 'A')
assert( b == 'Abc')
a = 'aaa'
b = a.replace('a', 'A')
assert( b == 'AAA')
main() | pombredanne/Rusthon | regtests/str/replace.py | Python | bsd-3-clause | 171 |
"""Helper methods to handle the time in Home Assistant."""
import datetime as dt
import re
from typing import Any, Union, Optional, Tuple, List, cast, Dict
import pytz
import pytz.exceptions as pytzexceptions
import pytz.tzinfo as pytzinfo
from homeassistant.const import MATCH_ALL
DATE_STR_FORMAT = "%Y-%m-%d"
UTC = ... | Cinntax/home-assistant | homeassistant/util/dt.py | Python | apache-2.0 | 12,610 |
# -*- coding: utf-8 -*-
import sys
import os
import json
from flask import Flask
from capybara import Capybara
app = Flask(__name__)
@app.route("/ping", methods=['GET'])
def ping():
return "pong"
@app.route("/info/<service>/", methods=['GET'])
def info(service):
available = capy.isAvailable(service)
if ... | AkihikoITOH/capybara | capybara/api.py | Python | mit | 2,082 |
#!/usr/bin/env python
'''
Loader for all 2009 Dorado missions written for Monique's notice of bad
depths in Dorado389_2009_084_02_084_02_decim.nc.
Mike McCann
MBARI 15 January 2013
@var __date__: Date of last svn commit
@undocumented: __doc__ parser
@status: production
@license: GPL
'''
import os
import sys
import d... | duane-edgington/stoqs | stoqs/loaders/MolecularEcology/load_dorado2009.py | Python | gpl-3.0 | 4,550 |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
from neutron.api.v2 import attributes
from neutron.common import exceptions as n_exc
from neutron.extensions import loadbalancer
from neutron.openstack.common import log as logging
from neutron.openstack.common import uuidutils
from vnc_api.vnc_api im... | cloudwatt/contrail-neutron-plugin | neutron_plugin_contrail/plugins/opencontrail/loadbalancer/virtual_ip.py | Python | apache-2.0 | 9,900 |
# -*- coding: utf-8 -*-
import copy
from functools import wraps
import json
import sys
import django
from django.contrib.admin.helpers import AdminForm
from django.conf import settings
from django.conf.urls import url
from django.contrib import admin, messages
from django.contrib.admin.models import LogEntry, CHANGE
f... | DylannCordel/django-cms | cms/admin/pageadmin.py | Python | bsd-3-clause | 64,240 |
import sys
import os
def get():
config_file = os.path.abspath('./configuration')
if not os.path.exists(config_file):
sys.stderr.write('Can not find configuration file')
raise
config = {}
execfile(config_file, config)
return config
| markbreedlove/soundlocale | config.py | Python | gpl-3.0 | 269 |
# Author - Hades.y2k
# Date - 04/06/2015
# Version - 2.0
# License - <GPL v2>
import socket
import thread
from sys import platform
# Initialize
portlist = [21,22,25,80,110,443] # You can add more.
class bcolors:
RED = '\033[91m'
BOLD = '\033[1m'
OKGREEN = '\033[92m'
ENDC = '\033[0m'
WARNING =... | Hadesy2k/banner-grab | banenrgrab.py | Python | gpl-2.0 | 2,843 |
import numpy as np
from functools import reduce
from operator import mul
from .logger import logger
from .compression import CompressedObject
import pickle
class NumpyStorage(object):
"""Holds a chunk of memory large enough to store all checkpoints. The
[]-operator is overloaded to return a pointer to the me... | opesci/pyrevolve | pyrevolve/storage.py | Python | epl-1.0 | 5,677 |
import soldiers;
import towers;
class Ability(object):
def __init__(self, owner):
self.targetType = None;
self.group = "foes"; # friends/foes/traps
self.frequency = "battle"; # battle/constant/# for uses/0.# for probability
self.owner = owner;
def applyTo(self, target, friends, foes, traps=[]... | ggianna/Foragers | abilities.py | Python | apache-2.0 | 9,200 |
# pylint: disable=R0201,E0711
"""This is the __init__ module for the plugins. It contains the base class for
all plugings
"""
import logging
import importlib
_LOG = logging.getLogger(__name__)
class SoCoPlugin(object):
""" The base class for SoCo plugins """
def __init__(self, soco):
cls = self.... | xxdede/SoCo | soco/plugins/__init__.py | Python | mit | 1,031 |
from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, PasswordField
from wtforms.validators import DataRequired
class LoginForm(Form):
email = StringField('email', validators=[DataRequired()])
password = PasswordField('password', validators=[DataRequired()])
remember_me = BooleanFie... | russorat/savage-leads | settings/models/loginForm.py | Python | apache-2.0 | 353 |
import json
from zoom.common.types import UpdateType
class TimeEstimateMessage(object):
def __init__(self):
self._message_type = UpdateType.TIMING_UPDATE
self._contents = dict()
@property
def message_type(self):
return self._message_type
@property
def contents(self):
... | spottradingllc/zoom | server/zoom/www/messages/timing_estimate.py | Python | gpl-2.0 | 855 |
from os.path import join
from scipy._build_utils import numpy_nodepr_api
def configuration(parent_package='', top_path=None):
import warnings
from numpy.distutils.misc_util import Configuration
from scipy._build_utils.system_info import get_info, BlasNotFoundError
config = Configuration('odr', parent_... | aeklant/scipy | scipy/odr/setup.py | Python | bsd-3-clause | 1,348 |
import pytest
import numpy as np
from nimble.sources import IntegerSource
from nimble.composition import ConcatenateSource, VStackSource
def test_concatenate_sources():
nb_elements = 14
ints_a = IntegerSource(stop=nb_elements)
ints_b = IntegerSource(stop=nb_elements)
ints_c = IntegerSource(stop=nb_e... | risteon/nimble | tests/nimble/test_composition.py | Python | mit | 1,803 |
"""
Stub Controller for testing
"""
def run():
pass
| sprockets/sprockets.cli | sstubs/app.py | Python | bsd-3-clause | 59 |
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='oasis',
version='0.1.3',
description='Optimal Asymptotic Sequential Importance Sampling',
long_description=readme(),
keywords='F-measure active sampling evaluation classification recall pre... | ngmarchant/oasis | setup.py | Python | mit | 1,052 |
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
patch_sizes = [(95, 95), (47, 47)]
augmentation_params = {
'zoom_range': (1 / 1.6, 1.6),
'rotation_range': (0, 360),
'shear_range': (-20... | yejingxin/kaggle-ndsb | configurations/convroll4_doublescale_fs5.py | Python | mit | 6,898 |
import itertools
N = int(input())
S = input().split(' ')
K = int(input())
S = list(S)
C = list(itertools.combinations(S, K))
T = len(C)
a = list(filter(lambda x: 'a' in x, C))
print(len(a)/T)
| kakaba2009/MachineLearning | python/src/algorithm/coding/itertools/probability.py | Python | apache-2.0 | 197 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 30, transform = "RelativeDifference", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_Lag1Trend/cycle_30/ar_/test_artificial_1024_RelativeDifference_Lag1Trend_30__0.py | Python | bsd-3-clause | 274 |
# -*- test-case-name: twisted.test.test_newcred-*-
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
from zope.interface import implements, Interface
import hmac, time, random
from twisted.python.hashlib import md5
from twisted.python.randbytes import secureRandom
from twisted.cred._... | Donkyhotay/MoonPy | twisted/cred/credentials.py | Python | gpl-3.0 | 15,066 |
from amon.apps.core.views import *
from amon.apps.servers.models import server_model
from amon.apps.alerts.models import alerts_model
from amon.apps.alerts.forms import HealthCheckAlertForm, EditHealthCheckAlertForm
from amon.apps.tags.models import tags_model
from amon.apps.notifications.models import notifications_... | martinrusev/amonone | amon/apps/alerts/views/healthchecks.py | Python | mit | 2,930 |
# -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
"""\
Hooks - hook management and tools for extending Anki
==============================================================================
To find available hooks, grep for run... | jmazon/libanki | anki/hooks.py | Python | gpl-3.0 | 1,806 |
from django.contrib import admin
from .models import ItemSet, Item
admin.site.register(Item)
admin.site.register(ItemSet)
| jammons/prioritize | prioritize/admin.py | Python | bsd-3-clause | 123 |
#!/usr/bin/python
# Imports
import os
# Run pi-temp.py multiple times in the background
os.system('python pi-temp.py &')
os.system('python pi-temp.py &')
os.system('python pi-temp.py &')
os.system('python pi-temp.py &')
# write `ps -ef` to see all the scripts running
# write `kill -9 <id>` to stop a background s... | Belax8/my-pi-projects | Tests/background-test.py | Python | mit | 326 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | huntxu/fuel-web | nailgun/nailgun/test/integration/test_cluster_collection_handlers.py | Python | apache-2.0 | 7,815 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Cloudscaling Group, 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/LI... | JioCloud/oslo-incubator | openstack/common/rpc/matchmaker_redis.py | Python | apache-2.0 | 4,835 |
from pySDC import Level as levclass
from pySDC import Stats as statclass
from pySDC import Hooks as hookclass
import copy as cp
import sys
class step():
"""
Step class, referencing most of the structure needed for the time-stepping
This class bundles multiple levels and the corresponding transfer operato... | torbjoernk/pySDC | pySDC/Step.py | Python | bsd-2-clause | 9,751 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Aneesh Dogra <aneesh@activitycentral.com>
"""Fabric settings file."""
SETTINGS = {}
#
# SSH connection for Fabric
#
#: List of hosts to work on
SETTINGS['hosts'] = ['localhost']
#: Username to log in in the remote machine
SETTINGS['user'] = 'root'
#... | aristippe/pathagar | deploy/fedora/fabric.py | Python | gpl-2.0 | 2,055 |
import commands
import httplib
import json
import logging
import os
import socket
from django.conf import settings
from django.db import models
from cloud.models.virtual_interface import VirtualInterface
from cloud.models.virtual_machine import VirtualMachine
from cloud.models.virtual_router import VirtualRouter
from c... | ComputerNetworks-UFRGS/Aurora | cloud/models/virtual_link.py | Python | gpl-2.0 | 18,789 |
#!/usr/bin/env python3
import json
import requests
from utils import parse_map
def extract_points(path):
subpaths = [i.lstrip('M') for i in path.rstrip('Z').split('Z')]
contours = []
for sp in subpaths:
coords = [i.split(',') for i in sp.split('l')]
x, y = map(float, coords[0])
... | kalinochkind/worldroulette-bot | geometry.py | Python | mit | 3,155 |
# -*- coding: utf-8 -*-
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
import unittest
import gdb
import os.path
from kdump.target import Target
class TestTarget(unittest.TestCase):
def setUp(self):
gdb.execute("file")
self.do_real_tests = os.path.exists("tests/vmcore")
def tear... | jeffmahoney/crash-python | tests/test_target.py | Python | gpl-2.0 | 883 |
#!/usr/bin/env python
"""
PyVTK provides tools for manipulating VTK files in Python.
VtkData - create VTK files from Python / read VTK files to Python
"""
"""
Copyright 2001 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is... | ddempsey/PyFEHM | pyvtk/__init__.py | Python | lgpl-2.1 | 10,343 |
# This file is part of HamsiManager.
#
# Copyright (c) 2010 - 2015 Murat Demir <mopened@gmail.com>
#
# Hamsi Manager 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 yo... | supermurat/hamsi-manager | Core/SuggestIdea.py | Python | gpl-3.0 | 7,693 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'es3a10.github.io/matematicas/'
RELATIVE_URLS ... | es3a10/matematicas | fuente_web/publishconf.py | Python | mit | 537 |
from bar import path | siosio/intellij-community | python/testData/quickFixes/PyAddImportQuickFixTest/combinedElementOrdering/first/second/__init__.py | Python | apache-2.0 | 20 |
'''
Created on 2016年9月22日
@author: huangzhinan
'''
import xlrd
import urllib
wb = xlrd.open_workbook("F://test.xls")
sh=wb.sheet_by_index(0)#第一个表
for i in range(0,2):
for j in range(0,2):
print(sh.cell(i,j).value, end='\t')
print()
| egassem/python_study | src/com/xiaobei/base/read_excel.py | Python | apache-2.0 | 265 |
# Copyright (c) 2016 PaddlePaddle Authors. 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 applic... | helinwang/Paddle | python/paddle/trainer/PyDataProvider2.py | Python | apache-2.0 | 13,600 |
# 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 https://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
from distutils.spawn import find_executable
from distutils.vers... | CYBAI/servo | python/servo/bootstrap.py | Python | mpl-2.0 | 15,264 |
"""
How to create views
"""
import logging
from pkg_resources import resource_string
from jenkinsapi.jenkins import Jenkins
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
jenkins_url = "http://localhost:8080/"
jenkins = Jenkins(jenkins_url, lazy=True)
# Create ListView in main view
logger.info... | salimfadhley/jenkinsapi | examples/how_to/create_views.py | Python | mit | 2,441 |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
import socket
import struct
# CAN frame packing/unpacking (see 'struct can_frame' in <linux/can.h>)
can_frame_fmt = "=IB3x8s"
can_frame_size ... | keeyanajones/Samples | pythonProject/NetworkPythonProject/src/socket.py | Python | mit | 1,161 |
#!/usr/bin/env python3
"""
Given the name of a provider from cfme_data and using credentials from
the credentials stash, call the corresponding action on that provider, along
with any additional action arguments.
See wrapanapi for documentation on the callable methods themselves.
Example usage:
scripts/providers... | Yadnyawalkya/integration_tests | scripts/providers.py | Python | gpl-2.0 | 2,926 |
"""
Core plugin.
"""
import sys
import time
from itertools import cycle
import asks
import asyncqlio
import contextlib
import curio
import curious
import git
import matplotlib.pyplot as plt
import numpy as np
import pkg_resources
import platform
import psutil
import tabulate
import traceback
from asks.response_objects... | SunDwarf/Jokusoramame | jokusoramame/plugins/core.py | Python | gpl-3.0 | 10,883 |
'''
Created on June 09, 2014
@author: sscepano
'''
# This one serves for the starting point
import logging
import traceback
import multiprocessing
#####################################################
# imports distributor
#####################################################
from distribute import task_manager as D... | sanja7s/CI_urban_rural | CI_urban_rural/__main__.py | Python | mit | 1,723 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
# Standard library imports
from __future__ import print_function
import os
import os.path as osp
# Third party imports
from qtpy.QtCore import Signal, QEvent, QObjec... | bgris/ODL_bgris | lib/python3.5/site-packages/spyder/widgets/fileswitcher.py | Python | gpl-3.0 | 22,325 |
from flask_login import UserMixin
from sqlalchemy import DDL, event
from sqlalchemy.ext.hybrid import hybrid_property
from werkzeug.security import check_password_hash, generate_password_hash
from . import BaseModel
from ..core import db
class User(BaseModel, UserMixin):
id = db.Column(db.Integer, primary_key=Tr... | codeif/flask-demo | demo/models/user.py | Python | mit | 972 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.