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 |
|---|---|---|---|---|---|
# Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... | chrislit/abydos | tests/distance/test_distance_pearson_phi.py | Python | gpl-3.0 | 6,576 |
import os, sys
from optparse import make_option
from django.contrib.gis import gdal
from django.contrib.gis.management.base import ArgsCommand, CommandError
def layer_option(option, opt, value, parser):
"""
Callback for `make_option` for the `ogrinspect` `layer_key`
keyword option which may be an integer o... | Shrews/PyGerrit | webapp/django/contrib/gis/management/commands/ogrinspect.py | Python | apache-2.0 | 6,113 |
# -*- coding: utf-8 -*-
from openerp import models,fields, _
"""
Este modulo crea el modelo Usuario
"""
#Se crea la clase Usuario
class Usuario(models.Model):
_inherit = 'res.users'
alias = fields.Char()
equipos_ids = fields.Many2many("equipment.control",
ondelete='set nu... | andyrgtz/Proyecto-Triples | computer_equipment_control/model/usuario.py | Python | apache-2.0 | 359 |
class Solution:
def add(self, num1, num2):
num = []
carry = 0
maxLen = max(len(num1), len(num2))
num1.extend(itertools.repeat(0, maxLen - len(num1)))
num2.extend(itertools.repeat(0, maxLen - len(num2)))
for a, b in zip(num1, num2):
sum = a + ... | rahul-ramadas/leetcode | multiply-strings/Solution.9260967.py | Python | mit | 1,343 |
"""
Copyright 2013 Lyst Ltd.
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 i... | aalto-ics-kepaco/softALIGNF | svm_code/pegasos/pegasos/constants.py | Python | apache-2.0 | 1,002 |
from gaphor.abc import Service
class Session(Service):
"""Application service.
Get the active session.
"""
def __init__(self, application):
self.application = application
def shutdown(self):
pass
def get_service(self, name):
assert self.application.active_session
... | amolenaar/gaphor | gaphor/services/session.py | Python | lgpl-2.1 | 383 |
from .parser import *
| zachwalton/truebpm | simfile/__init__.py | Python | mit | 22 |
#!/usr/bin/env python
#
# Copyright (C) 2013 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 you... | tokuhirom/ycmd | ycmd/handlers.py | Python | gpl-3.0 | 7,766 |
# Copyright 2016 Joel Dunham
#
# 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... | jrwdunham/old | onlinelinguisticdatabase/model/language.py | Python | apache-2.0 | 1,192 |
import config
import redis
import json
r = redis.StrictRedis(host=config.REDIS_HOST, port=config.REDIS_PORT, db=config.REDIS_DB)
try:
expTime=config.BTCBAL_CACHE
except:
expTime=600
def rGet(key):
return r.get(key)
def rSet(key,value):
return r.set(key,value)
def rExpire(key,sec):
return r.expire(key,sec... | achamely/omniwallet | api/cacher.py | Python | agpl-3.0 | 786 |
#
# 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 us... | BryanCutler/spark | python/pyspark/ml/classification.py | Python | apache-2.0 | 126,641 |
# 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 the... | viraptor/cryptography | tests/utils.py | Python | apache-2.0 | 21,888 |
# -*- encoding: utf-8 -*-
import random
# V tej datoteki so definicije razredov Snake in Field ter nekaj pomožnih konstant in
# funkcij.
# Igralno polje sestoji iz mreze kvadratkov (blokov)
WIDTH = 50 # sirina polja (stevilo blokov)
HEIGHT = 30 # visina polja
BLOCK = 20 # velikost enega bloka v tockah na zaslonu
... | andrejbauer/snakes | snake.py | Python | mit | 5,882 |
"""
Module containing the Independent class to handle all operations pertaining
to the independent model.
"""
import os
import pandas as pd
class Independent:
"""Returns an Independent object that reads in the data, splits into sets,
trains and classifies, and writes the results."""
def __init__(self, co... | jjbrophy47/sn_spam | independent/scripts/independent.py | Python | mit | 6,452 |
def draw_box( ax,p0,p1,color='w' ):
ax.plot( [p0[0],p1[0]] , [p0[1],p0[1]], [p0[2],p0[2]],color)
ax.plot( [p1[0],p1[0]] , [p0[1],p0[1]], [p0[2],p1[2]],color)
ax.plot( [p1[0],p0[0]] , [p0[1],p0[1]], [p1[2],p1[2]],color)
ax.plot( [p0[0],p0[0]] , [p0[1],p0[1]], [p1[2],p0[2]],color)
ax.plot( [p0[... | sgh1/hash3 | example/draw_hash.py | Python | gpl-3.0 | 879 |
#!/usr/bin/env python
#
# fizzbuzz1.py - standard interview question solution from
# "Coding Horror" - See
# http://blog.codinghorror.com/why-cant-programmers-program/
#
# Copyright (C) 2018 Michael Davies <michael@the-davies.net>
#
# This program is free software; you can redistribute it and/or
# modify it under t... | mrda/junkcode | fizzbuzz1.py | Python | gpl-2.0 | 1,564 |
__author__ = 'jaisaacs'
###
# Serial interface for control of the Newport Vertical Stage
#
# Joshua A Isaacs 2016/11/3
#
#
###
import serial
import serial.tools.list_ports
import logging
logger = logging.getLogger(__name__)
class Newport():
#ser_add = '' #'COM6'# Address of serial controller for stage
#mot... | QuantumQuadrate/CsPyController | python/NewportStageController.py | Python | lgpl-3.0 | 5,025 |
#
# Copyright 2005,2006,2011 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)
# any later ... | Gabotero/GNURadioNext | gr-digital/python/psk.py | Python | gpl-3.0 | 5,480 |
from __future__ import unicode_literals
import importlib
import inspect
from django.apps import AppConfig
from django.conf import settings
from .manager import manager
class DjangoSchedulerManagerConfig(AppConfig):
name = 'django_schedulermanager'
def ready(self):
apps = settings.INSTALLED_APPS
... | marcoacierno/django-schedulermanager | django_schedulermanager/apps.py | Python | mit | 927 |
import sys
from tempfile import NamedTemporaryFile, TemporaryFile, mktemp
import os
from numpy import memmap
from numpy import arange, allclose, asarray
from numpy.testing import *
class TestMemmap(TestCase):
def setUp(self):
self.tmpfp = NamedTemporaryFile(prefix='mmap')
self.shape = (3,4)
... | mbalasso/mynumpy | numpy/core/tests/test_memmap.py | Python | bsd-3-clause | 4,069 |
from django import forms
from mc2.controllers.docker.models import DockerController
from mc2.controllers.base.forms import ControllerForm, ControllerFormHelper
class DockerControllerForm(ControllerForm):
marathon_cmd = forms.CharField(
required=False,
widget=forms.Textarea(attrs={'class': 'form-co... | praekelt/mc2 | mc2/controllers/docker/forms.py | Python | bsd-2-clause | 3,122 |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
switch_pin = 23
GPIO.setup(18, GPIO.OUT) #18 is output pin to LED
GPIO.setup(switch_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.output(18, True)
while True:
if GPIO.input(switch_pin) == False:
GPIO.output(18, False)
time.sleep(0.2)
... | cfoale/ILOCI | Receiver-OLED/pi/projects/OLEDPython/led and button.py | Python | gpl-3.0 | 328 |
# -*- coding:utf-8 -*-
"""SQLite parser plugin for Twitter on iOS 8+ database files."""
from __future__ import unicode_literals
from dfdatetime import posix_time as dfdatetime_posix_time
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.parsers ... | rgayon/plaso | plaso/parsers/sqlite_plugins/twitter_ios.py | Python | apache-2.0 | 12,624 |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
from tornado import netutil
from tornado.escape import json_decode, json_encode, utf8, _unicode, recursive_unicode, native_str
from tornado import gen
from tornado.http1connection import HTTP1Connection
from tornado.httpserver impo... | SuminAndrew/tornado | tornado/test/httpserver_test.py | Python | apache-2.0 | 42,826 |
'''
A few ways of generating random strings
'''
import hashlib
import random
import string
import uuid
import os
def generate_unique_id():
# bf47b209-b4b2-4edc-a0e8-75b9eb48bc09
return str(uuid.uuid4())
def generate_secret(length=32):
# This could be used, for example, for passwords, or for app secrets... | zugaldia/appython | appython/utils/generators.py | Python | apache-2.0 | 1,141 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0019_projectpage_piwik_id'),
]
operations = [
migrations.AddField(
model_name='projectpage',
... | City-of-Helsinki/devheldev | projects/migrations/0020_projectpage_uptimerobot_name.py | Python | agpl-3.0 | 442 |
# Copyright 2014 Cloudera 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 agreed to in writing, so... | korotkyn/ibis | ibis/expr/tests/test_table.py | Python | apache-2.0 | 45,588 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models import ModelName".
# Use orm.... | Signbank/Auslan-signbank | signbank/video/migrations/0006_copy_gloss_sn.py | Python | bsd-3-clause | 7,181 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-vision | google/cloud/vision_v1/services/image_annotator/transports/grpc.py | Python | apache-2.0 | 17,525 |
# -*- coding: utf-8 -*-
'''
Open Facebook allows you to use Facebook's open graph API with simple python code
**Features**
* Supported and maintained
* Tested so people can contribute
* Facebook exceptions are mapped
* Logging
**Basic examples**::
facebook = OpenFacebook(access_token)
# G... | javipalanca/Django-facebook | open_facebook/api.py | Python | bsd-3-clause | 32,746 |
# This file is part of Virtual Programming Lab.
#
# Virtual Programming Lab 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.
#
# Virtu... | buchuki/programming_lab | programming_lab/settings.py | Python | gpl-3.0 | 4,205 |
import pandas as pd
# Get group non-specific dfs:
transplants_raw = pd.read_csv('metadata-transplants.txt', sep='\t', index_col=False)
for group in ['DA', 'DB']:
# Get group specific dfs:
colo_df = pd.read_csv(f'colonized-{group}.txt', sep='\t', index_col=None)
no_colo_df = pd.read_csv(f'did-not-colonize... | merenlab/web | data/fmt-gut-colonization/files/make-summary-tables-for-regression.py | Python | mit | 1,622 |
# Landsat Util
# License: CC0 1.0 Universal
"""Tests for mixins"""
import sys
import unittest
from cStringIO import StringIO
from contextlib import contextmanager
from landsat.mixins import VerbosityMixin
# Capture function is taken from
# http://schinckel.net/2013/04/15/capture-and-test-sys.stdout-sys.stderr-in-u... | simonemurzilli/landsat-util | tests/test_mixins.py | Python | cc0-1.0 | 2,596 |
from inspect import signature
from collections import OrderedDict
class Match(OrderedDict):
@staticmethod
def _call(func, *args, **kwds):
if len(signature(func).parameters):return func(*args, **kwds)
else:return func()
@staticmethod
def _guard(case, *args, **kwds):
try:return ca... | thefarwind/pymatch | match.py | Python | mit | 596 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from abel.tools.polar import reproject_image_into_polar
from scipy.ndimage import map_coordinates
from scipy.ndimage.interpola... | rth/PyAbel | abel/tools/vmi.py | Python | mit | 7,503 |
import pytest
from GEMEditor.model.classes.base import EvidenceLink, BaseTreeElement
from GEMEditor.model.classes.evidence import Evidence
class TestBaseEvidenceElement:
@pytest.fixture(autouse=True)
def setup_class(self):
self.instance = EvidenceLink()
self.evidence = Evidence()
def tes... | JuBra/GEMEditor | GEMEditor/model/classes/test/test_base.py | Python | gpl-3.0 | 3,570 |
__author__ = 'Bohdan Mushkevych'
import logging
from datetime import datetime
from synergy.db.model.log_recording import LogRecording
from synergy.db.dao.log_recording_dao import LogRecordingDao
class LogRecordingHandler(logging.Handler):
def __init__(self, logger, parent_object_id):
super(LogRecordingH... | mushkevych/scheduler | synergy/system/log_recording_handler.py | Python | bsd-3-clause | 1,676 |
#!/usr/bin/python
#
# Created on Aug 25, 2016
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 16.3.8
#
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the te... | halberom/ansible | lib/ansible/modules/network/avi/avi_systemconfiguration.py | Python | gpl-3.0 | 6,164 |
# -*- coding: utf-8 -*-
from django import forms
from location.models import Address
class AddressAdminForm(forms.ModelForm):
class Meta:
model = Address
widgets = {
'description': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
}
| thoreg/raus-mit-den-kids | rmdk/location/forms.py | Python | mit | 275 |
from decimal import *
import datetime
from operator import attrgetter
from django.forms.formsets import formset_factory
from django.contrib.sites.models import Site
from models import *
from forms import *
try:
from notification import models as notification
except ImportError:
notification = None
def is_n... | bhaugen/foodnetwork | distribution/view_helpers.py | Python | mit | 25,038 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-aiplatform | google/cloud/aiplatform_v1/services/job_service/transports/grpc_asyncio.py | Python | apache-2.0 | 51,633 |
default_app_config = "posts.apps.PostsConfig"
| nijel/photoblog | posts/__init__.py | Python | agpl-3.0 | 46 |
import re
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import PyQt4.QtCore as QtCore
import ui_celltypedlg
import sys
import string
MAC = "qt_mac_set_native_menubar" in dir()
class CellTypeDlg(QDialog,ui_celltypedlg.Ui_CellTypeDlg):
#signals
# gotolineSignal = QtCore.pyqtSignal( ('int'... | maciekswat/Twedit | Plugins/CC3DMLHelper/celltypedlg.py | Python | gpl-3.0 | 4,555 |
from PySide import QtGui, QtCore
from port import Port
from wire import Wire
class Node(QtGui.QGraphicsItem):
NodeTopPadding = 40
NodeBottomPadding = 20
def __init__(self, name, deviceClass):
super(Node, self).__init__()
self.name = name
self.deviceClass = deviceClass
self... | emergent-interfaces/open-playout | src/graph/node.py | Python | gpl-3.0 | 3,765 |
def preplot(result, options):
x = np.arange(1, 36, 1)
samples = len(result['samples'])
result['samples'] = np.array(result['samples']) + 1
if samples == 1:
title = "(a) "+str(samples)+" Samples"
elif samples == 2:
title = "(b) "+str(samples)+" Samples"
elif samples == 10:
... | pbenner/adaptive-sampling | doc/hmm/example/example1-visualization.py | Python | gpl-2.0 | 1,800 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | tomkralidis/geonode | geonode/layers/management/commands/importlayers.py | Python | gpl-3.0 | 9,091 |
import logging
import httplib2
import os
"""
Application and User specific settings most of which are required
for full script functionality.
Each setting is accompanied by detailed comments outlining how to
acquire the value needed along with the format the script requires.
This document may be replaced in the nea... | siorai/AutoUploaderGoogleDrive | AutoUploaderGoogleDrive/settings.py | Python | gpl-3.0 | 12,802 |
from database_testing import DatabaseTest
from database import db
import models
class StatisticsTest(DatabaseTest):
def exposed_stats(self):
from stats import Statistics
s = Statistics()
s.calc_all()
return s.get_all()
def test_simple_models(self):
model_stats = {
... | reimandlab/Visualisation-Framework-for-Genome-Mutations | website/tests/test_statistics.py | Python | lgpl-2.1 | 4,004 |
from flask import Flask, render_template, flash
from flask_material_lite import Material_Lite
from flask_appconfig import AppConfig
from flask_wtf import Form, RecaptchaField
from flask_wtf.file import FileField
from wtforms import TextField, HiddenField, ValidationError, RadioField,\
BooleanField, SubmitField, Int... | HellerCommaA/flask-material-lite | sample_application/__init__.py | Python | mit | 2,763 |
import numpy as np
import pandas as pd
frame = pd.DataFrame(np.arange(12).reshape(4,3),
index=[['a','a','b','b'],[1,2,1,2]],
columns=[['Ohio','Ohio','Colorado'],
['Green','Red','Green']])
data = pd.Series(np.random.randn(9), index=[['a','a','a','... | eroicaleo/LearningPython | PythonForDA/ch08/hier_index.py | Python | mit | 1,173 |
#!/usr/bin/env python3
# Copyright (C) 2017 Christian Thomas Jacobs.
# This file is part of PyQSO.
# PyQSO 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
... | ctjacobs/pyqso | tests/test_compare.py | Python | gpl-3.0 | 3,153 |
# -*- coding: utf-8 -*-
#
# Moonstone is platform for processing of medical images (DICOM).
# Copyright (C) 2009-2011 by Neppo Tecnologia da Informação LTDA
# and Aevum Softwares LTDA
#
# This file is part of Moonstone.
#
# Moonstone is free software: you can redistribute it and/or modify
# it under the terms of the GN... | aevum/moonstone | src/moonstone/ilsa/plugins/reslice/reslice.py | Python | lgpl-3.0 | 2,331 |
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=
o=
s=
c=
t=
a=
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = [ "Warning: " ] # better have Warning header
exclude = []
sendto_cfg = sip.SendtoCfg("Bad SDP syntax", pjsua_args, sdp, 400,
extra_headers=extra_header... | xiejianying/pjsip_trunk | tests/pjsua/scripts-sendto/155_err_sdp_bad_syntax.py | Python | gpl-2.0 | 367 |
# shieldRechargeRateAddPassive
#
# Used by:
# Subsystems from group: Defensive Systems (16 of 16)
type = "passive"
def handler(fit, module, context):
fit.ship.increaseItemAttr("shieldRechargeRate", module.getModifiedItemAttr("shieldRechargeRate") or 0)
| Ebag333/Pyfa | eos/effects/shieldrechargerateaddpassive.py | Python | gpl-3.0 | 259 |
#!/usr/bin/python
# coding=utf-8
#v2.0
import numpy as np
from sklearn.linear_model import LogisticRegression
import logging
logger = logging.getLogger("prob_model")
def lr(X, y):
logistic_regression = LogisticRegression(penalty="l2")
logistic_regression.fit(X, y)
return logistic_regression
def convert_onehot(on... | RyogaLi/prob_model | src/prob_model.py | Python | gpl-3.0 | 5,242 |
def speedify(s):
out_chars = (len(s)+25) * [' '] # as big as we might need - strip any unused spaces later
for i in range(len(s)):
out_chars[i+(ord(s[i])-ord('A'))] = s[i]
return ''.join(out_chars).rstrip()
| SelvorWhim/competitive | Codewars/TheSpeedOfLetters.py | Python | unlicense | 227 |
from __future__ import absolute_import
from errbot import BotPlugin, botcmd, Command, botmatch
def say_foo(plugin, msg, args):
return 'foo %s' % type(plugin)
class Dyna(BotPlugin):
"""Just a test plugin to see if synamic plugin API works.
"""
@botcmd
def add_simple(self, _, _1):
simple1 ... | mrshu/err | tests/dyna_plugin/dyna.py | Python | gpl-3.0 | 1,922 |
# Copyright (c) 2015 Clinton Knight. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | openstack/manila | manila/tests/share/drivers/netapp/dataontap/protocols/test_nfs_cmode.py | Python | apache-2.0 | 9,943 |
from django import template
register = template.Library()
@register.filter(name = 'implode')
def implode(lst, sep = ' - '):
return str(sep).join("%s" % (v) for v in lst)
"""
Tag que devuelve un atributo class con el texto pasado
"""
@register.tag(name = 'css_classes')
def css_classes(parser, token):
try:
... | MERegistro/meregistro | meregistro/custom_tags_filters/templatetags/tags_filters.py | Python | bsd-3-clause | 1,119 |
import unittest
from client import Client
class ClientTestCase(unittest.TestCase):
def test_with_redis(self):
client = Client()
client.set('tomato', 2)
self.assertEqual(2, int(client.get('tomato')))
| leehosung/pycon-testing | integration_test/tests/test_client.py | Python | mit | 230 |
from test_lib.utils import get_data_by_path
class __DEFAULT__: # pylint: disable=invalid-name,too-few-public-methods
pass
class ClassBase:
"""
This class that is meant to be used as base for class that could be stored or loaded (in ES or any other backend)
"""
_es_data_mapping = {}
_data_ty... | scylladb/scylla-cluster-tests | sdcm/results_analyze/base.py | Python | agpl-3.0 | 8,871 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from calibre.gui2.convert.lrf_output_ui import Ui_Form
from calibre.gui2.convert imp... | ashang/calibre | src/calibre/gui2/convert/lrf_output.py | Python | gpl-3.0 | 1,264 |
from gettext import gettext as _
from typing import Optional, Callable, List, Set
from blueman.main.DBusProxies import AppletService
from blueman.Service import Service, Action, Instance
from blueman.bluez.Device import Device
from blueman.bluez.Network import Network
from blueman.bluez.errors import BluezDBusExcepti... | blueman-project/blueman | blueman/services/meta/NetworkService.py | Python | gpl-3.0 | 1,813 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | zgchizi/oppia-uc | core/domain/user_services_test.py | Python | apache-2.0 | 28,809 |
# inter-node communication
from collections import defaultdict
from enum import IntEnum, unique
from plenum.common.plenum_protocol_version import PlenumProtocolVersion
from plenum.common.roles import Roles
from plenum.common.transactions import PlenumTransactions
NOMINATE = "NOMINATE"
REELECTION = "REELECTION"
PRIMAR... | evernym/plenum | plenum/common/constants.py | Python | apache-2.0 | 7,426 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | anish/buildbot | master/buildbot/test/fake/fakeprotocol.py | Python | gpl-2.0 | 3,207 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['PolyTrend'] , ['Seasonal_Hour'] , ['AR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_PolyTrend_Seasonal_Hour_AR.py | Python | bsd-3-clause | 150 |
# Copyright (C) 2013-2017 Chris Lalancette <clalancette@gmail.com>
# Copyright (C) 2013 Ian McLeod <imcleod@redhat.com>
# 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;
# version 2... | imcleod/oz | oz/RHEL_7.py | Python | lgpl-2.1 | 2,885 |
import os
import matplotlib.pyplot as plt
import numpy as np
from plotting_styles import onecolumn_figure, default_figure
from paths import paper1_figures_path
'''
Make a UV plot of the 1000th HI channel.
'''
uvw = np.load("/mnt/MyRAID/M33/VLA/14B-088/HI/"
"14B-088_HI_LSRK.ms.contsub_channel_1000.uvw.... | e-koch/VLA_Lband | 14B-088/HI/analysis/uv_plots/channel_1000_uvplot.py | Python | mit | 813 |
import tensorflow as tf
from layers import conv2d, linear, nnupsampling, batchnorm, pool
from activations import lrelu
import numpy as np
from utils import drawblock, createfolders
from scipy.misc import imsave
import os
# Create folders to store images
gen_dir, gen_dir128 = createfolders("./genimgs/CIFAR64GANAEsampl... | cs-chan/ICIP2016-PC | ArtGAN/CIFAR64GANAEsample.py | Python | bsd-3-clause | 3,708 |
#!/home/kazimieras/Desktop/Hack/Backend/env/bin/python
#
# The Python Imaging Library
# $Id$
#
from __future__ import print_function
try:
from tkinter import *
except ImportError:
from Tkinter import *
from PIL import Image, ImageTk
import sys
# -------------------------------------------------------------... | Glasgow2015/team-10 | env/bin/player.py | Python | apache-2.0 | 2,209 |
# generated from catkin/cmake/template/__init__.py.in
# keep symbol table as clean as possible by deleting all unnecessary symbols
from os import path as os_path
from sys import path as sys_path
from pkgutil import extend_path
__extended_path = "/home/rss-student/rss-2014-team-3/src/robotbrain/src".split(";")
for p ... | WeirdCoder/rss-2014-team-3 | devel/lib/python2.7/dist-packages/robotbrain/__init__.py | Python | mit | 1,010 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, unittest
class TestDynamicLinks(unittest.TestCase):
def setUp(self):
frappe.db.sql('delete from `tabEmail Unsubscribe`')
def test_delete_normal(self):
event... | elba7r/builder | frappe/tests/test_dynamic_links.py | Python | mit | 2,014 |
#
# Copyright 2016 The BigDL 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 or agreed to in ... | intel-analytics/BigDL | python/chronos/src/bigdl/chronos/simulator/__init__.py | Python | apache-2.0 | 638 |
"""
WSGI config for octo_nemesis project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "octo_nemesis.settings")
from dja... | monkeywidget/massive-octo-nemesis | octo_nemesis/octo_nemesis/wsgi.py | Python | gpl-2.0 | 399 |
# Copyright (c) 2001-2018, 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... | kadhikari/navitia | source/jormungandr/jormungandr/parking_space_availability/car/__init__.py | Python | agpl-3.0 | 1,258 |
##############################################################################
#
# Copyright (C) 2021 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | eicher31/compassion-switzerland | partner_communication_switzerland/controllers/zoom_registration.py | Python | agpl-3.0 | 2,131 |
'''
t5_cli.py - this file is part of S3QL (http://s3ql.googlecode.com)
Copyright (C) 2008-2009 Nikolaus Rath <Nikolaus@rath.org>
This program can be distributed under the terms of the GNU GPLv3.
'''
from __future__ import division, print_function
import errno
import llfuse
import os.path
import s3ql.cli.ctrl
import ... | drewlu/ossql | tests/t5_cli.py | Python | gpl-3.0 | 2,085 |
from logs import sonarlog
import conf_domainsize
import conf_nodes
import placement_bestfit
import numpy as np
# Setup Sonar logging
logger = sonarlog.getLogger('placement')
class BestFitDemand(placement_bestfit.BestFit):
def sort(self, host_choice, _key):
return sorted(host_choice, key = _key)
... | jacksonicson/paper.IS2015 | control/Control/src/balancer/placement_bestfit_demand.py | Python | mit | 1,999 |
#!/usr/bin/python
# miscgapbinary.py v0.1 1/21/2012 Jeff Doak jeff.w.doak@gmail.com
import scipy as sp
from scipy.optimize import leastsq
import BinaryMixingModel as bmm
#from scipy.interpolate import UnivariateSpline
import sys
BOLTZCONST = 8.617e-2 #meV/K
class MiscGapBinary:
"""
Class that calculates a p... | jeffwdoak/free_energies | free_energies/miscgapbinary.py | Python | mit | 1,083 |
# -*- coding: utf-8 -*-
"""
This is an integration "unit" test.
"""
# from canaimagnulinux.web.theme.config import DEPENDENCIES
from canaimagnulinux.web.theme.config import PROJECTNAME
from canaimagnulinux.web.theme.testing import INTEGRATION_TESTING
from plone import api
from plone.app.testing import TEST_USER_ID
f... | CanaimaGNULinux/canaimagnulinux.web.theme | canaimagnulinux/web/theme/tests/test_setup.py | Python | gpl-3.0 | 1,684 |
# -----------------------------------------------------------------------
# OpenXenManager
#
# Copyright (C) 2009 Alberto Gonzalez Rodriguez alberto@pesadilla.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 Soft... | alanfranz/openxenmanager | openxenmanager/core/oxcSERVER_storage.py | Python | gpl-2.0 | 28,069 |
# Copyright 2015 Santiago R Soler
#
# 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.
#
# This program is distribu... | santis19/tesina-fisica | Curie/lib/objects_functions.py | Python | gpl-2.0 | 11,999 |
# -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify... | adrienpacifico/openfisca-france-data | openfisca_france_data/model/input_variables/__init__.py | Python | agpl-3.0 | 969 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-20010 Universidad Rey Juan Carlos, GSyC/LibreSoft
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | kgblll/libresoft-gymkhana | social/rest/groups.py | Python | gpl-2.0 | 5,067 |
from wptserve.utils import isomorphic_decode
def main(request, response):
id = request.GET[b'id']
encoding = request.GET[b'encoding']
mode = request.GET[b'mode']
iframe = u""
if mode == b'NETWORK':
iframe = u"<iframe src='stash.py?q=%%C3%%A5&id=%s&action=put'></iframe>" % isomorphic_decode(... | scheib/chromium | third_party/blink/web_tests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/resources/page-using-manifest.py | Python | bsd-3-clause | 614 |
import networkx as nx
import itertools
import matplotlib.pyplot as plt
fig = plt.figure()
fig.subplots_adjust(left=0.2, wspace=0.6)
G = nx.Graph()
G.add_edges_from([(1,2,{'w': 6}),
(2,3,{'w': 3}),
(3,1,{'w': 4}),
(3,4,{'w': 12}),
(4,5,{'w': 13})... | CSB-IG/natk | ninnx/pruning/mi_triangles.py | Python | gpl-3.0 | 1,793 |
# -*- coding: utf-8 -*-
#
# 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
... | stverhae/incubator-airflow | airflow/contrib/hooks/spark_submit_hook.py | Python | apache-2.0 | 9,654 |
import sys
def ask():
prompt = '>'
while True:
response = input(prompt)
if not response:
return 0
yield response
def parse_args():
yield from iter(sys.argv[1:])
def fetch(producer):
gen = producer()
next(gen)
yield from gen
def ma... | YuxuanLing/trunk | trunk/code/study/python/Fluent-Python-example-code/attic/control/adder/yield_from_input.py | Python | gpl-3.0 | 744 |
# 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... | dongjoon-hyun/tensorflow | tensorflow/python/training/learning_rate_decay.py | Python | apache-2.0 | 27,425 |
# Copyright 2013 VMware, 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 agreed to in writing, ... | gkotton/vmware-nsx | vmware-nsx/neutron/tests/unit/vmware/db/test_nsx_db.py | Python | apache-2.0 | 3,796 |
# Copyright (C) 2010 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | stewartsmith/bzr | bzrlib/tests/per_controldir_colo/test_unsupported.py | Python | gpl-2.0 | 3,407 |
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.utilities import subDict, dictCombinations
import pylab
def plotVariations(datalist, titles, genFun, varyperplot=None, prePlotFun=None, postPlotFun=None,
_differentiator=0.0, **optionlists):
""" A tool for quickly generating a lot of variat... | hassaanm/stock-trading | src/pybrain/tools/plotting/quickvariations.py | Python | apache-2.0 | 2,907 |
try:
import simplejson as json
except:
import json
import os
import re
import requests
import ConfigParser
import StringIO
from githubcollective.team import Team
from githubcollective.repo import Repo, REPO_BOOL_OPTIONS, \
REPO_RESERVED_OPTIONS
from githubcollective.hook import Hook, HOOK_BOOL_OPTIONS... | collective/github-collective | githubcollective/config.py | Python | bsd-2-clause | 12,429 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | les69/calvin-base | calvin/runtime/south/plugins/storage/twistedimpl/securedht/dht_server_commons.py | Python | apache-2.0 | 22,795 |
from miniworld import log
from miniworld.Scenario import scenario_config
from miniworld.model.network.linkqualitymodels import LinkQualityModel, LinkQualityConstants
__author__ = 'Nils Schmidt'
class LinkQualityModelRange(LinkQualityModel.LinkQualityModel):
#####################################################
... | miniworld-project/miniworld_core | miniworld/model/network/linkqualitymodels/LinkQualityModelRange.py | Python | mit | 6,220 |
# Copyright (c) 2010, Robert Escriva
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of condition... | rescrv/firmant | firmant/__init__.py | Python | bsd-3-clause | 3,563 |
#!/usr/bin/env python
''' Christmas light controller. '''
from mince import Lights, Colour, get_light_options
from mince.effects import FXRunner
from mince.effects.value import RandomTwinkleFX
import atexit
import time
import requests
URL = "http://api.thingspeak.com/channels/1417/field/1/last.txt"
def colour_all(ef... | snorecore/MincePi | scripts/cheer.py | Python | mit | 2,060 |
# -*- coding: utf-8 -*-
""" Sahana Eden Fire Station Model
@copyright: 2009-2012 (c) Sahana Software Foundation
@license: MIT
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 ... | ashwyn/eden-message_parser | modules/eden/fire.py | Python | mit | 16,662 |
#!/usr/bin/env python
# Safe Eyes is a utility to remind you to take break frequently
# to protect your eyes from eye strain.
# Copyright (C) 2017 Gobinath
# 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... | bayuah/SafeEyes | safeeyes/plugins/healthstats/plugin.py | Python | gpl-3.0 | 2,436 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.