repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 | prefix stringlengths 0 8.16k | middle stringlengths 3 512 | suffix stringlengths 0 8.17k |
|---|---|---|---|---|---|---|---|---|
migeruhito/sagenb | sagenb/notebook/notebook_object.py | Python | gpl-3.0 | 14,029 | 0.000071 | # -*- coding: utf-8 -*-
"""nodoctest
Configure and Start a Notebook Server
The :class:`NotebookObject` is used to configure and launch a Sage
Notebook server.
"""
#############################################################################
# Copyright (C) 2007 William Stein <wstein@gmail.com>
# ... | otebook is encrypted via SSL. You
must have OpenSSL installed to use this feature, or if you compile
Sage yourself, have the OpenSSL development libraries installed.
*Highly recommended!*
When ``notebook()`` is run for first time with ``secure=True``, it
will generate... | hem to ``.sage/notebook/``.
Remove this when you want to generate new keys, for example if an
older version of Sage has generated keys that are too short for
current browsers.
- ``reset`` -- boolean (default: ``False``) if True allows you
to set the admin password. Use ... |
topic2k/EventGhost | eg/PythonPaths.py | Python | gpl-2.0 | 1,915 | 0.000523 | # -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2019 EventGhost Project <http://www.eventghost.org/>
#
# EventGhost 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 versi... | sys.path.insert(1, sitePackagesDir.encode('mbcs'))
os.environ['REQUESTS_CA_BUNDLE'] = os.path.join(
si | tePackagesDir,
'requests',
'cacert.pem'
)
try:
if "PYTHONPATH" in os.environ:
for path in os.environ.get("PYTHONPATH").split(os.pathsep):
site.addsitedir(path)
key = winreg.HKEY_LOCAL_MACHINE
subkey = r"SOFTWARE\Python\PythonCore\%d.%d\InstallPath" % version
with winreg.Op... |
lsst/obs_decam | tests/config/convert2to3Config.py | Python | gpl-3.0 | 318 | 0 | # Config overrides for ` | test_convert2to3.py`
# The decam conversion tests use stripped data from `ap_verify_ci_hits2015` in
# testdata_decam, with two refcats in the repo.
config.refCats = ['gaia', 'panstarrs']
# Need to specify runs for each refcat
for refcat in config.refCats:
config.runs[refcat] | = "refcats"
|
mozilla/addons-server | src/olympia/users/migrations/0001_initial.py | Python | bsd-3-clause | 10,444 | 0.004787 | # Generated by Django 2.2.5 on 2019-09-12 13:51
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import olympia.amo.fields
import olympia.amo.models
import olympia.amo.validators
import olympia.users.mo... | timezone.now, editable=False)),
('modified', models.DateTimeField(auto_now=True)),
( | 'password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('username', models.CharField(default='', max_length=255, unique=True)),
('display_name', models.CharField(blank... |
cfpb/django-widgeter | widgeter/registry.py | Python | cc0-1.0 | 624 | 0.004808 | class WidgetRegistry():
widgets = {}
def register(self, name, widget):
"""Register a widget in the reg | istry under a given name"""
if self.widgets.has_key(name):
raise KeyError('Widget "%s" is already registered' % name)
self.widgets[name] = widget
def get(self, name):
"""Get a widget by name from the registry"""
return self.widgets[name]
def get_by_block(self, bloc... | return [self.widgets[i] for i in self.widgets if self.widgets[i].block == block_name]
registry = WidgetRegistry()
|
TeamSPoon/logicmoo_workspace | packs_sys/logicmoo_nlu/ext/ace_in_gf/tools/convert_acewiki.py | Python | mit | 6,414 | 0.020736 | #! /usr/bin/env python
# AceWiki data converter
# Author: Kaarel Kaljurand
# Version: 2012-02-23
#
# This script provides the conversion of a given AceWiki data file
# into other formats, e.g. JSON and GF.
#
# Examples:
#
# python convert_acewiki.py --in geo.acewikidata > Geo.json
# python convert_acewiki.py --in geo.... | gfabs,gfconc,sentences} (default: json)')
parser.add_argument('-v', '--version', action='version', version='%(prog)s v0.1')
args = parser.parse_args()
# TODO: there is probably a better way to do this
if args.file_in is None:
print >> sys.stderr, 'ERROR: argument -i/--in is not specified'
exit()
data = parse_acew... | args.fmt == "json":
print simplejson.dumps(data)
elif args.fmt == "gfabs":
out_gf_abs(data, args.name)
elif args.fmt == "gfconc":
out_gf_conc(data, args.name)
elif args.fmt == "sentences":
out_sentences(data)
else:
print >> sys.stderr, 'ERROR: Unsupported format: {}'.format(args.fmt)
|
MaxwellBo/Advent_Of_Code_2016 | Day_15.py | Python | bsd-3-clause | 420 | 0.011905 | for t in range(100000000):
if (11 + (t + 1)) % 13 == 0:
if (0 + (t + 2)) % 5 == 0:
if (11 + (t + 3)) % 17 == 0:
if (0 + | (t + 4)) % 3 == 0:
if (2 + (t + 5)) % 7 == 0:
if (17 + t + 6) % 19 == 0:
if (0 + t + 7) % 11 == 0:
| print(t)
break |
MarcosCommunity/odoo | comunity_modules/account_payment_extension/__openerp__.py | Python | agpl-3.0 | 3,717 | 0.001883 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com)
# All Rights Reserved.Jordi Esteve <jesteve@zikzakmedia.com>
# AvanzOSC, Avanzed Open So... | ition of payment types (cash, bank transfer, automatical ban | k transfer, ...). The payment type has a translatable name and note that can be shown in the invoices.
* Two default payment types for partners (client and supplier).
* Automatic selection of payment type in invoices. Now an invoice can have a payment term (30 days, 30/60 days, ...) and a payment type (cash, ba... |
hryamzik/ansible | lib/ansible/plugins/lookup/file.py | Python | gpl-3.0 | 2,913 | 0.004463 | # (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
lookup: file
author: Daniel H... | the contents from a file on the Ansible controller's file system.
options:
_terms:
description: path(s) of files to read
required: True
rstrip:
description: whether or not to remove whitespace from the ending of the looked-up file
type: bool
required: False
... | pace from the beginning of the looked-up file
type: bool
required: False
default: False
notes:
- if read in variable context, the file can be interpreted as YAML if the content is valid to the parser.
- this lookup does not understand 'globing', use the fileglob lookup instead.
"... |
e-koch/TurbuStat | turbustat/io/try_load_beamwidth.py | Python | mit | 2,206 | 0 | # Licensed under an MIT open source license - se | e LICENSE
from __future__ import print_function, absolute_import, division
try:
from radio_beam import Beam
RADIO_BEAM_INSTALL = True
except ImportError:
RADIO_BEAM_INSTALL = False
from | astropy.io import fits
from astropy import units as u
from warnings import warn
def find_beam_properties(hdr):
'''
Try to read beam properties from a header. Uses radio_beam when installed.
Parameters
----------
hdr : `~astropy.io.fits.Header`
FITS header.
Returns
-------
bm... |
163gal/Time-Line | libs64/wxPython/lib/rightalign.py | Python | gpl-3.0 | 332 | 0.012048 | ## This file imports items from the wx package into the wxPython package for
## backwards compatibility. Some names wil | l also have a 'wx' added on if
## | that is how they used to be named in the old wxPython package.
import wx.lib.rightalign
__doc__ = wx.lib.rightalign.__doc__
wxRightTextCtrl = wx.lib.rightalign.RightTextCtrl
|
Darthkpo/xtt | openpyxl/styles/tests/test_alignments.py | Python | mit | 671 | 0.014903 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
@pytest.fixture
def Alignment():
from .. a | lignment import Alignment
return Alignment
def test_default(Alignment):
al = Alignment()
assert dict(al) == {}
def test_round_trip(Alignment):
args = {'horizontal':'center', 'vertical':'top', 'textRotation':'45', 'indent':'4'}
al = Alignment(**args)
assert dict(al) == args
def test_alias(A... | 'wrapText':'1'}
|
cxxgtxy/tensorflow | tensorflow/python/keras/distribute/sidecar_evaluator_test.py | Python | apache-2.0 | 6,974 | 0.002151 | # Lint as: python3
# Copyright 2020 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 ... | l(sidecar_evaluator._iterations.numpy(), _BATCH_SIZE)
self.assertSummaryEventsWritten(log_dir)
if __name__ == '__main__':
| v2_compat.enable_v2_behavior()
test.main()
|
dnowatsc/Varial | varial/history.py | Python | gpl-3.0 | 3,742 | 0.000534 | import collections
import functools
import re
import wrappers
class History(object):
"""
Tracking of operations provenance.
>>> h = History("some_op")
>>> print str(h)
some_op()
>>> h.add_args(["w1", "w2"])
>>> print str(h)
some_op(
w1,
w2,
)
>>> h.add_kws({"a... | def __init__(self, operation):
self.op = str(operation)
self.args = None
self.kws = None
def __str__(self):
string = ""
if sel | f.args:
def arg_str(arg):
if (
isinstance(arg, list)
and arg
and isinstance(arg[0], History)
):
return '[\n ' + ",\n ".join(
str(a).replace('\n', '\n '... |
Zentyal/samba | python/samba/tests/docs.py | Python | gpl-3.0 | 15,528 | 0.005345 | # Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2012
#
# Tests for documentation.
#
# 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 th... | , "bin", "default", "docs-xml", "smbdotconf")
if not os.path.exists(os.path.join(path, "parameters.a | ll.xml")):
raise Exception("Unable to find parameters.all.xml")
try:
p = open(os.path.join(path, "parameters.all.xml"), 'r')
except IOError, e:
raise Exception("Error opening parameters file")
out = p.read()
root = ET.fromstring(out)
for parameter in root:
name = par... |
bunjiboys/security_monkey | security_monkey/views/item.py | Python | apache-2.0 | 11,144 | 0.001525 | # Copyright 2014 Netflix, 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... | .reqparse.add_argument('count', type=int, default=30, location='args')
self.reqparse.add_argument('page', type=int, default=1, location='args')
self.req | parse.add_argument('regions', type=str, default=None, location='args')
self.reqparse.add_argument('accounts', type=str, default=None, location='args')
self.reqparse.add_argument('active', type=str, default=None, location='args')
self.reqparse.add_argument('names', type=str, default=None, locatio... |
django-fluent/django-fluent-contents | runtests.py | Python | apache-2.0 | 4,140 | 0.002174 | #!/usr/bin/env python -Wd
import sys
import warnings
from os import path
import django
from django.conf import global_settings as default_settings
from django.conf import settings
from django.core.management import execute_from_command_line
# python -Wd, or run via coverage:
warnings.simplefilter("always", Deprecatio... | lugins.rawhtml",
"fluent_contents.plugins.sharedcontent",
"fluent_contents.plugins.text",
#'fluent_contents.plugins.twitterfeed',
#'disqus',
"django_wysiwyg",
#'form_designer',
"fluent_contents.tests.testapp",
),
MIDDLEW... | eware.SessionMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"fluent_contents.middleware.HttpRedirectRequestMiddleware",
),
SECRET_... |
KL-WLCR/incubator-airflow | airflow/default_login.py | Python | apache-2.0 | 2,371 | 0.000844 | # -*- 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
... | ide_session
def login(self, request, session=None):
user = session.query(models.User).filter(
models.User.username == DEFAULT_USERNAME).first()
if not user:
user = models.User(
username=DEFAULT_USERNAME,
is_superuser=True)
session.merge(user)
session.commit()
... | DefaultUser(user))
session.commit()
return redirect(request.args.get("next") or url_for("index"))
|
sserrot/champion_relationships | venv/Lib/site-packages/win32com/test/testxslt.py | Python | mit | 890 | 0.006742 | import os
import tempfile
import unittest
import win32com.test.util
expected_output = "The jscript test worked.\nThe Python test worked"
class XSLT(win32com.test.util.TestCase):
def testAll(self):
output_name = tempfile.mktemp("-pycom-test")
cmd = "cscript //nologo testxslt.js doesnt_matter.xml te... | print("ERROR: XSLT expected output of %r" % (expected_output,))
print("but got %r" % (got,))
finally:
f.close()
finally: |
try:
os.unlink(output_name)
except os.error:
pass
if __name__=='__main__':
unittest.main()
|
guoxiao/terminator-gtk3 | terminatorlib/plugins/terminalshot.py | Python | gpl-2.0 | 2,191 | 0.001826 | #!/usr/bin/python
# Terminator by Chris Jones <cmsj@tenshu.net> |
# GPL v2 only
"""terminalshot.py - Terminator Plugin to take 'screenshots' of individual
terminals"""
import os
from gi.repository import Gtk
import terminatorlib.plugin as plugin
from terminatorlib.translation import _
from terminatorlib.util import widget_pixbuf
# Every plugin you want Ter | minator to load *must* be listed in 'AVAILABLE'
AVAILABLE = ['TerminalShot']
class TerminalShot(plugin.MenuItem):
"""Add custom commands to the terminal menu"""
capabilities = ['terminal_menu']
dialog_action = Gtk.FileChooserAction.SAVE
dialog_buttons = (_("_Cancel"), Gtk.ResponseType.CANCEL,
... |
leppa/home-assistant | homeassistant/components/thermoworks_smoke/sensor.py | Python | apache-2.0 | 5,842 | 0.000171 | """
Support for getting the state of a Thermoworks Smoke Thermometer.
Requires Smoke Gateway Wifi with an internet connection.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.thermoworks_smoke/
"""
import logging
from requests imp | ort RequestException
from requests.exceptio | ns import HTTPError
from stringcase import camelcase, snakecase
import thermoworks_smoke
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
CONF_EMAIL,
CONF_EXCLUDE,
CONF_MONITORED_CONDITIONS,
CONF_PASSWORD,
... |
lkorigin/laniakea-spark | spark/utils/deb822.py | Python | gpl-3.0 | 2,748 | 0 | # Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org>
# Copyright (c) 2014 Jon Severinsson <jon@severinsson.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restr... | items():
if key not in self:
self[key] = []
m = hashlib.new(algo)
with open(fp, "rb") as fd:
for chunk in iter((lambda: fd.read(128 * m.block_size)), b''):
m.update(chunk)
if key != "Files":
self[key].a... | )
else:
self[key].append({
"md5sum": m.hexdigest(),
"size": size,
"section": 'spark',
"priority": 'spark',
"name": fp
})
|
MahjongRepository/tenhou-python-bot | project/game/tests/test_player.py | Python | mit | 3,093 | 0 | from game.table import Table
from mahjong.constants import EAST, NORTH, SOUTH, WEST
from utils.decisions_logger import MeldPrint
from utils.test_helpers import make_meld, string_to_136_array
def test_can_call_riichi_and_tempai():
table = Table()
player = table.player
player.in_tempai = False
player.i... | e
player.scores = 2000
player.table.count_of_remaining_tiles = 3
assert player.formal_riichi_conditions() is False
player.table.count_of_remaining_tiles = 5
assert player.formal_riichi_conditions() is True
def test_can_call_riichi_and_open_hand():
table = Table()
player = table.player
... | player.scores = 2000
player.melds = [MeldPrint()]
player.table.count_of_remaining_tiles = 40
assert player.formal_riichi_conditions() is False
player.melds = []
assert player.formal_riichi_conditions() is True
def test_players_wind():
table = Table()
player = table.player
dealer_se... |
wangzitian0/BOJ-V4 | problem/migrations/0005_auto_20160529_1520.py | Python | mit | 570 | 0.001754 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('submission', '0003_auto_20160529_1520'),
('problem', '00 | 04_auto_20160505_0036'),
]
operations = [
migrations.DeleteModel(
name='Language',
),
migrations.AlterField(
model_name='problem',
name='allowed_lang',
field=models.ManyToManyField(related_name='pro | blems', to='ojuser.Language'),
),
]
|
oinume/dmm-eikaiwa-tsc | tests/test_models.py | Python | mit | 978 | 0.007157 | import os
from tsc.models import *
def test_get_new_reservable_schedules():
old = [
Schedule(1, datetime.datetime(2015, 11, 1, 22, 00), ScheduleStatus.reservable),
Schedule( | 1, datetime.datetime(2015, 11, 1, 23, 00), ScheduleStatus.reservable),
]
new = [
Schedule(1, datetime.datetime(2015, 11, 1, 22, 00), ScheduleStatus.reserved),
Schedule(1, datetime.datetime(2015, 11, 1, 23, 00), ScheduleStatus.reservable),
Schedule(1, datetime.datetime(2015, 11, 2, 11, 00... | ule.get_new_reservable_schedules(old, new)
assert schedules == [
Schedule(1, datetime.datetime(2015, 11, 2, 11, 00), ScheduleStatus.reservable)
]
def test_github_get_latest_tag():
gh = GitHub(os.environ.get("GITHUB_API_TOKEN"))
assert gh.get_latest_version().split(".") >= "1.0.0".split(".")
|
venkat299/mpBudget | insert_grp_desg.py | Python | mit | 4,685 | 0.029669 | # script.py
import argparse
import pyexcel as pe
import configparser
import os
import sys
import sqlite3
import my_connection_grp_desg as connection
from insert import sanction_grp as insert_sanc
DB_URL = None
global conn
conn = None
sheet = None
desg_ls=None
unit_ls=None
sect_ls=None
def load_tables():
# conn.ro... | ppend(" dscd("+row['DSCD']+")")
if row['SECTION_CD'] not in sect_ls:
err.append(" sect("+row['SECTION_CD']+")")
if row['WORKING UNIT'] not in unit_ls:
err.append(" unit("+row['WORKING UNIT']+")")
if row['ONROLL_UNIT'] not in unit_ls:
err.append(" roll_unit("+row['ONROLL_UNIT']+")")
# check duplicate eis in f... | is_list
if str(row['EIS']) in eis_list:
err.append(" eis_repeat("+str(row['EIS'])+")")
else:
eis_list.append(str(row['EIS']))
# check duplicate eis in db
try:
if int(row['EIS']) in eis_ls:
err.append(" eis_dup_db("+str(row['EIS'])+")")
except ValueError as e:
err.append(" eis_err("+str(row['EIS'])+")")... |
krischer/prov | prov/tests/test_extras.py | Python | mit | 8,671 | 0.001038 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import io
import unittest
from prov.model import *
from prov.dot import prov_to_dot
from prov.serializers import Registry
from prov.tests.examples import primer_example, primer_example_alternate
EX_NS = Name... | test_document_helper_methods(self):
document = ProvDocument()
self.assertFalse(document.is_bundle())
self.assertFalse(document.has_bundles())
document.bundle(EX_NS['b'])
self.assertTrue(document.has_bundles())
self.assertEqual(u'<ProvDocument>', str(document))
def te... | (self):
"""
Tests reading and writing to and from file like objects.
"""
# Create some random document.
document = ProvDocument()
document.entity(EX2_NS["test"])
objects = [io.BytesIO, io.StringIO]
Registry.load_serializers()
formats = Registry.s... |
google/qkeras | qkeras/qpooling.py | Python | apache-2.0 | 6,418 | 0.005765 | # Copyright 2019 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 agreed to in writing,... | then multiply with the
inversion
of the division factor: sum(x) * quantize(1/pool_area)
2. first, we call keras version of averaging first:
y1 = keras_global_average(x)
then multiply it with the denominator(pool_area) used by averaging:
y2 = y1 * pool_area
Last, y3 = y2 * q... | e use option #2 here for the simplicity of implementation.
"""
x = super(QGlobalAveragePooling2D, self).call(inputs)
if self.average_quantizer:
pool_area = self.compute_pooling_area(input_shape=inputs.shape)
# Reverts the division results
x = x * pool_area
# Quantizes the multipli... |
lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/python-core-3.3.0/lib/decimal.py | Python | lgpl-3.0 | 228,485 | 0.000849 | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz <aahz at pobox.com>
# and Tim Peters
# This module should be kept in sync with ... | + inf)
NaN
>>> print(neginf * inf)
-Infinity
>>> print(dig / 0)
Infinity
>>> getcontext().traps[DivisionByZero] = 1
>>> print(dig / 0)
Traceback (most r | ecent call last):
...
...
...
decimal.DivisionByZero: x / 0
>>> c = Context()
>>> c.traps[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> c.divide(Decimal(0), Decimal(0))
Decimal('NaN')
>>> c.traps[InvalidOperation] = 1
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> ... |
jberci/resolwe | resolwe/flow/tests/test_ordering.py | Python | apache-2.0 | 1,377 | 0.002905 | # pylint: disable=missing-docstring
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse
from guardian.shortcuts import assign_perm
from rest_framework.test import APITestCase
from resolwe.flow.models import Process
class Pr... | (self):
# pylint: d | isable=no-member
response = self.client.get(self.url, {'ordering': 'version'}, format='json')
self.assertEqual(response.data[0]['id'], self.proc_1.id)
self.assertEqual(response.data[1]['id'], self.proc_2.id)
response = self.client.get(self.url, {'ordering': '-version'}, format='json')
... |
rickerc/neutron_audit | neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py | Python | apache-2.0 | 31,636 | 0.000032 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 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/LIC... | updated_ports=None):
with mock.patch.object(self.agent.int_br, 'get_vif_port_set',
return_value=vif_port_set):
return self.agent.scan_ports(re | gistered_ports, updated_ports)
def test_scan_ports_returns_current_only_for_unchanged_ports(self):
vif_port_set = set([1, 3])
registered_ports = set([1, 3])
expected = {'current': vif_port_set}
actual = self.mock_scan_ports(vif_port_set, registered_ports)
self.assertEqual(ex... |
lionheart/TimeTracker-Linux | libs/O.py | Python | mit | 900 | 0.005556 | class objectify(object):
'''this class is for superclassing only,
to save repetetive typing during development
'''
def __init__(self, *args, **kwargs):
super(objectify, self).__init__()
class object_caller(object):
'''
This class allows one to create objects without having to ... | self.kw.update | (**kw)
return obj(**self.kw)
else:
return None
|
quattor/aquilon | lib/aquilon/worker/commands/show_organization_all.py | Python | apache-2.0 | 1,272 | 0 | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the logic for `aq show organization --... | ."""
from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611
from aquilon.worker.commands.show_location_type import CommandShowLocationType
class CommandShowOrganizationAll(CommandShowLocationType):
required_parameters = []
def render(self, session, **arguments):
return CommandShow... |
eerimoq/asn1tools | tests/test_parse.py | Python | mit | 19,718 | 0.000203 | import sys
import unittest
import importlib
import asn1tools
sys.path.append('tests/files')
sys.path.append('tests/files/3gpp')
sys.path.append('tests/files/cen')
sys.path.append('tests/files/etsi')
sys.path.append('tests/files/ieee')
sys.path.append('tests/files/ietf')
sys.path.append('tests/files/oma')
class Asn1... | self.parse_and_verify('x691_a1')
def test_parse_x691_a2(self):
self.parse_and_verify('x691_a2')
def test_parse_x691_a3(self):
self.parse_and_verify('x691_a3')
def test_parse_x691_a4(self):
self.parse_and_verify('x691_a4')
def test_parse_zforce(self):
self.parse_and_ve... | ', '3gpp')
def test_parse_s1ap_14_4_0(self):
self.parse_and_verify('s1ap_14_4_0', '3gpp')
def test_parse_lpp_14_3_0(self):
self.parse_and_verify('lpp_14_3_0', '3gpp')
def test_parse_rfc1155(self):
self.parse_and_verify('rfc1155', 'ietf')
def test_parse_rfc1157(self):
... |
vlajos/FactorioManager | FactorioManager/ModFile.py | Python | mit | 668 | 0.004491 | __author__ = 'Fabian'
import zipfile
class ModFile():
def __ini | t__(self, path):
self.path = path
def check(self):
try:
zip = zipfile | .ZipFile(self.path)
zip.testzip()
files = zip.namelist()
info = False
for file in files:
if "info.json" in file:
info = True
if not info:
raise FileNotFoundError("Cannot find info.json in modfile.")
e... |
archivsozialebewegungen/AlexandriaGui | tests/integration/components/references/basereferenceintegrationtest.py | Python | gpl-3.0 | 1,748 | 0.002288 | '''
Created on 01.12.2016
@author: michael
'''
from alex_test_utils import MODE_SIMPLE
from alexandriabase import baseinjectorkeys
from alexandriabase.domain import Event, AlexDateRange, AlexDate, Document, \
DocumentType
from alexpresenters.MessageBroker import REQ_SAVE_CURRENT_EVENT, \
REQ_SAVE_CURRENT_DOCUM... | self.message_broker.send_message(message)
| def set_current_event(self, event_id):
if event_id is not None:
event = self.event_dao.get_by_id(event_id)
else:
event = Event()
event.daterange = AlexDateRange(AlexDate(1936), None)
message = Message(CONF_EVENT_CHANGED, event=event)
self.... |
akozumpl/yum | yumcommands.py | Python | gpl-2.0 | 110,814 | 0.001742 | #!/usr/bin/python -t
# 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 the hope that it... | return
msg = _('There | are no enabled repos.\n'
' Run "yum repolist all" to see the repos you have.\n'
' You can enable repos with yum-config-manager --enable <repo>')
base.logger.critical(msg)
raise cli.CliError
class YumCommand:
"""An abstract base class that defines the methods needed by the cli
to... |
toontownfunserver/Panda3D-1.9.0 | direct/p3d/AppRunner.py | Python | bsd-3-clause | 49,438 | 0.002549 |
"""
This module is intended to be compiled into the Panda3D runtime
distributable, to execute a packaged p3d application, but it can also
be run directly via the Python interpreter (if the current Panda3D and
Python versions match the version expected by the application). See
runp3d.py for a command-line tool to inv... | o objects for the various download
# hosts we have imported packages from.
self.hosts = {}
# The altHost string that is in effect from the HTML tokens,
# if any, and the dictionary of URL remapping: o | rig host url
# -> alt host url.
self.altHost = None
self.altHostMap = {}
# The URL from which Panda itself should be downloaded.
self.pandaHostUrl = PandaSystem.getPackageHostUrl()
# Application code can assign a callable object here; if so,
# it will be invoked... |
akretion/stock-logistics-workflow | stock_lot_scrap/tests/__init__.py | Python | agpl-3.0 | 178 | 0 | # -*- coding: utf-8 -*-
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# | License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_stock | _lot_scrap
|
stdweird/aquilon | lib/python2.6/aquilon/worker/commands/show_hostlink_hostlink.py | Python | apache-2.0 | 951 | 0 | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# 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 License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY K... | the License for the specific language governing permissions and
# limitations under the License.
from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611
from aquilon.worker.commands.show_hostlink import CommandShowHostlink
class CommandShowHostlinkHostlink(CommandShowHostlink):
required_parame... |
gabobert/climin | climin/util.py | Python | bsd-3-clause | 11,486 | 0.000784 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import inspect
import itertools
import random
import warnings
import numpy as np
from .gd import GradientDescent
from .bfgs import Lbfgs
from .cg import NonlinearConjugateGradient
from .rprop import Rprop
from .rmsprop import RmsProp
from .adadelta impo... | ill have a size of ``(2,)`` and point
to the first two entries, i.e. ``flat`[:2]`, while the second array will
have a shape of ``(3, 2)`` and point to the elements ``flat[2:8]``.
Parameters
----------
spec : list of tuples of ints
Specification of the desired shapes.
empty_func : cal... | integer of the desired
size. (Examples include ``numpy.empty``, which is the default,
``gnumpy.empty`` and ``theano.tensor.empty``.
Returns
-------
flat : array_like (depending on ``empty_func``)
Memory region containing all the views.
views : list of array_like
Varia... |
boothead/karl | karl/utilities/interfaces.py | Python | gpl-2.0 | 3,456 | 0.002604 | # Copyright (C) 2008-2009 Open Society Institute
# Thomas Moroz: tmoroz@sorosny.org
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License Version 2 as published
# by the Free Software Foundation. You may not use, modify or distribu... | mmunity members.
"""
def emit(context, factory, request):
"""Emits an alert.
For each user to be alerted will either send the alert immediately,
add to a digest queue, or not send at all, according to member
preferences.
o context is place in model tree in which alert... | stance and
has the signature: (context, profile) where context is the same
object as above and profile is the user being alerted.
"""
def send_digests(context):
"""Iterates over all user profiles and sends digested alerts. Will
generally be called by a console scrip... |
Erotemic/local | misc/learn.py | Python | gpl-3.0 | 44,178 | 0.000976 | # -*- coding: utf-8 -*-
"""
Script that lets me play with things I'm learning
"""
from __future__ import absolute_import, division, print_function, unicode_literals
def symbolic_confusion(**known):
"""
Example:
>>> known = {'tp': 10, 'fp': 100, 'total': 1000}
>>> solution = symbolic_confusion(... | (tp + fn)),
sym.Eq(tnr, tn / | (tn + fp)),
sym.Eq(fnr, fn / (fn + tp)),
sym.Eq(fpr, tp / (tp + tn)),
sym.Eq(ppv, tp / (tp + fp)),
sym.Eq(npv, tn / (tn + fn)),
sym.Eq(for_, fn / (fn + tn)),
sym.Eq(fdr, fp / (fp + tp)),
sym.Eq(acc, (tp + tn) / (rp + rn)),
sym.Eq(f1, 2 * tp / (2 * tp... |
gst/alignak | alignak/objects/resultmodulation.py | Python | agpl-3.0 | 5,934 | 0.001517 | # -*- coding: utf-8 -*-
#
# Copyri | ght (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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 License, or
#... | hout even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see <http://www.gnu.org/licenses/>.
#
#
# This file incorpor... |
washort/gelato.models | setup.py | Python | bsd-3-clause | 394 | 0 | from setuptools import setup, find_packages
setup(name='gelato.models',
version='0.1.2',
description='Gelato models',
namespace_packages=['gelato'],
long_descriptio | n='',
author='',
author | _email='',
license='',
url='',
include_package_data=True,
packages=find_packages(exclude=['tests']),
install_requires=['django', 'tower'])
|
Parisson/TimeSide | timeside/server/management/commands/timeside-create-admin-user.py | Python | agpl-3.0 | 1,192 | 0.002517 | from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
class Command(BaseCommand):
help = """Create a default admin user if it doesn't exist.
... | elf.email,
password=self.password)
user.is_superuser = True
user.is_staff = True
user.save()
if verbosity:
print('User "% | s" created"' % self.username)
if Token.objects.get(user=user):
print('Token created for User "%s"' % self.username)
|
ltangt/pyvalue | pyvalue/morningstar/db_test.py | Python | apache-2.0 | 1,299 | 0.00077 | import unittest
from pyvalue.morningstar import db
from pyvalue.morningstar import financial
from pyvalue.morningstar.fetcher import Fetcher
class DatabaseTest(unittest.TestCase):
# def test_retrieve_fundamentals(self):
# db_conn = db.Database()
# db_conn.connect()
# apple = financial.Fin... | db_conn.close()
if __name__ == '__main__':
unit | test.main()
|
mrshu/err | errbot/core_plugins/health.py | Python | gpl-3.0 | 3,841 | 0.001562 | import gc
import os
import signal
from datetime import datetime
from errbot import BotPlugin, botcmd, arg_botcmd
from errbot.plugin_manager import global_restart
from errbot.utils import format_timedelta
class Health(BotPlugin):
@botcmd(template='status')
def status(self, mess, args):
""" If I am ali... | botcmd(admin_only=True)
def restart(self, mess, args):
""" Restart the bot. """
self.send(mess.frm, "Deactivating all the plugins...")
self._bot.plugin_manager.deactivate_all_plugins()
self.send(mess.frm, "Restarting")
self._bot.shutdown()
global_restart()
ret... | help="confirm you want to shut down", admin_only=True)
@arg_botcmd('--kill', dest="kill", action="store_true",
help="kill the bot instantly, don't shut down gracefully", admin_only=True)
def shutdown(self, mess, confirmed, kill):
"""
Shutdown the bot.
Usef... |
OpenSource-/OpenClimateGIS | src/openclimategis/util/ncconv/experimental/ocg_stat/groups.py | Python | bsd-3-clause | 176 | 0.017045 | from base im | port OcgFunctionGroup
class BasicStatistics(OcgFunctionGroup):
name = 'Basic Statistics'
class Thresholds(OcgFunctionGroup):
name = 'Thresholds' | |
rwl/muntjac | muntjac/addon/colorpicker/color_picker_popup.py | Python | apache-2.0 | 23,494 | 0.001788 | # @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
import sys
import traceback
from colorsys import hsv_to_rgb
from muntjac.ui.window import Window
from muntjac.ui.button import IClickListener, Button
from muntjac.ui.tab_sheet import TabSheet
from muntjac.ui.vertical_layout import VerticalLayout
from muntjac.addon.colorpick... | .
self._hsvPreview = None
#: The preview on the swatches tab.
self._selPreview = None
#: The color select.
self._colorSelect = None
#: The selectors.
self._selectors = set()
super(ColorPickerPopup, self).__init__()
self._selectedColor = initia... | e(self._STYLENAME)
self.setResizable(False)
self.setImmediate(True)
# Create the history
self._history = ColorPickerHistory()
self._history.addListener(self, IColorChangeListener)
# Create the preview on the rgb tab
self._rgbPreview = ColorPickerPreview(self._se... |
ericholscher/django | tests/fixtures/models.py | Python | bsd-3-clause | 3,313 | 0.002717 | """
37. Fixtures.
Fixtures are a way of loading data into the database in bulk. Fixure data
can be stored in any serializable format (including JSON a | nd XML). Fixtures
are identified by name, and are stored in either a directory named 'fixtures'
in the application directory, or in one of the directories named in the
``FIXTURE_DIRS`` setting.
"""
from django.contrib.auth.models import Permission
from django.contrib.contenttypes import generic |
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Category(models.Model):
title = models.CharField(max_length=100)
description = models.TextField()
def __str__(self):
... |
Ledoux/ShareYourSystem | Pythonlogy/draft/Simulaters/Neurongrouper/01_ExampleCell.py | Python | mit | 1,164 | 0.043814 | #/###################/#
# Import modules
#
#ImportModules
import ShareYourSystem as SYS
#/###################/#
# Build the model
#
#Definition an instance
MyNeurongrouper=SYS.NeurongrouperClass(
).n | eurongroup(
#NeurongroupingBrianDict
{
'N':10,
'model':
'''
dv/dt = (-(v+60*mV)+11*mV + 5.*mV*sqrt(20.*ms)*xi)/(20*ms) : volt
''',
'threshold':'v>-50*mV',
'reset':'v=-70*mV'
},
#NeurongroupingStatesDict
{
'v':[('Run',[0,1])],
},
#NeurongroupingSpikesDict
{
'Run':{}
},
)
... | MyNeurongrouper is ')
SYS._print(MyNeurongrouper)
#/###################/#
# Do one simulation
#
"""
#Print
from brian2 import Network,ms,mV
MyNetwork=Network()
map(
MyNetwork.add,
SYS.flat(
[
MyNeurongrouper.NeurongroupedBrianVariable,
MyNeurongrouper.NeurongroupedSpikeMonitorsList,
MyNeurongrouper.Neur... |
phalax4/CarnotKE | jyhton/tests/java/org/python/indexer/data/pkg/other/color/bleu.py | Python | apache-2.0 | 19 | 0 | from | blue import | *
|
johnjosephhorton/runSQL | runSQL.py | Python | gpl-2.0 | 2,185 | 0.015103 | #!/usr/bin/env python
import argparse
import os
import psycopg2
from settings import connection_string
import csv
__author__ = 'John J. Horton'
__copyright__ = 'Copyright (C) 2012 John Joseph Horton'
__license__ = 'All rights reserved'
__maintainer__ = 'johnjosephhorton'
__email__ = 'j | ohn.joseph.horton@gmail.com'
__status__ = 'Development'
__version__ = '0.1'
def create_connection(connection_string):
'''
Creat a connection to | the databse defined in connection_string.
'''
return psycopg2.connect(connection_string)
def execute_query(cursor, sql_stmt, silent, csv_file_name):
'''
Execute the passed SQL statement with the passed cursor.
If silent is not None, then output is written to stdout, otherwise it is surpressed.... |
consi/ispfqd | ispfq/tcpserver.py | Python | mit | 1,481 | 0.004727 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ISPForum internet quality measurement daemon
# Marek Wajdzik 29.10.2017 <wajdzik.m@gmail.com>
import logging
import asyncio
import socket
class TCPServer(object):
def __init__(self, port=9981):
#Logger
self.logger = logging.getLogger("tcpserver")
... | socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(("0.0.0.0", self.port))
so | ck.listen(5)
sock.setblocking(False)
while True:
#Async loop sock accept
client, addr = await self.loop.sock_accept(sock)
#Allow only clients that are known to service
if addr[0] in self.allowed:
self.loop.create_task(self.echo_handler(clie... |
mozilla-it/mozlibldap | examples/simple_client_cert.py | Python | mpl-2.0 | 635 | 0.020472 | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Moz | illa 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/.
# Copyright (c) 2014 Mozilla Corporation
# Author: gdestuynder@mozilla.com
# Requires:
# mozlibldap
import mozlibldap
LDAP_URL='ldap://'
LDAP_BIND_DN=''
LDAP_BIND_CLIENTCERT=''... | ynder@mozilla.com")
print("UID:", x)
if __name__ == "__main__":
main()
|
mvaled/sentry | src/sentry/web/frontend/debug/debug_unassigned_email.py | Python | bsd-3-clause | 284 | 0 | from __future__ import absolute_import
from sentry.models import Activity
from .mail import ActivityMailDebugView
class DebugUnassignedEmailView(ActivityMailDebugView):
def get_acti | vity(self | , request, event):
return {"type": Activity.UNASSIGNED, "user": request.user}
|
zamattiac/SHARE | api/serializers.py | Python | apache-2.0 | 4,542 | 0.001765 | from collections import OrderedDict
from django.contrib.auth.models import AnonymousUser
from rest_framework_json_api import serializers
from share import models
from share.models import ChangeSet, ProviderRegistration, CeleryProviderTask
class ShareModelSerializer(serializers.ModelSerializer):
# http://stacko... | Error:
return None
def is_superuser(self, obj):
return obj.is_superuser
class Meta:
model = models.ShareUser
fields = (
'username', 'first_name', 'last_name', 'email', 'date_joined', 'last_login',
'is_active', 'gravatar', 'locale', 'time_zone'
... | zer):
# changes = ChangeSerializer(many=True)
change_count = serializers.SerializerMethodField()
self = serializers.HyperlinkedIdentityField(view_name='api:changeset-detail')
source = ShareUserSerializer(source='normalized_data.source')
status = serializers.SerializerMethodField()
def get_statu... |
Changron/NTHUOJ_web | problem/views.py | Python | mit | 16,676 | 0.002758 | '''
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... | tcase = get_testcase(problem)
tags = problem.tags.all()
if request.method == 'GET':
form = ProblemForm(instance=problem)
if request.method == 'POST':
form = ProblemForm(request.POST, request.FILES, instance=problem)
if form.is_valid():
problem = form.save()
pr... | em.sample_in = request.POST['sample_in']
problem.sample_out = request.POST['sample_out']
problem.save()
file_ex = get_problem_file_extension(problem)
if "special_judge_code" in request.FILES:
with open('%s%s%s' % (SPECIAL_PATH, problem.pk, file_ex), 'w') a... |
KronicDeth/biclustering | src/python/Biclustering/Combinatorics.py | Python | gpl-2.0 | 5,914 | 0.007778 | # Parallel Biclustering Algorithm - Fast Algorithm for finding all biclusters in a GEM
# Copyright (C) 2006 Luke Imhoff
#
# 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 the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have... |
zachriggle/alpha3 | x86/latin_1/__init__.py | Python | bsd-3-clause | 122 | 0.008197 | import mixedcase
encoders = mixedcase.encoders
for encoder in encoders:
encoder["character encoding | "] = "latin | -1"
|
digiholic/universalSmashSystem | engine/subactions/control/doAction.py | Python | gpl-3.0 | 672 | 0.022321 | from engine.subaction import *
class doAction(SubAction):
subact_group = 'Control'
fields = [NodeMap('action','string','doAction','NeutralAction')
]
def __init__(self,_action='NeutralAction | '):
SubAction.__init__(self)
self.action = _action |
def execute(self, _action, _actor):
SubAction.execute(self, _action, _actor)
_actor.doAction(self.action)
def getDisplayName(self):
return 'Change Action: ' + self.action
def getDataLine(self, _parent):
return dataSelector.ActionSelectorLine(... |
ds-hwang/chromium-crosswalk | tools/android/loading/cost_to_csv.py | Python | bsd-3-clause | 1,406 | 0.014225 | #! /usr/bin/python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import logging
import os
import sys
from processing import (SitesFromDir, WarmGraph, ColdGraph)
def main():
logging.b... | g.ERROR)
parser = argparse.ArgumentParser(
description=('Convert a directory created by ./analyze.py fetch '
'to a CSV.'))
parser.add_argument('--datadir', required=True)
parser.add_argument('--csv', required=True)
parser.add_argument('--noads', action='store | _true')
args = parser.parse_args()
sites = SitesFromDir(args.datadir)
with open(args.csv, 'w') as output:
output.write('site,kind,cost\n')
for site in sites:
print site
warm = WarmGraph(args.datadir, site)
if args.noads:
warm.Set(node_filter=warm.FilterAds)
cold = ColdGraph... |
wilsonianb/nacl_contracts | buildbot/buildbot_selector.py | Python | bsd-3-clause | 16,846 | 0.004452 | #!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import os
import subprocess
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import pynacl.p... | y',
'nacl-mac10.8_newlib_opt_pnacl':
python + ' buildbot/buildbot_pnacl.py opt 32 pnacl',
'nacl-win7_64_newlib_opt_pnacl':
python + ' buildbot/buildbot_pnacl.py opt 64 pnacl',
# Pnacl spec2k try | bots
'nacl-precise_64-newlib-x86_32-pnacl-spec':
bash + ' buildbot/buildbot_spec2k.sh pnacl-trybot-x8632',
'nacl-precise_64-newlib-x86_64-pnacl-spec':
bash + ' buildbot/buildbot_spec2k.sh pnacl-trybot-x8664',
'nacl-arm_perf_panda':
bash + ' buildbot/buildbot_spec2k.sh pnacl-trybot-ar... |
plotly/python-api | packages/python/plotly/plotly/validators/densitymapbox/colorbar/_thicknessmode.py | Python | mit | 587 | 0 | import _plotly_utils.basevalidators
class ThicknessmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="thicknessmode",
parent_name="densitymapbox.colorbar",
**kwargs
):
super(ThicknessmodeValidator, self).__init__(
... | edit_type=kwargs.pop("edit_type", "colorbars"),
role=kwargs.pop("role", "style"),
values=kwargs.pop("values", ["fraction", "pixels"]),
| **kwargs
)
|
CMSS-BCRDB/RDS | trove/tests/fakes/keystone.py | Python | apache-2.0 | 2,659 | 0 | # Copyright 2010-2012 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... | def _header_to_env_var(self, key):
"""Convert header to wsgi env variable.
:param key: http header name (ex. 'X-Auth-Token')
:return wsgi env variable name (ex. 'HTTP_X_AUTH_TOKEN')
"""
return 'HTTP_%s' % key.replace('-', '_').uppe | r()
def _add_headers(self, env, headers):
"""Add http headers to environment."""
for (k, v) in headers.iteritems():
env_key = self._header_to_env_var(k)
env[env_key] = v
def get_admin_token(self):
return "ABCDEF0123456789"
def _get_info_from_token(self, tok... |
langit/pymprog | models/queens.py | Python | gpl-3.0 | 1,087 | 0.024839 | from __future__ import print_function
import pymprog
# The Queens Problem is to place as many queens as possible on the nxn
# chess board in a way that they do not fight
# each other. This problem is probably as old as the chess game itself,
# and thus | its origin is not known, but it is known that Gauss studied
# | this problem.
n = 16 #size of chess board
p = pymprog.model('queens')
iboard = pymprog.iprod(range(n), range(n)) #create indices
x = p.var('X', iboard, bool) #create variables
#row wise:
p.st([sum(x[i,j] for j in range(n)) <= 1 for i in range(n)])
#column wise:
p.st([sum(x[i,j] for i in range(n)) <= 1 for j in range... |
ndee85/coa_tools | Blender/coa_tools/operators/edit_shapekey.py | Python | gpl-3.0 | 11,020 | 0.012795 | '''
Copyright (C) 2015 Andreas Esau
andreasesau@gmail.com
Created by Andreas Esau
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)... | e_set(mode="OBJECT")
return {"FINISHED"}
class ShapekeyAdd(bpy.types.Operator):
bl_idname = "coa_tools.shapekey_add"
bl_label = "Add Shapekey"
bl_description = ""
bl_options = {"REGISTER"}
name = StringProperty(name="Name")
@classmethod
def poll(cls, context):
ret... | return wm.invoke_props_dialog(self)
def execute(self, context):
obj = context.active_object
if obj.data.shape_keys == None:
obj.shape_key_add(name="Basis",from_mix=False)
shape = obj.shape_key_add(name=self.name,from_mix=False)
shape_name = ... |
gonzalodelgado/noticole | notificaciones/migrations/0003_auto__chg_field_alumno_usuario.py | Python | mit | 5,252 | 0.007997 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Alumno.usuario'
db.alter_column(u'notificaciones_alumn... | sion']", 'symmetrical': 'False', ' | blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_le... |
heddle317/moto | tests/test_rds/test_rds.py | Python | apache-2.0 | 10,968 | 0.000274 | from __future__ import unicode_literals
import boto.rds
import boto.vpc
from boto.exception import BotoServerError
import sure # noqa
from moto import mock_ec2_deprecated, mock_rds_deprecated
from tests.helpers import disable_on_py3
@disable_on_py3()
@mock_rds_deprecated
def test_create_database():
conn = boto... | oup.when.called_with(
"not-a-db").should.throw(BotoServerError)
@disable_on_py3()
@mock_rds_deprecated
def test_security_group_authorize():
conn = boto.rds.connect_to_region("us-west-2")
security_group = conn.create_dbsecurity_group('db_sg', 'DB Security Group')
list(security_group.ip_ranges).shou... | = conn.get_all_dbsecurity_groups()[0]
list(security_group.ip_ranges).should.have.length_of(1)
security_group.ip_ranges[0].cidr_ip.should.equal('10.3.2.45/32')
@disable_on_py3()
@mock_rds_deprecated
def test_add_security_group_to_database():
conn = boto.rds.connect_to_region("us-west-2")
database = c... |
lao605/product-definition-center | pdc/apps/package/serializers.py | Python | mit | 9,310 | 0.003222 | #
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
import json
from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers
from . import models
from pdc.apps.common.serializers import StrictSerializerMixin, DynamicFieldsSe... | ata.pop('dependencies', [])
instance = super(RPMSerializer, self).create(validated_data)
for dep in dependencies:
dep.rpm = instance
dep.save()
return instance
def update(self, instance, validated_data):
dependencies = validated_data.pop('dependencies', None)... | ata)
if dependencies is not None or not self.partial:
models.Dependency.objects.filter(rpm=instance).delete()
for dep in dependencies or []:
dep.rpm = instance
dep.save()
return instance
class ImageSerializer(StrictSerializerMixin, serializers.Mo... |
rezoo/chainer | chainer/functions/math/fft.py | Python | mit | 2,426 | 0 | from chainer import cuda
from chainer import function_node
from chainer.utils import type_check
class FFT(function_node.FunctionNode):
"""Fast Fourier transform."""
def __init__(self, method):
self._method = method
def check_type_forward(self, in_types):
type_check.argname(in_types, ('r... | T('fft').apply((real, imag))
def ifft(x):
"""Inverse fast Fourier transform.
Args:
x (tuple): ``(real, imag)`` where ``real`` is a
:class:`~chainer.Variable` storing the real part and
``imag`` is a :class:`~chainer.Variable` storing the imaginary
part.
Returns... | result.
.. note::
Currently this function supports a tuple as input. It will support a
complex numbers directly in the future.
"""
real, imag = x
return FFT('ifft').apply((real, imag))
|
MadeiraCloud/salt | libs/docker/tls.py | Python | apache-2.0 | 2,877 | 0 | import os
from . import errors
from .ssladapter import ssladapter
class TLSConfig(object):
cert = None
verify = None
ssl_version = None
def __init__(self, client_cert=None, ca_cert=None, verify=None,
ssl_version=None, assert_hostname=None):
# Argument compatibility/mapping w... | elf.ssl | _version = ssl_version
self.assert_hostname = assert_hostname
# "tls" and "tls_verify" must have both or neither cert/key files
# In either case, Alert the user when both are expected, but any are
# missing.
if client_cert:
try:
tls_cert, tls_key = c... |
Tesora/tesora-tempest | tempest/api/compute/admin/test_hosts_negative.py | Python | apache-2.0 | 6,539 | 0 | # Copyright 2013 Huawei Technologies Co.,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 applica... | 'status' or 'maintenance_mode' | needed for host update
hostname = self._get_host_name()
self.assertRaises(lib_exc.BadRequest,
self.client.update_host,
hostname)
@test.attr(type=['negative'])
@test.idempotent_id('23c92146-2100-4d68-b2d6-c7ade970c9c1')
def test_update_non... |
ixjlyons/pygesture | pygesture/ui/templates/new_session_template.py | Python | bsd-3-clause | 6,242 | 0.001922 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pygesture/ui/templates/new_session_template.ui'
#
# Created by: PyQt5 UI code generator 5.5
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_NewSessionDialog(object):
def setu... | abel.setObjectName("configurationLabel")
self.gridLayout.addWidget(self.configurationLabel, 3, 0, 1, 1)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
| self.armRadioButton = QtWidgets.QRadioButton(NewSessionDialog)
self.armRadioButton.setChecked(True)
self.armRadioButton.setObjectName("armRadioButton")
self.configurationGroup = QtWidgets.QButtonGroup(NewSessionDialog)
self.configurationGroup.setObjectName("configurationGroup")
... |
kif/freesas | freesas/average.py | Python | mit | 9,116 | 0.004498 | __author__ = "Guillaume"
__license__ = "MIT"
__copyright__ = "2015, ESRF"
import numpy
from freesas.model import SASModel
class Grid:
"""
This class is used to create a grid which include all the input models
"""
def __init__(self, inputfiles):
"""
:param inputfiles: list of pdb files... | :-1:2]:
knots = numpy.append(knots, [[xmin+x, ymin+y, zmin+z, 0.0]], axis=0)
else:
for y in ylist[1:-1:2]:
knots = numpy.append(knots, [[xmin+x, ymin+y, zmin+z, 0.0]], axis=0)
else:
for j in r... | ):
x = xlist[j]
if j % 2 == 0:
for y in ylist[1:-1:2]:
knots = numpy.append(knots, [[xmin+x, ymin+y, zmin+z, 0.0]], axis=0)
else:
for y in ylist[0:-1:2]:
kn... |
ml31415/numpy-groupies | numpy_groupies/aggregate_purepy.py | Python | bsd-2-clause | 4,714 | 0.001273 | from __future__ import division
import math
import itertools
import operator
from .utils import (get_func, aliasing, funcs_no_separate_nan,
aggregate_common_doc, isstr)
# min - builtin
# max - builtin
# sum - builtin
# all - builtin
# any - builtin
def _last(x):
return x[-1]
def _first(x... | roup_idx, a, reverse=kwargs.get('reverse', False))
# sort data and evaluate function on groups
ret = [fill_value] * size
if not getattr(func, 'x_and_idx', False):
data = sorted(zip(group_idx, a), key=operator.itemgetter(0))
| for ix, group in itertools.groupby(data, key=operator.itemgetter(0)):
ret[ix] = func(list(val for _, val in group), **kwargs)
else:
data = sorted(zip(range(len(a)), group_idx, a), key=operator.itemgetter(1))
for ix, group in itertools.groupby(data, key=operator.itemgetter(1)):
... |
whitehorse-io/encarnia | Encarnia/world/npc_rules.py | Python | mit | 3,566 | 0.003085 | from random import randint
from world import english_utils, rules
from evennia import TICKER_HANDLER as tickerhandler
from evennia.server.sessionhandler import SESSIONS
def attack(caller, target):
"Returns a random one-handed sword attack message."
d3 = randint(1,3)
if d3 == 1:
message... | ame)
SESSIONS.announce_all(string)
rules.death_movement(caller, target)
if (float(target.db.health) / float(target.db.max_health)) > 0.80:
prompt_hp_color = "|g"
elif (float(target.db.health) / float(target.db.max_health)) > 0.36:
prompt_hp_color = "|y"
else:... | tamina > 6:
prompt_stamina_color = "|g"
elif target.db.stamina > 3:
prompt_stamina_color = "|y"
else:
prompt_stamina_color = "|r"
prompt = "%sHealth|n: %s%s|n - |gMagic|n: |nAsleep|n - %sStamina|n: %s%s." % (prompt_hp_color, prompt_hp_color, target.db.health, prompt_stamina_c... |
GunnerJnr/_CodeInstitute | Stream-3/Full-Stack-Development/20.Deployment/4.Populating-our-database/we_are_social/threads/migrations/0001_initial.py | Python | mit | 2,276 | 0.003954 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-08 09:18
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import tinymce.models
class Migration(migrations.Migration):
in... | CharField(max_length=255)),
('description', tinymce.models.HTMLField()),
],
),
migrations.CreateModel(
name='Thread',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
... | ('Subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='threads', to='threads.Subject')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='threads', to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddFiel... |
mjwestcott/PyPokertools | examples/isomorph.py | Python | mit | 10,374 | 0.000289 | """
Finding isomorphic/canonical representations of the flop.
In Texas Holdem suits have no intrinsic value. Thus, if the flop is "2d 3d 4d",
the possible holecards "5c 6c", "5h 6h", and "5s 6s" are equivalent -- they are
each a straight and the suits are irrelevant. Similarly, the flop "4d 3d 2d" is
equivalent to the... | en randomly generated flop, what its canonical
form is.
For completeness I also include what is, loosely speaking, the opposite
function: a way to produce all suit-isomorphs of a given flop.
Finally, you will find a way to map the suits on the current flop to the suits
on its canonical version. This will allow us to ... | S
#------------------------------------------------------------------------------
# Finding the Canonical Version
#
# The position-isomorphic aspect of this problem is easy to solve: we can
# simply specify that canonical flops must be sorted. The suit-isomorphic
# aspect is a little more difficult. Suits may appear o... |
ainmosni/jolly_roger | jolly_roger/core/forms.py | Python | bsd-3-clause | 1,078 | 0 | # -*- coding: utf-8 -*-
from django.contrib.auth import authenticate
from django.forms import ValidationError
import floppyforms as forms
class LoginForm(forms.Form):
"""
Simple login form.
"""
username = forms.CharField()
password = forms.CharField(widget=forms.widgets.PasswordInput)
redir_... | raise ValidationError("Invalid username or password.",
code='loginfailed') |
if not user.is_active:
raise ValidationError("Account has been disabled.",
code="accountdisabled")
cleaned_data['user'] = user
return cleaned_data
|
camillobruni/pinocchioCodespeed | tools/pypy/savecpython.py | Python | gpl-3.0 | 2,103 | 0.006182 | # -*- coding: utf-8 -*-
import urllib, urllib2
from datetime import datetime
SPEEDURL = 'http://speed.pypy.org/'
def save(project, revision, results, options, executable, int_options, host, testing=False):
testparams = []
#Parse data
data = {}
current_date = datetime.today()
for b in resu... | "ComparisonResult":
value = results['avg_base']
else:
print("ERROR: result type unknown " + b[1])
r | eturn 1
data = {
'commitid': revision,
'project': project,
'executable_name': executable,
'executable_coptions': int_options,
'benchmark': bench_name,
'environment': host,
'result_value': value,
'result_date': curren... |
knuu/competitive-programming | atcoder/arc/arc099_a_2.py | Python | mit | 127 | 0 | N, K = map(int, | input().split())
A = [int(x) for x in input().split()]
print((N - 1) // (K - 1) + int((N - | 1) % (K - 1) != 0))
|
arnif/CouchPotatoServer | couchpotato/environment.py | Python | gpl-3.0 | 3,124 | 0.013444 | from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.loader import Loader
from couchpotato.core.settings import Settings
from sqlalchemy.engine import create_engine
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm.session import sessionmaker
import os
class Env(object):
_appna... | return setattr(Env, '_' + attr, value)
@staticmethod
def getSession(engine = None):
existing_session = Env.get('session')
if existing_session:
return existing_session
engine = Env.getEngine()
session = scoped_session(sessionmaker(bind = engine))
Env.set('s... | ion
@staticmethod
def getEngine():
return create_engine(Env.get('db_path'), echo = False, pool_recycle = 30)
@staticmethod
def setting(attr, section = 'core', value = None, default = '', type = None):
s = Env.get('settings')
# Return setting
if value == None:
... |
ruslanosipov/space | tests/chatclient_test.py | Python | gpl-2.0 | 903 | 0 | import unittest
from lib.chatclient import ChatClient
class TestChatClient(unittest.Test | Case):
def setUp(self):
self.chatclient = ChatClient()
def test_get_log_returns_correct_size(self):
self.chatclient.add_multiple([("foo", 1) for x in xrange(0, 8)])
self.assertEqual(len(self.chatclient.get_log(22)), 8,
"log should return all available records")... | 1) for x in range(0, 20)])
self.assertEqual(len(self.chatclient.get_log(22)), 22,
"log should not return more items then size")
self.chatclient.add_multiple([("foo" * 20, 1) for x in xrange(0, 8)])
width_limit = 56
for line in self.chatclient.get_log(22):
... |
eerimoq/bitstruct | bitstruct/version.py | Python | mit | 23 | 0 | _ | _version_ | _ = '8.12.1'
|
kiith-sa/despiker | docsrc/conf.py | Python | apache-2.0 | 9,490 | 0.007587 | # -*- coding: utf-8 -*-
#
# Despiker documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 10 00:02:54 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help buil | der.
htmlhelp_basename = 'Despikerdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamb... |
bravomikekilo/mxconsole | mxconsole/backend/event_processing/event_accumulator.py | Python | apache-2.0 | 31,429 | 0.004677 | # 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... | Value = namedtuple('CompressedHistogramValue',
['basis_point', 'value'])
HistogramEvent = namedtuple('HistogramEvent',
['wall_time', 'step', 'histogram_value'])
His | togramValue = namedtuple('HistogramValue', ['min', 'max', 'num', 'sum',
'sum_squares', 'bucket_limit',
'bucket'])
ImageEvent = namedtuple('ImageEvent', ['wall_time', 'step',
'encoded_ima... |
smtchahal/url-shortener | url_shortener/urls.py | Python | mit | 655 | 0.003053 | import os
from django.conf import settings
from django.conf.urls import url
from . import views
app_name = 'url_shortener'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<alias>[a-zA-Z0-9-_]+)$', views.redirect, name='alias'),
url(r'^(?P<alias>[a-zA | -Z0-9-_]+)(?P<extra>/.*)$', views.redirect, name='alias'),
url(r'^(?P<alias>[a-zA-Z0-9-_]+)\+$', views.preview, name='preview'),
url(r'^~analytics/$', views.analytics, name='analytics'),
]
# For Heroku
if 'DYNO' in os.environ:
urlpatterns += [
url(r'^~static/(?P<path>.*)$', 'django.views.static.ser... | s.STATIC_ROOT}),
]
|
sio2project/oioioi | oioioi/ontak/apps.py | Python | gpl-3.0 | 95 | 0 | fro | m django.apps import AppConfig
class OntakAppConfig(AppConfig):
name | = "oioioi.ontak"
|
fpieper/py2neo | test/core/1-main/repr_test.py | Python | apache-2.0 | 7,484 | 0.004677 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# 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
#
# Unle... | ():
pointer = NodePointer(3456)
assert repr(pointer) == "<NodePointer address=3456>"
def test_relationship_repr(graph):
alice = Node("Person", name="Alice")
bob = Node("Person", name="Bob")
relationship = Relationship(alice, "KNOWS", bob)
if PY2:
assert repr(relationship) == "<Relation... | ationship) == ("<Relationship graph=u'http://localhost:7474/db/data/' "
"ref=u'%s' start=u'%s' end=u'%s' type=u'KNOWS' "
"properties={}>" % (relationship.ref, alice.ref, bob.ref))
else:
assert repr(relationship) == ("<Relationship g... |
h4wldev/Frest | app/modules/auth/token.py | Python | mit | 652 | 0.003067 | # -*- coding: utf-8 -*-
import datetime
from flask import jsonify, request
from app import token_auth
from app.models.user_token_model import UserTokenModel
@token_auth.verify_token
def verify_token(hashed):
token = UserTokenModel.query\
.filter(UserTokenModel.hashed == hashed, UserTokenModel.ip_address ... |
@token_auth.error_handler
def error_handler():
return jsonify( | {'code': 401, 'status': 'fail', 'message': 'Token that does not exist or has expired.'})
|
rsomeon/wikiteam | testing/test_dumpgenerator.py | Python | gpl-3.0 | 14,795 | 0.006382 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2014 WikiTeam developers
# 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 optio... | '#'*73
tests = [
# Alone wikis
#['http://wiki.annotation.jp/index.php', 'http://wiki.annotation.jp/api.php', u'かずさアノテーション - ソーシャル・ゲノム・アノテーション.jpg'],
['http://archiveteam.org/index.php', 'http://archiveteam.org/api.php', u'Archive-is 2013-07-02 17-05-40.png'],
['h... | ki/index.php', 'http://skilledtests.com/wiki/api.php', u'Benham\'s disc (animated).gif'],
# Editthis wikifarm
# It has a page view limit
# Gamepedia wikifarm
['http://dawngate.gamepedia.com/index.php', 'http://dawngate.gamepedia.com/api.php', u'S... |
Passtechsoft/TPEAlpGen | blender/release/scripts/addons_contrib/ewoc_projects_tools/mesh_selproject.py | Python | gpl-3.0 | 12,081 | 0.030296 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the t | erms 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 the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the impli | ed warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Bost... |
CaptainHayashi/permtools | roleperms.py | Python | mit | 1,470 | 0 | #!/usr/bin/env python3
# Copyright (C) 2014 University Radio York
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, cop... | are, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS O... | HE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""
Lists all permissions assigned to the role with the given alias.
E... |
lancekrogers/music-network | cleff/profiles/migrations/0022_auto_20150810_1731.py | Python | apache-2.0 | 378 | 0 | # -*- c | oding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('profiles', '0021_auto_20150810_0351'),
]
operations = [
migrations.AlterModelOptions(
name='comrade',
optio... | ),
]
|
Pexego/PXGO_00053_2013_VT | project-addons/sale_display_stock_reserves/__init__.py | Python | agpl-3.0 | 1,015 | 0 | # -*- coding: utf-8 -*-
###################################################################### | ########
#
# Copyright (C) 2004-2014 Pexego Sistemas Informáticos All Rights Reserved
# $Marta Vázquez Rodríguez$ <marta@pexego.es>
#
# 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 Fo... | n 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more de... |
faircloth-lab/cookiecutter-protocols | {{cookiecutter.repo_name}}/conf.py | Python | bsd-3-clause | 8,239 | 0.007768 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# au... | false, no module index is generated.
#texinfo_domain_indices = True
# H | ow to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmen |
fin/froide | froide/letter/views.py | Python | mit | 5,626 | 0.000889 | from django.shortcuts import get_object_or_404, Http404, redirect
from django.urls import reverse
from django.views.generic import DetailView, UpdateView
from django.http import HttpResponse
from django.contrib.auth.mixins import LoginRequiredMixin
from django.utils.http import urlencode
from froide.helper.utils impor... | sage, context)
if self.request.GET.get("pdf"):
response = HttpResponse(
generator.get_pdf_bytes(), content_type="application/pdf"
)
dispo = "attachment; filen | ame=preview.pdf"
response["Content-Disposition"] = dispo
return response
return HttpResponse(generator.get_html_string())
class SentLetterView(LetterMixin, DetailView):
template_name = "letter/sent.html"
def check_already_sent(self):
return
def get_context_data(se... |
hoechenberger/psychopy | psychopy/visual/backends/pygletbackend.py | Python | gpl-3.0 | 16,713 | 0.000718 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2018 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
"""A Backend class defines the core low-level functions required by a Window
class, such as the ability to create an OpenGL context a... | "only an iss | ue for you if you need multiple "
"stimulus windows, in which case update your "
"graphics card and/or graphics drivers.")
if sys.platform == 'win32':
# pyHook window hwnd maps to:
# pyglet 1.14 -> window._hwnd
# pyglet 1.2a -> window._view_hw... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.