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
Azure/azure-sdk-for-python
sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_configuration.py
Python
mit
2,282
0.005697
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Change
s may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any from azure.core.configuration import Configuration from azure.core.pipeline import policies VERSION = "unknown" class KeyVaultClientConfigur...
attributes. :keyword api_version: Api Version. The default value is "7.2". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__( self, **kwargs: Any ) -> None: super(KeyVaultClientConfiguration, self).__i...
jjas0nn/solvem
tensorflow/lib/python2.7/site-packages/numpy/lib/tests/test_arraypad.py
Python
mit
43,332
0.002285
"""Tests for the array padding functions. """ from __future__ import division, absolute_import, print_function import numpy as np from numpy.testing import (assert_array_equal, assert_raises, assert_allclose, TestCase) from numpy.lib import pad class TestConditionalShortcuts(TestCase): ...
67., 68., 69., 70., 71., 72., 73., 74., 75., 76., 77., 78., 79., 80., 81., 82., 83., 84., 85., 86., 87., 88., 89., 90., 91., 92., 93., 94., 95., 96., 97., 98., 99., 98., 98., 98., 98., 98., 98., 98., 98., 9
8., 98., 98., 98., 98., 98., 98., 98., 98., 98., 98., 98. ]) assert_array_equal(a, b) def test_check_maximum_1(self): a = np.arange(100) a = pad(a, (25, 20), 'maximum') b = np.array( [99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, ...
ppizarror/Hero-of-Antair
data/images/pil/ImageOps.py
Python
gpl-2.0
13,229
0.00189
# # The Python Imaging Library. # $Id$ # # standard image operations # # History: # 2001-10-20 fl Created # 2001-10-23 fl Added autocontrast operator # 2001-12-18 fl Added Kevin's fit operator # 2004-03-14 fl Fixed potential division by zero in equalize # 2005-05-05 fl Fixed equalize for low number of values ...
ge, lut) ## # Colorize grayscale image. The <i>black</i> and <i>white</i> # arguments should be RGB tuples; this function calculates a colour # wedge mapping all black pixels in the source image to the first # colour, and all white pixels to the second colour. # # @param image The image to colourize. # @param black T...
An image. def colorize(image, black, white): "Colorize a grayscale image" assert image.mode == "L" black = _color(black, "RGB") white = _color(white, "RGB") red = []; green = []; blue = [] for i in range(256): red.append(black[0]+i*(white[0]-black[0])/255) green.append(black[1]...
masahir0y/buildroot-yamada
support/scripts/cpedb.py
Python
gpl-2.0
7,878
0.003427
#!/usr/bin/env python3 import xml.etree.ElementTree as ET from xml.etree.ElementTree import Element, SubElement import gzip import os import requests import time from xml.dom import minidom VALID_REFS = ['VENDOR', 'VERSION', 'CHANGE_LOG', 'PRODUCT', 'PROJECT', 'ADVISORY'] CPEDB_URL = "https://static.nvd.nist.gov/fee...
me(CPEDB_URL)) if not os.path.exists(cpe_dict_local) or os.stat(cpe_di
ct_local).st_mtime < time.time() - 86400: print("CPE: Fetching xml manifest from [" + CPEDB_URL + "]") cpe_dict = requests.get(CPEDB_URL) open(cpe_dict_local, "wb").write(cpe_dict.content) print("CPE: Unzipping xml manifest...") nist_cpe_file = gzip.GzipFile(fileobj=...
UUDigitalHumanitieslab/timealign
annotations/management/commands/export_fragments.py
Python
mit
1,823
0.003291
# -*- coding: utf-8 -*- from django.core.management.base import BaseCommand, CommandError from annotations.models import Corpus from annotations.exports import export_fragments from core.utils import CSV, XLSX class Command(BaseCommand): help = 'Exports existing Fragments for the given Corpus and Languages' ...
parser.add_argument('--doc', dest='document') parser.add_argument('--formal_str
ucture') def handle(self, *args, **options): # Retrieve the Corpus from the database try: corpus = Corpus.objects.get(title=options['corpus']) except Corpus.DoesNotExist: raise CommandError('Corpus with title {} does not exist'.format(options['corpus'])) for...
joshtechnologygroup/dark-engine
engine/dark_matter/search_engine/similarity_checker.py
Python
gpl-3.0
9,843
0.003353
# Python/NLTK implementation of algorithm to detect similarity between # short sentences described in the paper - "Sentence Similarity based # on Semantic Nets and Corpus Statistics" by Li, et al. # Results achieved are NOT identical to that reported in the paper, but # this is very likely due to the differences in the...
1 N = N + 1 lookup_word = lookup_word.lower() n = 0 if not brown_freqs.has_key(lookup_word) else brown_freqs[lookup_word] return 1.0 - (math.log(n + 1) / math.log(N + 1)) def semantic_vector(words, joint_words, info_content_norm): """ Computes the semantic vector of a sentence. The...
The size of the semantic vector is the same as the size of the joint word set. The elements are 1 if a word in the sentence already exists in the joint word set, or the similarity of the word to the most similar word in the joint word set if it doesn't. Both values are further normalized by the word's ...
victorclf/jcc-web
server/test/controller/test_partition.py
Python
agpl-3.0
2,710
0.007749
import unittest import os import shutil import filecmp import pytest import marks import options import util from controller.partition import PartitionController class PartitionControllerTest(unittest.TestCase): TEST_DATA_PATH = os.path.join(os.getcwd(), 'testdata') def setUp(self): self.control...
: oldF = os.path.join(root, f) + '.old' self.assertTrue(os.path.exists(oldF)) expectedOldF = os.path.join(self.TEST_DATA_PATH, '..', os.path.relpath(oldF)) self.assertTrue(filecmp.cmp(oldF, expectedOldF, False))
self.assertFalse(filecmp.cmp(oldF, os.path.join(root, f), False)) def testGetPartitionJSON(self): pJSON = self.controller.getPartitionJSON(self.projectOwner, self.projectName, self.pullRequestId) self.assertTrue(pJSON)
boto/botocore
tests/unit/test_http_session.py
Python
apache-2.0
18,102
0.000221
import socket import pytest from urllib3.exceptions import ( NewConnectionError, ProtocolError, ProxyError, ) from tests import mock, unittest from botocore.awsrequest import ( AWSRequest, AWSHTTPConnectionPool, AWSHTTPSConnectionPool, ) from botocore.httpsession import ( get_cert_path, ...
.com', 'https://***:***@myproxy.amazonaws.com' ), ( 'http://user:pass@localhost', 'http://***:***@localhost' ), ( 'http://user:pass@localhost:80', 'http://***:***@localhost:80' ), ( 'http://user:pass@...
ttp://***:***@192.168.1.1' ), ( 'http://user:pass@[::1]', 'http://***:***@[::1]' ), ( 'http://user:pass@[::1]:80', 'http://***:***@[::1]:80' ), ) ) def test_mask_proxy_url(proxy_url, expected_mask_url): assert mask_proxy_url...
Victordeleon/os-data-importers
eu-structural-funds/common/config.py
Python
mit
3,382
0.002365
"""Pipeline configuration parameters.""" from os.path import dirname, abspath, join from sqlalchemy import create_engine OS_TYPES_URL = ('https://raw.githubusercontent.com/' 'openspending/os-types/master/src/os-types.json') PIPELINE_FILE = 'pipeline-spec.yaml' SOURCE_DATAPACKAGE_FILE = 'source.datapa...
'default', 'bareNumber': False, 'decimalChar': ',', 'groupChar': '.'}, {'format': 'default', 'bareNumber': False, 'decimalChar': '.', 'groupChar': ' '}, {'format': 'default', '
bareNumber': False, 'decimalChar': ',', 'groupChar': ' '}, {'format': 'default', 'bareNumber': False, 'decimalChar': '.', 'groupChar': ''}, {'format': 'default', 'bareNumber': False, 'decimalChar': '.', 'groupChar': '`'}, {'format': 'default', 'bareNumber': False, 'decimalChar': ',', 'groupChar': '\''}, ...
lotem/rime.py
weasel/weasel.py
Python
gpl-3.0
9,656
0.003598
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim:set et sts=4 sw=4: __all__ = ( "WeaselSession", "WeaselService", "service", ) import logging import logging.config import os import time import threading logfile = os.path.join(os.path.dirname(__file__), "logging.conf") logging.config.fileConfig(logfil...
_stale_sessions(self): '''ๆชขๆŸฅ้ŽๆœŸ็š„ๅ›ž่ฉฑ''' logger.info("check_stale_sessions...") expire_time = time.time() - WeaselService.SESSION_EXPIRE_TIME for sid in self.__sessions.keys(): if self.__sessions[sid].last_active_time < expire_time: logger.info("removing stale ses...
self.destroy_session(sid) # ้‚„ๆœ‰ๆดปๅ‹•ๆœƒ่ฉฑ๏ผŒ่จˆๅŠƒไธ‹ไธ€ๆฌกๆชขๆŸฅ self.__timer = None if self.__sessions: self.schedule_next_check() def has_session(self, sid): '''ๆชขๆŸฅๆŒ‡ๅฎšๆœƒ่ฉฑ็š„ๅญ˜ๅœจ็‹€ๆ…‹''' if sid in self.__sessions: return True else: return False def get_sess...
rahul-ramadas/BagOfTricks
InsertMarkdownLink.py
Python
unlicense
1,987
0.003523
import sublime import sublime_plugin MARKDOWN_LINK_SNIPPET = "[${{1:{}}}](${{2:{}}})" class InsertMarkdownLinkCommand(sublime_plugin.TextCommand): def decode_page(self, page_bytes, potential_encoding=None): if potential_encoding: try: text = page_bytes.decode(pot...
e def on_done(link): import urllib.request request = urllib.request.Request(link, headers={'User-Agent' : 'Google Internal-Only Browser'}) with urllib.request.urlopen(request) as page: encoding = page.headers.get_content_charset() text ...
age(page.read(), encoding) match = re.search("<title>(.+?)</title>", text, re.IGNORECASE | re.DOTALL) if match is None: title = link else: title = match.group(1).strip() markdown_link = MARKDOWN_LINK_SNIPPET.form...
ostree/plaso
tests/parsers/mac_keychain.py
Python
apache-2.0
3,604
0.00111
#!/usr/bin/python # -*- coding: utf-8 -*- """Tests for Keychain password database parser.""" import unittest from plaso.formatters import mac_keychain as _ # pylint: disable=unused-import from plaso.lib import eventdata from plaso.lib import timelib from plaso.parsers import mac_keychain from tests.parsers import t...
: Secret Note' expected_msg_short = u'Secret Note' self._TestGetMessageStrings(event_object, expected_msg, expected_msg_short) event_object = event_objects[3] expected_timestamp = timelib.Timestamp.CopyFromString( u'2014-01-26 14:54:33') self.assertEqual(event_object.timestamp, expected_ti...
account_name, u'MrMoreno') expected_ssgp = ( u'83ccacf55a8cb656d340ec405e9d8b308fac54bb79c5c9b0219bd0d700c3c521') self.assertEqual(event_object.ssgp_hash, expected_ssgp) self.assertEqual(event_object.where, u'plaso.kiddaland.net') self.assertEqual(event_object.protocol, u'http') self.assertE...
TrondKjeldas/knxmonitor
test/test_KnxParser.py
Python
gpl-2.0
4,428
0.007227
import unittest from time import mktime, strptime from knxmonitor.Knx.KnxParser import KnxParser class TestKnxParser(unittest.TestCase): def setUp(self): self.parser = KnxParser("enheter.xml", "groupaddresses.csv", False, False, { "1/1/14" : "onoff", "1/1/15...
ss_Write 1.1.27") self.assertEqual(len(self.parser.knxAddrStream["1/1/15"].telegrams), 2) self.parser.parseVbusOutput(3, "Fri Sep 4 06:15:03 2015", "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 6.12.31 to 2/7/15 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 81 ff") ...
def test_storeCachedInput(self): pass def test_getStreamMinMaxValues(self): self.assertEqual(self.parser.getStreamMinMaxValues("1/1/15"), (None, None)) self.parser.parseVbusOutput(0, "Fri Sep 4 06:15:03 2015", "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from...
nagisa/Feeds
gdist/gschemas.py
Python
gpl-2.0
2,161
0.001851
import glob import os from distutils.dep_util import newer from distutils.core import Command from distutils.spawn import find_executable from distutils.util import change_root class build_gschemas(Command): """build message catalog files Build message catalog (.mo) files from .po files using xgettext ...
f.install_base, 'share', 'glib-2.0', 'schemas') if self.root != None: dest = change_root(self.root, dest) self.copy_tree(src, dest) self.spawn([
'glib-compile-schemas', dest]) __all__ = ["build_gschemas", "install_gschemas"]
xuweiliang/Codelibrary
openstack_dashboard/dashboards/admin/volumes_back/snapshots/urls.py
Python
apache-2.0
922
0
# 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 KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from django.conf.urls import url fr...
PyLadiesPoznanAdvanced/django-introduction-bmi
calculators/tests_view.py
Python
mit
1,112
0.002708
from django.test import Client, TestCase from django.core.urlresolvers import reverse class ViewTests(TestCase): def setUp(self): self.client = Client() def test_bmi_calculator_main_page_1(self): response = self.client.get(reverse('calculators:main_bmi')) self.assertEqual(response.st...
mi')) self.assertEqual(response.templates[0].name, "calculators/b
mi.html") # SimpleTestCase.assertContains(response, text, count=None, status_code=200, msg_prefix='', html=False) # TODO a lot of tests
bossiernesto/django-bootstrap3-classview
django_bootstrap3view/django_bootstrap3view_app/services/base.py
Python
bsd-3-clause
6,504
0.001538
# -*- coding: utf-8 -*- from django.shortcuts import get_object_or_404 from django_bootstrap3view.django_bootstrap3view_app.utils.render import render, render_string from django_bootstrap3view.django_bootstrap3view_app.utils.python import convert_to_bool class BaseService(object): _repo = property(fget=lambda se...
w_value(self, row_data, render): if isinstance(render, str): if isinstance(row_data, dict): return str(row_data[render]) else: return str(getattr(row_data, render)) else: return str(render(row_data)) def get_params(self, data, par...
for param in params: dict_params[param] = data.get(param) return dict_params def convert_to_bool(self, data, params): convert_to_bool(data, params) def to_bool(self, param): return bool(int(param)) def get_action_params(self, request, params_names, prefix=""...
suutari-ai/shoop
shuup/notify/__init__.py
Python
agpl-3.0
1,215
0
# -*- coding: utf-8 -*- # This file is part o
f Shuup. # # Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root dire
ctory of this source tree. from shuup.apps import AppConfig class ShuupNotifyAppConfig(AppConfig): name = "shuup.notify" verbose_name = "Shuup Notification Framework" label = "shuup_notify" provides = { "notify_condition": [ "shuup.notify.conditions:LanguageEqual", "sh...
agoose77/hivesystem
manual/movingpanda/panda-5.py
Python
bsd-2-clause
3,673
0.001361
import dragonfly import dragonfly.pandahive import bee from bee import connect import math, functools from panda3d.core import NodePath import dragonfly.scene.unbound import dragonfly.std import dragonfly.io # ## random matrix generator from random import random def random_matrix_generator(): while 1: ...
bee.get_parameter("pandaclassname") pandaname_ = bee.get_parameter("pandaname") c1 = bee.configure("scene") c1.import_mesh_EGG("models/environment") a = NodePath("") a.setScale(0.25) a.setPos(-8, 42, 0) mat = a.getMat()
m = (mat.getRow3(3), mat.getRow3(0), mat.getRow3(1), mat.getRow3(2)) c1.add_model_MATRIX(matrix=m) c2 = bee.configure("scene") c2.import_mesh_EGG("models/panda-model") a = NodePath("") a.setScale(0.005) mat = a.getMat() m = (mat.getRow3(3), mat.getRow3(0), mat.getRow3(1), mat.getRow3(2)) ...
uclouvain/osis
reference/migrations/0005_auto_20160902_1639.py
Python
agpl-3.0
5,965
0.003353
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-09-02 14:39 from __future__ import unicode_literals import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('reference', '0004_educationinstitution'), ] operation...
'Transition'), ('QUALIFICATION', 'Qualification'), ('ANOTHER', 'Autre')], m
ax_length=20)), ('name', models.CharField(max_length=100)), ('adhoc', models.BooleanField(default=True)), ], ), migrations.CreateModel( name='ExternalOffer', fields=[ ('id', models.AutoField(auto_created=True, primary_ke...
RaD/django-south
docs/djbook/_ext/djbookdocs.py
Python
apache-2.0
7,983
0.008081
# -*- coding: utf-8 -*- """ Sphinx plugins for Django documentation. """ import os import re from docutils import nodes, transforms try: import json except ImportError: try: import simplejson as json except ImportError: try: from django.utils import simplejson as json ex...
tives.CmdoptionDesc.parse_signature()""" from sphinx.domains.std import option_desc_re count = 0 firstname = '' for m in option_desc_re.finditer(sig): optname, args = m.groups() if count: signode += addnodes.desc_addname(', ', ', ') signode += addnodes.desc_name(optna...
firstname = optname count += 1 if not count: for m in simple_option_desc_re.finditer(sig): optname, args = m.groups() if count: signode += addnodes.desc_addname(', ', ', ') signode += addnodes.desc_name(optname, optname) signode += add...
perfsonar/pscheduler
pscheduler-test-idlebgm/idlebgm/validate.py
Python
apache-2.0
1,872
0.017628
# # Validator for "idlebg" Test # from pscheduler import json_validate MAX_SCHEMA = 1 def spec_is_valid(json):
schema = { "type": "object", "properties": { "schema": { "$ref": "#/pScheduler/Cardinal" }, "duration": { "$ref": "#/pScheduler/Duration" },
"host": { "$ref": "#/pScheduler/Host" }, "host-node": { "$ref": "#/pScheduler/URLHostPort" }, "interval": { "$ref": "#/pScheduler/Duration" }, "parting-comment": { "$ref": "#/pScheduler/String" }, "starting-comment": { "$ref": "#/pScheduler...
modulexcite/catapult
catapult_build/module_finder.py
Python
bsd-3-clause
551
0.005445
# 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 imp def FindModule(name): """Gets the path of the named module. This is useful for cases where we want to use subprocess.call on a module we have imported, and safer than using __file__ since that can point to .pyc files. Args: name: the string name of a module ...
he module. """ return imp.find_module(name)[1]
drsudow/SEG-D
setup.py
Python
mit
1,008
0.029791
from setuptools import setup, Extension from Cython.Build import cythonize import numpy setup( name = 'SEGD', version = '0.a1', description = 'A Python3 reader for SEG-D rev3.1 binary data.', url =
'https://github.com/drsudow/SEG-D.git', author = 'Mattias Sรผdow', author_email = '[email protected]', license = 'MIT', classifiers = [ 'Development Status :: 3 -Aplha', 'Intended Audience :: Science/Research', 'License :: OSI Approve...
'Topic :: Scientific/Engineering :: Information Analysis', 'Programming Language :: Python :: 3.5', ], keywords = 'seismic SEGD', packages = ['SEGD'], install_requires = ['cython','numpy','datetime'], ext_modules = cythonize([Extension...
WojciechRynczuk/vcdMaker
test/functional/maker.py
Python
mit
2,819
0.000709
# maker.py # # A class representing vcdMaker specific test. # # Copyright (c) 2019 vcdMaker 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 limit...
'line_counter': ['', ''], 'user_format': ['', '']} for element in node.iter(tag='unique'): self.unique = Flat(element, self.unique_params) self.create_command(test_directory) def create_command(self, test_directory): """Builds the vcdMaker specifi...
swegener/sigrok-meter
datamodel.py
Python
gpl-3.0
8,443
0.002961
## ## This file is part of the sigrok-meter project. ## ## Copyright (C) 2014 Jens Steinhauser <[email protected]> ## ## 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...
self.setData(idx, {}, MeasurementDataModel.tracesRole) class MultimeterDelegate(QtGui.QStyledItemDelegate)
: '''Delegate to show the data items from a MeasurementDataModel.''' def __init__(self, parent, font): '''Initialize the delegate. :param font: Font used for the text. ''' super(self.__class__, self).__init__(parent) self._nfont = font fi = QtGui.QFontInfo(se...
klahnakoski/MoDevETL
pyLibrary/convert.py
Python
mpl-2.0
17,324
0.003002
# encoding: utf-8 # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Author: Kyle Lahnakoski ([email protected]) # from __future__ import unicode_literals from __f...
ue).format(format=format) def datetime2str(value, format="%Y-%m-%d %H:%M:%S"): return Date(value).format(format=format) def datetime2unix(d): try: if d == None: return None elif isinstance(d
, datetime.datetime): epoch = datetime.datetime(1970, 1, 1) elif isinstance(d, datetime.date): epoch = datetime.date(1970, 1, 1) else: Log.error("Can not convert {{value}} of type {{type}}", value= d, type= d.__class__) diff = d - epoch return Decim...
hoffmaje/layla
layla/vocabularymanager/models.py
Python
agpl-3.0
240
0.004167
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Copyright 2012 Jens Hoffman
n (hoffmaje) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from django.db import models from django
.contrib.auth.models import User
CiscoDevNet/coding-skills-sample-code
coding202-parsing-json/call-functions.py
Python
apache-2.0
217
0.041475
print ("I'm not a function") def
my_function(): prin
t("Hey I'm a function!") def brett(val): for i in range(val): print("I'm a function with args!") my_function() brett(5)
nwjlyons/copy-file-name
copy_filename.py
Python
mit
435
0.004598
import sublime, sublime_plugin, os cla
ss CopyFilenameCommand(sublime_plugin.TextCommand): def run(self, edit): if len(self.view.file_name()) > 0: filename = os.path.split(self.view.file_name())[1] sublime.set_clipboard(filename) sublime.status_message("Copied file name: %s" % filename) def is_enabled(sel...
_name()) > 0
favoretti/accessninja
accessninja/device.py
Python
mit
5,511
0.000363
#!/usr/bin/env python from os.path import join from config import Config from group import HostGroup, PortGroup from parser import Parser from renderers.junos import JunosRenderer from renderers.ios import IOSRenderer from deployers.junos import JunosDeployer from deployers.ios import IOSDeployer from deployers.iosscp...
if line.strip().startswith('vendor'): self.vendor = line.strip().split(' ')[1] if line.strip().startswith('transport'): self.transport = line.strip().split(' ')[1] if line.strip().startswith('save_config'): self.save_config = line.strip...
e'): self.add_include(line.strip().split(' ')[1]) def print_stats(self): for hg in self._hostgroups: hg.print_stats() for rule in self._rules: rule.print_stats() def render(self): print('Rendering {}'.format(self._name)) for include in se...
yasserglez/pytiger2c
scripts/pytiger2c.py
Python
mit
4,333
0.006238
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Script para ejecutar PyTiger2C desde la linea de comandos. """ import os import sys import optparse import subprocess # Add the directory containing the packages in the source distribution to the path. # This should be removed when Tiger2C is installed. PACKAGES_DIR ...
ser.set_default('output_type', 'binary') options, args = parser.parse_args(args=argv[1:]) optparse.check_choice(parser.get_option('--output-type'), '--output-type', options.output_type) if not options.output: parser.error('missing required --output option') elif len(args) != 1: parser.er...
argumentos del programa. @rtype: C{int} @return: Retorna 0 si no ocurriรณ ningรบn error durante la ejecuciรณn del programa y 1 en el caso contrario. """ options, args = _parse_args(argv) tiger_filename = os.path.abspath(args[0]) output_filename = os.path.abspath(options.output) tr...
bassijtsma/chatbot
yowsup/demos/echoclient/stack.py
Python
gpl-3.0
2,467
0.008512
from yowsup.stacks import YowStack from .layer import EchoLayer from yowsup.layers import YowLayerEvent from yowsup.layers.auth import YowCryptLayer, YowAuthenticationProtocolLayer, AuthError from yowsup.layers.coder import YowCoderLayer from yowsup.layers.network ...
wsup.layers.protocol_receipts import YowReceiptProtocolLayer from yowsup.layers.protocol_acks import YowAckProtocolLayer from yowsup.layers.logger import YowLoggerLayer from yowsup.layers.protocol_iq import YowIqProtocolLayer from yowsup.layers.protocol_calls...
yptionEnabled = False): if encryptionEnabled: from yowsup.layers.axolotl import YowAxolotlLayer layers = ( EchoLayer, YowParallelLayer([YowAuthenticationProtocolLayer, YowMessagesProtocolLayer, YowReceiptProtocolLayer, YowAckProtocolLay...
Jorge-Rodriguez/ansible
lib/ansible/modules/network/iosxr/iosxr_user.py
Python
gpl-3.0
29,071
0.002752
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Ansible by Red Hat, inc # 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 ANSIBLE_METADATA = {'metadata_version': '1.1', ...
res the contents of the public keyfile to upload to the IOS-XR node. This enables users to login using the accompanying private key. IOS-XR only accepts base64 decoded files, so this will be decoded and uploaded to the node. Do note that this requires an OpenSSL public key file, P
uTTy generated files will not work! Mutually exclusive with public_key.If used with multiple users in aggregates, then the same key file is used for all users. requirements: - base64 when using I(public_key_contents) or I(public_key) - paramiko when using I(public_key_contents) or I(public_key) """ ...
ARMmbed/yotta
yotta/lib/pack.py
Python
apache-2.0
23,065
0.002948
# Copyright 2014-2016 ARM Limited # # Licensed under the Apache License, Version 2.0 # See LICENSE file for details. # standard library modules, , , import json import os from collections import OrderedDict import tarfile import re import logging import errno import copy import hashlib # PyPi/standard library > 3.4 #...
eturn the dependency specification, which may be from a shrinkwrap file ''' return self.shrinkwrap_version_req or self.version_req def __unicode__(self): return u'%s at %s' % (self.name, self.version_req) def __str__(self): import sys # in python 3 __str__ must return a string (...
t return unicode, so: if sys.version_info[0] >= 3: return self.__unicode__() else: return self.__unicode__().encode('utf8') def __repr__(self): return self.__unicode__() def tryReadJSON(filename, schemaname): r = None try: with open(filename, 'r') as ...
Lipen/LipenDev
Azeroth/Pandaria/process.py
Python
gpl-3.0
2,341
0.032892
import os sys = os.system CC = 'g++ {} -std=gnu++0x -Wall' FLAG_clear = ['/c', '-c'] FLAG_window = ['/w', '-w'] FLAG_exit = ['/e', '-e'] def main(): print('List of existing <*.cpp> files:') files = [] counter = 0 for file in os.listdir(): if file[-4:] == '.cpp': counter += 1 files.append(file) print('...
sys('cls') print('Compiling...') err = sys((CC+' -o {}.exe').format(name, name[:-4])) if err: print('Error during compiling. <{}>'.format(err)) else: print('Compiled succesfully. Starting:\n' + '-' * 31) if len(list(set(FLAG_window).intersection(set(flags)))) > 0: err2 = sys('start {}.exe'.format(...
>'.format(err2)) else: print('-' * 17 + '\nDone succesfully.') elif command == 'list': if name != '': if len(list(set(FLAG_clear).intersection(set(flags)))) > 0: sys('cls') print('List of existing <*.{}> files:'.format(name)) l = len(name) for file in os.listdir(): if file[-l:] == name: ...
peterhudec/authomatic
examples/gae/simple/main.py
Python
mit
6,966
0.001005
# -*- coding: utf-8 -*- # main.py import webapp2 from authomatic import Authomatic from authomatic.adapters import Webapp2Adapter from config import CONFIG # Instantiate Authomatic. authomatic = Authomatic(config=CONFIG, secret='some random secret string') # Create a simple request handler for the login procedure. ...
ve the user! # OAuth 2.0 and OAuth 1.0a provide only limited user data on login, # We need to update the user to get more info. if not (result.user.name and result.user.id): result.user.update() # Welcome the user. sel...
elf.response.write( u'<h2>Your email is: {}</h2>'.format(result.user.email)) # Seems like we're done, but there's more we can do... # If there are credentials (only by AuthorizationProvider), # we can _access user's protected resources. ...
sorenh/cc
vendor/Twisted-10.0.0/twisted/conch/test/test_mixin.py
Python
apache-2.0
1,110
0.001802
# -*- twisted.conch.test.test_mixin -*- # Copyright (c) 2001-2004 Twisted Matrix Labora
tories. # See LICENSE for details. import time from twisted.internet import reactor, protocol from twisted.trial import unittest from twisted.test.proto_helpers import StringTransport from twisted.conch import mixin class TestBufferingProto(mixin.BufferingMixin): scheduled = False rescheduled = 0 def ...
ule(self): self.scheduled = True return object() def reschedule(self, token): self.rescheduled += 1 class BufferingTest(unittest.TestCase): def testBuffering(self): p = TestBufferingProto() t = p.transport = StringTransport() self.failIf(p.scheduled) ...
hgijeon/NetworkLayer
morse.py
Python
gpl-2.0
5,184
0.021991
AZ09 = ["A","B","C","D"] MorseAZ09 = [".-","-...","-.-.","-.."] def str2morse(string): string = string.upper() ret = "" for c in string: ret += MorseAZ09[AZ09.index(c)] +" " return ret # alphanumeric to morse code dictionary AN2Morse = {"A":".-", "B":"-...", ...
morseList.append(ch) ch = '' if e[1] >= 6: morseList.append(" ") elif e[0] == '1' or e[0] == True: if e[1] == 1: ch += '.' elif e[1] == 3: ch += '-' if ch != '': ...
urn "".join([Morse2AN[m] for m in morseList]) def an2bit(string): return morse2bit(an2morse(string)) def seq2an(onOffSeq): return morse2an(bitData2morse(tuple2bitData(seq2tuple(onOffSeq))))
frederica07/Dragon_Programming_Process
PyOpenGL-3.0.2/src/missingglut.py
Python
bsd-2-clause
1,579
0.031032
#! /usr/bin/env python """Script to find missing GLUT entry points""" from OpenGL import GLUT import subprocess, re func
_finder = re.compile( 'FGAPIENTRY (\w+)\(' ) constant_finder = re.compile( '#define\W+([0-9a-zA-Z_]+)\W+((0x)?\d+)' ) INCLUDE_DIR = '/usr/include/GL' def defined( ): """Grep FGAPIENTRY headers fr
om /usr/include/GL""" pipe = subprocess.Popen( 'grep -r FGAPIENTRY %(INCLUDE_DIR)s/*'%globals(), shell=True, stdout=subprocess.PIPE ) stdout,stderr = pipe.communicate() return stdout def constants(): pipe = subprocess.Popen( 'grep -r "#define" %(INCLUDE_DIR)s/*glut*'%globals(), shell=True, stdout=subpro...
sinsai/Sahana_eden
controllers/asset.py
Python
mit
2,306
0.006071
# -*- coding: utf-8 -*- """ Asset @author: Michael Howden ([email protected]) @date-created: 2011-03-18 Asset Management Functi
onality """ prefix = request.controller resourcename = request.function #=========================================================================
===== response.menu_options = [ #[T("Home"), False, URL(r=request, c="asset", f="index")], [T("Assets"), False, URL(r=request, c="asset", f="asset"), [ [T("List"), False, URL(r=request, c="asset", f="asset")], [T("Add"), False, URL(r=request, c="asset", f="asset", args="create")], ...
DailyActie/Surrogate-Model
01-codes/tensorflow-master/tensorflow/models/image/mnist/convolutional.py
Python
mit
13,852
0.000361
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
# Max pooling. The kernel size spec {ksize} also follows the layout of # the data. Here we have a pooling window of 2, and a stride of 2. pool = tf.nn.max_pool(relu, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], ...
.conv2d(pool, conv2_weights, strides=[1, 1, 1, 1], padding='SAME') relu = tf.nn.relu(tf.nn.bias_add(conv, conv2_biases)) pool = tf.nn.max_pool(relu,
jesseklein406/data-structures
tests/test_simple_graph.py
Python
mit
3,955
0.000759
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals i
mport pytest import simple_graph @pytest.fixture(scope="function") def create_graph(): new_graph = simple_graph.G() return new_graph @pytest.fixture(scope="function") def build_graph(create_graph): jerry = simple_graph.Node('Jerry', 5) allen = simple_graph.Node
('Allen', 8) six = simple_graph.Node('6', 6) # jerry2allen = simple_graph.Edge(jerry, allen) # allen2six = simple_graph.Edge(allen, six) create_graph.add_node(jerry) create_graph.add_node(allen) create_graph.add_node(six) create_graph.add_edge(jerry, allen) create_graph.add_edge(allen, s...
aschampion/CATMAID
django/applications/catmaid/control/data_view.py
Python
gpl-3.0
5,209
0.011327
import json import re from collections import defaultdict from django.conf import settings from django.db.models import Count from django.http import HttpResponse from django.shortcuts import get_object_or_404 from django.template import Context, loader from django.contrib.contenttypes.models import ContentType from...
text = "Please select a valid data view type." else: try: data_view_type_id = int(requested_id) text = DataViewType.objects.get(pk=data_view_type_id).comment except: text = "Sorry, the configuration help text couldn't be retrieved." result = { 'comment'...
json.dumps(result), content_type="application/json") def dataview_to_dict( dataview ): """ Creates a dicitonary of the dataviews' properties. """ return { 'id': dataview.id, 'title': dataview.title, 'code_type': dataview.data_view_type.code_type, 'config': dataview.config, ...
joeywen/zarkov
zarkov/config.py
Python
apache-2.0
10,451
0.003158
'''Handle configuration for zarkov. We support full configuration on the command line with defaults supplied by either an .ini-style config file or a yaml (and thus json) config file. ''' import sys import logging.config from optparse import OptionParser from ConfigParser import ConfigParser import yaml import coland...
ns.pdb: sys.excepthook = post
mortem_hook return options, args def get_options(argv): '''Load the options from argv and any config files specified''' defaults=dict( bind_address='tcp://0.0.0.0:6543', backdoor=None, password=None, mongo_uri='mongodb://127.0.0.1:27017', mongo_database='zarkov', ...
opendata/lmgtdfy
lmgtfy/views.py
Python
mit
4,151
0.003854
import csv from django.contrib import messages from django.shortcuts import HttpResponseRedirect, resolve_url, HttpResponse from django.views.generic import FormView, ListView from lmgtfy.forms import MainForm from lmgtfy.helpers import search_bing, check_valid_tld from lmgtfy.models import Domain, DomainSearch, Doma...
main_result', domain) ) main_vie
w = MainView.as_view() class SearchResultView(ListView): template_name = 'result.html' model = DomainSearchResult success_url = '.' def get_queryset(self): qs = super(SearchResultView, self).get_queryset() try: domain = self.kwargs['domain'] fmt = self.kwargs.g...
JohnUrban/fast5tools
bin/filterFast5DerivedFastx.py
Python
mit
11,145
0.007447
#!/usr/bin/env python2.7 import os, sys from Bio import SeqIO import argparse from fast5tools.fxclass import * ################################################# ## Argument Parser ################################################# parser = argparse.ArgumentParser(description = """ Given path(s) to fasta/fastq file(s)...
args.readtype = "2d" elif args.readtype[0] == "m": args.readtype = "molecule" elif args.readtype[0] == "a": args.readtype = "all"
elif args.readtype[0] == "M": args.readtype = "MoleQual" if args.intype == 'input' or args.intype == "both": intypes = ['fasta', 'fastq'] elif args.intype == 'fasta': intypes = ['fasta'] elif args.intype == 'fastq': intypes = ['fastq'] def filter_by_entry(readtype, minlen, maxlen, minq, ma...
Distrotech/scons
test/Fortran/F95COMSTR.py
Python
mit
2,501
0.001599
#!/usr/bin/env python # # __COPYRIGHT__ # # 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, publish, ...
truct', """ env = Environment(F95COM = r'%(_python_)s myfc.py f95 $TARGET $SOURCES', F95COMSTR = 'Building f95 $TARGET from $SOURCES', F95PPCOM = r'%(_python_)s myfc.py f95pp $TARGET $SOURCES',
F95PPCOMSTR = 'Building f95pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f95') env.Object(source = 'test02.F95') """ % locals()) test.write('test01.f95', "A .f95 file.\n#f95\n") test.write('test02.F95', "A .F95 file.\n#%s\n" % f95pp) test.run(stdout = t...
nkgilley/home-assistant
homeassistant/components/vesync/switch.py
Python
apache-2.0
3,095
0.000323
"""Support for Etekcity VeSync switches.""" import logging from homeassistant.components.switch import SwitchEntity from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from .common import VeSyncDevice from .const import DOMAIN, VS_DISCOVERY, VS_DISPATCHERS, VS...
it__(self, plug): """Initialize the VeSync switch device.""" super().__init__(plug) self.smartplug = plug @property def device_state_attributes(self): """Return the state attributes of the device.""" attr = {} if hasattr(self.smartplug, "weekly_energy_total"): ...
= self.smartplug.voltage attr["weekly_energy_total"] = self.smartplug.weekly_energy_total attr["monthly_energy_total"] = self.smartplug.monthly_energy_total attr["yearly_energy_total"] = self.smartplug.yearly_energy_total return attr @property def current_power_w(sel...
WarrenWeckesser/scipy
scipy/stats/_rvs_sampling.py
Python
bsd-3-clause
7,177
0
import numpy as np from scipy._lib._util import check_random_state def rvs_ratio_uniforms(pdf, umax, vmin, vmax, size=1, c=0, random_state=None): """ Generate random samples from a probability density function using the ratio-of-uniforms method. Parameters ---------- pdf : callable A ...
vmax.") if umax <= 0: raise ValueError("umax must be positive.") size1d = tuple(np.atleast_1d(size)) N = np.prod(size1d) # number of rvs needed, reshape upon return # start sampling using ratio of uniforms method rng = check_random_state(random_state) x = np.zeros(N) simulated, ...
d infinite loop, raise exception if not a single rv has been # generated after 50000 tries. even if the expected numer of iterations # is 1000, the probability of this event is (1-1/1000)**50000 # which is of order 10e-22 while simulated < N: k = N - simulated # simulate uniform rvs on [...
LTKills/languages
python/data_structures/strings.py
Python
gpl-3.0
36
0.027778
string = input() string[
0] = "a"
DISMGryphons/GryphonCTF2017-Challenges
challenges/misc/Spirals/solution/solution.py
Python
gpl-3.0
812
0.032338
#!/usr/bin/env python3 import re a = [[0 for x in range(25)] for y in range(13)] f=open("../distrib/spiral.txt","r") s=f.readline().strip() dx, dy = [0, 1, 0, -1], [1, 0, -1, 0] x, y, c = 0, -1, 1 l=0 for i in range(13+13-1): if i%2==0: for j in range((25+25-i)//2): x += dx[i % 4] y ...
c += 1 else: for j in range((13+13-i)//2): x +=
dx[i % 4] y += dy[i % 4] #print(x,y,l) a[x][y] = s[l] l=l+1 c += 1 for i in a: for k in i: k=re.sub(r"ยฆ","โ–ˆ",k) k=re.sub(r"ยฏ","โ–€",k) k=re.sub(r"_","โ–„",k) print(k,end="") print()
ge0rgi/cinder
cinder/volume/manager.py
Python
apache-2.0
211,218
0.000199
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2017 Georgi Georgiev # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with th...
rgs
): """Load the driver from the one specified in args, or from flags.""" # update_service_capabilities needs service_name to be volume super(VolumeManager, self).__init__(service_na
openstack/ironic
ironic/drivers/modules/storage/cinder.py
Python
apache-2.0
20,389
0
# Copyright 2016 Hewlett Packard Enterprise Development Company LP. # Copyright 2016 IBM Corp # 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...
]: msg = (_("Volume target %(id)s is configured for " "'fibre_channel', however no Fibre Channel " "WWPNs are configured for the node volume " "connectors.") % {'id': volume.uuid}) ...
e_type == 'iscsi': if not iscsi_boot and volume.boot_index == 0: msg = (_("Volume target %(id)s is configured for " "'iscsi', however the capability 'iscsi_boot' " "is not set for the node.") % {'id'...
Cyberjusticelab/JusticeAI
src/ml_service/feature_extraction/pre_processing/pre_processing_driver.py
Python
mit
168
0.005952
from f
eature_extraction.pre_processing.filter_precedent import precendent_directory_cleaner def run(command_list): precendent_directory_cleaner.run(command_
list)
jozefg/solar-system
src/attrdict.py
Python
mit
148
0
class
AttrDict(dict): def __init__
(self, *args, **kwargs): super(AttrDict, self).__init__(*args, **kwargs) self.__dict__ = self
devops2014/djangosite
django/db/backends/base/features.py
Python
bsd-3-clause
9,722
0.001234
from django.db.models.aggregates import StdDev from django.db.models.expressions import Value from django.db.utils import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures(object): gis_enabled = False allows_group_by_pk = False # True if django.db.backends.uti...
supported by the Python driver supports_paramstyle_pyformat = True # Does the backend
require literal defaults, rather than parameterized ones? requires_literal_defaults = False # Does the backend require a connection reset after each material schema change? connection_persists_old_columns = False # What kind of error does the backend throw when accessing closed cursor? closed_cur...
wujuguang/sentry
tests/sentry/rules/conditions/test_level_event.py
Python
bsd-3-clause
1,452
0
from sentry.testutils.cases import RuleTestCase from sentry.rules.conditions.level import LevelCondition, LevelMatchType class LevelConditionTest(RuleTestCase): rule_cls = LevelCondition def get_event(self): event = self.event event.group.level = 20 return event def test_equals(s...
self.assertDoesNotPass(rule, event) rule = self.get_rule({ 'match': LevelMatchType.GREATER_OR_EQUAL, 'level': '20', }) self.assertPasses(rule, event) def test_l
ess_than(self): event = self.get_event() rule = self.get_rule({ 'match': LevelMatchType.LESS_OR_EQUAL, 'level': '10', }) self.assertDoesNotPass(rule, event) rule = self.get_rule({ 'match': LevelMatchType.LESS_OR_EQUAL, 'level': '30...
funbaker/astropy
astropy/coordinates/tests/test_transformations.py
Python
bsd-3-clause
14,498
0.00069
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from ... import units as u from .. import transformations as t from ..builtin_frames import ICRS, FK5, FK4, FK4NoETerms, Galactic, AltAz from .. import representation as r from ..baseframe import ...
a=coo1.ra, dec=coo1.dec * 2) c2 = c1.transform_to(TCoo2) assert_allclose(c2.ra.degree, 1) assert_allclose(c2.dec.degree, 4) c3 = TCoo1(r.CartesianRepresentation(x=1*u.pc, y=1*u.pc, z=2*u.pc)) @frame_transform_graph.transform(t.StaticMatrixTransform, TCoo1, TCoo2) def matrix(): return ...
assert_allclose(c4.cartesian.y, 1*u.pc) assert_allclose(c4.cartesian.z, 2*u.pc) def test_shortest_path(): class FakeTransform: def __init__(self, pri): self.priority = pri g = t.TransformGraph() # cheating by adding graph elements directly that are not classes - the # gra...
phamelin/ardupilot
Tools/autotest/param_metadata/param_parse.py
Python
gpl-3.0
17,332
0.002192
#!/usr/bin/env python from __future__ import print_function import glob import os import re import sys from argparse import ArgumentParser from param import (Library, Parameter, Vehicle, known_group_fields, known_param_fields, required_param_fields, known_units) from htmlemit import HtmlEmit from rs...
param_match[2]) if len(only_vehicles): only_vehicles_list = [x.strip() for x in only_vehicles.split(",")] for only_vehicle in only_vehicles_list: if only_vehicle not in valid_truenames: raise ValueError...
cle.truename not in only_vehicles_list: continue p = Parameter(li
thehub/hubspace
hubspace/microSite.py
Python
gpl-2.0
70,144
0.011533
import os import os.path import glob import re from turbogears import controllers, expose, redirect, identity, validators as v, validate, config from turbogears.identity.exceptions import IdentityFailure from hubspace.validators import * from formencode import ForEach from hubspace.utilities.templates import try_render...
s.get('location') no_of_images = 9 only_with_images = True profiles = get_local_profiles(location, only_with_images, no_of_images) if len(args) >=1: profiles.update(get_user(*args)) return profiles def get_user(*args, **kwargs): if len(args) >= 1: user = User.by_user_name(args[0...
lace.select(AND(PublicPlace.q.name==args[0])) if place.count(): return {'place': place[0]} return {'place': None} def get_events(*args, **kwargs): no_of_events = 10 location = kwargs.get('location') events = get_local_future_events(location, no_of_events) events.update(get_...
Semanticle/Semanticle
sm-mt-devel/src/metabulate/tests/test26case-009d.py
Python
gpl-2.0
18,357
0.011113
''' Copyright 2009, 2010 Anthony John Machin. All rights reserved. Supplied subject to The GNU General Public License v3.0 Created on 28 Jan 2009 Last Updated on 10 July 2010 As test20 with tests of: rules instantiation and query inference Related: single dict TS recursion rule plus generic rule + minimal da...
# add namespaces in source stores sa._addNamespace('mytriples', 'http://www.semanticle.org/triples/') sa._addNamespace('com
triples', 'http://www.semanticle.com/triples/') # triples for recursion test sa._actionTriple("add [('mytriples#bob', 'child_of', 'alice'),('http://www.semanticle.com/triples/#dan', 'child_of', 'cev')]") sa._actionTriple("add", [('cev', 'child_of', 'http://www.semanticle.org/triples/#bob'),"('http://www.sem...
lopopolo/hyperbola
hyperbola/__init__.py
Python
mit
63
0
__all__
= ("settings", "u
rls", "wsgi") __version__ = "0.159.0"
pescobar/easybuild-framework
easybuild/toolchains/clanggcc.py
Python
gpl-2.0
1,795
0.001671
## # Copyright 2013
-2020 Ghent Unive
rsity # # This file is triple-licensed under GPLv2 (see below), MIT, and # BSD three-clause licenses. # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) ...
GuessWhoSamFoo/pandas
pandas/core/indexes/multi.py
Python
bsd-3-clause
113,443
0.000079
# pylint: disable=E1101,E1103,W0232 from collections import OrderedDict import datetime from sys import getsizeof import warnings import numpy as np from pandas._libs import ( Timestamp, algos as libalgos, index as libindex, lib, tslibs) import pandas.compat as compat from pandas.compat import lrange, lzip, map, ...
bel combinations to positive integers. """ _base = libindex.UInt64Engine def _codes_to_ints(self, codes): """ Transform combination(s) of uint64 in one uint64 (each), in a strictly monotonic way (i.e. respecting the lexicographic order of integer combinations): see BaseM...
Parameters ---------- codes : 1- or 2-dimensional array of dtype uint64 Combinations of integers (one per row) Returns ------ int_keys : scalar or 1-dimensional array, of dtype uint64 Integer(s) representing one combination (each) """ ...
carlvlewis/bokeh
bokeh/charts/builder/timeseries_builder.py
Python
bsd-3-clause
6,252
0.002879
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the TimeSeries class which lets you build your TimeSeries charts just passing the arguments to the Chart class and calling the proper functions. """ #-----------------------------------------------------...
ists, arrays and DataFrames are valid inputs) now = datetime.datetime.now() delta = datetime.timedelta(minutes=1) dts = [now + delta*i for i in range(5)] xyval
ues = OrderedDict({'Date': dts}) y_python = xyvalues['python'] = [2, 3, 7, 5, 26] y_pypy = xyvalues['pypy'] = [12, 33, 47, 15, 126] y_jython = xyvalues['jython'] = [22, 43, 10, 25, 26] ts = TimeSeries(xyvalues, index='Date', title="TimeSeries", legend="top_left", ylabel=...
masschallenge/impact-api
web/impact/impact/tests/test_judging_round.py
Python
mit
445
0
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from i
mpact.tests.api_test_case import APITestCase from impact.tests.factories import JudgingRoundFactory class TestJudgingRound(APITestCase): def test_str(self): judging_round = JudgingRoundFactory() judging_round_string = str(judging_round) assert judging_round.name in judging_round_string ...
assert str(judging_round.program) in judging_round_string
vesln/robber.py
robber/matchers/respond_to.py
Python
mit
485
0.004124
from robber import expect from robber.explanation import Explanation from robber.matchers.base import Base class RespondTo(Base): """ expect(obj).to.respond_to('method') """ def matches(self)
:
return hasattr(self.actual, self.expected) and callable(getattr(self.actual, self.expected)) @property def explanation(self): return Explanation(self.actual, self.is_negative, 'respond to', self.expected) expect.register('respond_to', RespondTo)
rbarlow/pulp_openstack
plugins/pulp_openstack/plugins/distributors/glance_publish_steps.py
Python
gpl-2.0
4,901
0.003265
from gettext import gettext as _ import logging from pulp.plugins.util.publish_step import PublishStep, UnitPublishStep from pulp_openstack.common import constants from pulp_openstack.common import openstack_utils _logger = logging.getLogger(__nam
e__) class GlancePublisher(PublishStep): """ Openstack Image Web publisher class that pushes images into Glance. """ def __init__(self, repo, publish_conduit, config): """ :param repo: Pulp managed Yum repository :type repo: pulp.plugins.model.Repository :param publis...
fig: Pulp configuration for the distributor :type config: pulp.plugins.config.PluginCallConfiguration """ super(GlancePublisher, self).__init__(constants.PUBLISH_STEP_GLANCE_PUBLISHER, repo, publish_conduit, config) publish_step = PublishSt...
insomnia-lab/calibre
src/calibre/gui2/preferences/template_functions.py
Python
gpl-3.0
10,331
0.002807
#!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal <[email protected]>' __docformat__ = 'restructuredtext en' import json, traceback from PyQt4.Qt import QDialogButtonBox from calibre.gui2 import error_dialog, warning_dialog from c...
ast argument must be *args. At least one argument is required, and is usually the value of the field being operated up
on. Note that when writing in basic template mode, the user does not provide this first argument. Instead it is supplied by the formatter.</li> </ul></p> <p> The following example function checks the value of the field. If the field is not empty, the field's value is retu...
tamasgal/km3pipe
pipeinspector/gui.py
Python
mit
1,923
0.00052
import urwid from pipeinspector.widgets import BlobWidget, BlobBrowser from pipeinspector.settings import UI __author__ = "Tamas Gal" __copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration." __credits__ = [] __license__ = "MIT" __maintainer__ = "Tamas Gal" __email__ = "[email protected]" __status__ = "D...
urwid.Frame(self.blob_browser, header=self.header, footer=self.footer), "default", ) urwid.Frame.__init__(self, self.frame) self.overlay = None self.pump = pump urwid.connect_signal(self.blobs, "blob_selected", self.blob_selected) self.blobs.goto_blob(0) ...
self.info_area.set_text("Blob: {0}".format(index)) blob = self.pump.get_blob(index) self.blob_browser.load(blob) def keypress(self, size, key): input = urwid.Frame.keypress(self, size, key) if input is None: return if input in UI.keys["left"]: self.b...
piqoni/onadata
onadata/libs/utils/image_tools.py
Python
bsd-2-clause
3,265
0
import requests from cStringIO import StringIO from PIL import Image from django.conf import settings from django.core.files.storage import get_storage_class from django.core.files.base import ContentFile from tempfile import NamedTemporaryFile from onadata.libs.utils.viewer_tools import get_path def flat(*nums):...
h: height = longest_side width = (width / height) * longest_side else: height = lo
ngest_side width = longest_side return flat(width, height) def _save_thumbnails(image, path, size, suffix): nm = NamedTemporaryFile(suffix='.%s' % settings.IMG_FILE_TYPE) default_storage = get_storage_class()() try: # Ensure conversion to float in operations image.thumbnail( ...
TieWei/nova
nova/tests/db/test_db_api.py
Python
apache-2.0
311,863
0.000895
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # encoding=UTF8 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file ...
age governing permissions and limitations # under
the License. """Unit tests for the DB API.""" import copy import datetime import iso8601 import types import uuid as stdlib_uuid import mox import netaddr from oslo.config import cfg from sqlalchemy.dialects import sqlite from sqlalchemy import exc from sqlalchemy.exc import IntegrityError from sqlalchemy import Met...
skosukhin/spack
var/spack/repos/builtin/packages/libtermkey/package.py
Python
lgpl-2.1
1,935
0.001034
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of S
pack. # Created by Todd Gamblin, [email protected], All rights reserved. # LLNL-CODE-647188 # # For details, see https://github.com/spack/spack # Please also see the NOTICE and LICENSE files for our notice and the LGPL. # # This program is free software; you can redistribute it and/or modify # it under the terms of the...
e that it will be useful, but # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and # conditions of the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along...
petezybrick/iote2e
iote2e-pyclient/src/iote2epyclient/processsim/processsimhumiditytomister.py
Python
apache-2.0
3,105
0.009662
# Copyright 2016, 2017 Peter Zybrick and others. # # 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 ag...
ress or implied. # See the License for the specific language governing permissions and # limitations under the License. """ ProcessSimHumidityToMister :author: Pete Zybrick :contact: [email protected] :version: 1.0.0 """ import logging impor
t time import uuid import sys from iote2epyclient.launch.clientutils import ClientUtils from iote2epyclient.schema.iote2erequest import Iote2eRequest logger = logging.getLogger(__name__) class ProcessSimHumidityToMister(object): ''' Simulate Humidity Sensor and Mister ''' def __init__(self, loginVo,...
xbmc/atv2
xbmc/lib/libPython/Python/Lib/idlelib/PyShell.py
Python
gpl-2.0
48,715
0.00115
#! /usr/bin/env python import os import os.path import sys import string import getopt import re import socket import time import threading import traceback import types import exceptions import linecache from code import InteractiveInterpreter try: from Tkinter import * except ImportError: print>>sys.__stde...
ineno) except: # but debugger may not be active right now.... pass def set_breakpoint_here(self, event=None): text = self.text filename = self.io.filename if not filename: text.bell() return lineno = int(float(text.index("insert"))) ...
self, event=None): text = self.text filename = self.io.filename if not filename: text.bell() return lineno = int(float(text.index("insert"))) try: self.breakpoints.remove(lineno) except: pass text.tag_remove("BREAK",...
dscho/hg
mercurial/copies.py
Python
gpl-2.0
19,523
0.001639
# copies.py - copy detection for Mercurial # # Copyright 2008 Matt Mackall <[email protected]> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import absolute_import import heapq from . import ( node, pathu...
on't try to find where old files went, too expensive # this means we can miss a case like 'hg rm b; hg cp a b' cm = {} # Computing the forward missing is quite expensive on large manifests, since # it compares the entire manifests. We can optimize it in the common use # case of computing what copie...
ts parent (like # during a rebase or histedit). Note, we exclude merge commits from this # optimization, since the ctx.files() for a merge commit is not correct for # this comparison. forwardmissingmatch = match if not match and b.p1() == a and b.p2().node() == node.nullid: forwardmissingmat...
opennode/nodeconductor-assembly-waldur
src/waldur_core/logging/handlers.py
Python
mit
210
0
fro
m django.db import transaction from waldur_core.logging import tasks def process_hook(sender, instance, created=False, **kwargs): transaction.on_commit(lambda: tasks.process_event.delay(instance.pk))
sivaprakashniet/push_pull
push_and_pull/wsgi.py
Python
bsd-3-clause
2,240
0.005357
""" WSGI config for {{ project_name }} project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APP...
gle.com/p/modwsgi/wiki/VirtualEnvironments # Remember original sys.path. #prev_sys_path = list(sys.path) # Get
the path to the env's site-packages directory #site_packages = subprocess.check_output([ # os.path.join(PROJECT_ROOT, '.virtualenv/bin/python'), # '-c', # 'from distutils.sysconfig import get_python_lib;' # 'print get_python_lib(),' #]).strip()...
TomWerner/BlunderPuzzler
gettingstarted/settings.py
Python
mit
4,580
0.001092
""" Django settings for gettingstarted project, on Heroku. For more info, see: https://github.com/heroku/heroku-django-template For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/se...
context_proc
essors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'gettingstarted.wsgi.application' # Database # https...
goshippo/shippo-python-client
setup.py
Python
mit
1,408
0
import os import sys import warnings from setuptools import setup version_contents = {} here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, "shippo", "version.py"), encoding="utf-8") as f: exec(f.read(), version_contents) setup( name='shippo', version=version_contents['VERSION...
: OSI Approved :: MIT License", "Operating System
:: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementatio...
Shinichi-Nakagawa/country-house-server
server/house/urls.py
Python
mit
349
0.002865
#!/usr/bin/env python # -*- coding: utf-8
-*- __author__ = 'Shinichi Nakagawa' from house import views from django.conf.urls import patterns, url, include from rest_framework.routers import DefaultRouter router = DefaultRouter() router.register(r'metrics', views.MetricsViewSet) urlpattern
s = patterns('', url(r'^', include(router.urls)), )
rakeshvar/theanet
train.py
Python
apache-2.0
7,597
0.001843
#! /usr/bin/python # -*- coding: utf-8 -*- import ast import pickle import numpy as np import os import socket import sys import importlib from datetime import datetime import theano as th import theanet.neuralnet as nn ################################ HELPER FUNCTIONS ############################ def share(data, d...
aux) test_fn_tr = net.get_test_model(trin_x, trin_y, trin_aux) test_fn_te = net.get_test_model(test_x, test_y, test_aux) batch_sz = tr_prms['BATCH_SZ'] nEpochs = tr_prms['NUM_EPOCHS'] nTrBatches = tr_corpus_sz // batch_sz nTeBatches = te_corpus_sz // batch_sz ############################################## MORE HELPER...
n = 0., 0., 0 for symdiff, bitdiff in nylist: sym_err += symdiff bit_err += bitdiff n += 1 return 100 * sym_err / n, 100 * bit_err / n if net.tr_layers[-1].kind == 'LOGIT': aux_err_name = 'BitErr' else: aux_err_name = 'P(MLE)' def get_test_indices(tot_samps, bth_samps=tr_prm...
kvaps/vdsm
tests/volumeTests.py
Python
gpl-2.0
2,197
0
# Copyright 2012 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the ...
r 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, Boston, MA 02110-1301 USA # # Refer to the README and COPYING files for full details of the license # import uuid from testlib import VdsmTestCase as TestCaseBase from storage import blockSD SDBLKSZ = 512 class FakeBlockStorageDomain(blockSD.BlockStorageDomain): DOMAI...
BlancaCC/cultutrilla
python_aprendizaje/ejemplos_bรกsicos/puertas.py
Python
gpl-3.0
1,203
0.030075
#!/bin/python3.5 # Programa obtenido de hacker run, se le pasa lista con 0 y 1, que simbolizan puertas, 0 la puerta abierta 1 la puerta cerrada. # Nuestro objetivo es abrir todas las puertas # si se abre y las subyacentes se abrirรกn si no estรกn abiertas # el programa devuelve para una lista de 0 y 1 le mรญnimo de puert...
i += 1 else: min += 1 max += 1 i += 1 return [ min , max] def prueba ( ): for i in range (10):
print (i ) i += i if __name__ == "__main__": doors = list ( map( int, input().strip().split(' '))) print ("La puerta creada: " , doors) result = puertas (doors) print( " ".join( map(str , result ))) prueba();
gadsbyfly/PyBioMed
PyBioMed/PyProtein/PyProteinAAIndex.py
Python
bsd-3-clause
9,731
0.002158
# -*- coding: utf-8 -*- # Copyright (c) 2016-2017, Zhijiang Yao, Jie Dong and Dongsheng Cao # All rights reserved. # This file is part of the PyBioMed. # The contents are covered by the terms of the BSD license # which is included in the file license.txt, found at the root # of the PyBioMed source tree. """ This ...
####### def init_from_file(filename, type=Record): _parse(filename, type) ##################################################################################################### def _parse(filename, rec, quiet=True): """ Parse aaindex input file. `rec` must be `Record` for aaindex1 and `MarixRecord` for...
2 and aaindex3. """ if not os.path.exists(filename): import urllib url = ( "ftp://ftp.genome.jp/pub/db/community/aaindex/" + os.path.split(filename)[1] ) # print 'Downloading "%s"' % (url) filename = urllib.urlretrieve(url, filename)[0] # print 'Saved...
yanggujun/meagram
login.py
Python
mit
312
0.00641
import falcon import json class LoginController: def on_post(self, req, resp): bod
y = req.stream.read() loginInfo = json.loads(body) print 'user: ' + loginInfo['userName'] print 'pass: ' + loginInfo['password'] resp.status = falcon.HTTP_200
resp.body = 'ok'
jedlitools/find-for-me
ex28_context_search.py
Python
mit
1,510
0.009187
import re text = open('khalifa_tarikh.txt', mode="r", encoding="utf-8").read() text = re.sub(r"ูŽ|ู‹|ู|ูŒ|ู|ู|ู’|ู‘|ู€", "", text) def search_words(checklist): search_words = open(checklist, mode='r', encoding='utf-8').read().splitlines() return search_words def index_generator(word, text): juz = 'ุงู„ุฌุฒุก:' ...
.DOTALL) outcomes = [] for passage in contexts: for word in gov_words: pre_all = r"(?:ูˆ|ู|ุจ|ู„|ูƒ|ุงู„|ุฃ|ุณ|ุช|ูŠ|ู†|ุง){0,6}" su_all = r"(?:ูˆ|ู†|ู‡|ู‰|ุง|ุชู…ุง|ู‡ุง|ู†ุง|ุช|ุชู…|ู‡ู…|ูƒู…|ุฉ|ูƒู…ุง|ุชู…ูˆ|ูƒู†|ู‡ู…ุง|ูŠ|ูˆุง|ู†ูŠ|ุงุช|ู‡ู†|ุชู†
|ูƒ|ุชุง){0,4}" regex_w = r"\b" + pre_all + word + su_all + r"\b" if len(re.findall(regex_w, passage)) > 0: passage_page = index_generator(passage, text) passage = re.sub(r"\n", " ", passage) outcomes.append((passage, passage_page)) br...
kevin-coder/tensorflow-fork
tensorflow/python/data/experimental/ops/indexed_dataset_ops.py
Python
apache-2.0
4,824
0.004146
# Copyright 2017 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...
r = "" if shared_name is None: shared_name = "" materialized_resource = ( ged_ops.experimental_materialized_index_dataset_handle( container=container, shared_name=shared_name, **dataset_ops.flat_structure(self))) with ops.colocate_with(materialized_resource...
(materialized_resource, materializer, self.output_classes, self.output_types, self.output_shapes) @abc.abstractmethod def _as_variant_tensor(self): """Creates a `tf.variant` `tf.Tensor` representing this IndexedDataset. Returns: ...
jmtyszka/CBICQA
bin/cbicqc_incoming.py
Python
mit
4,170
0.001439
#!/usr/bin/env python3 """ Rename and organize Horos QC exported data in <BIDS Root>/incoming and place in <BIDS Root>/sourcedata AUTHOR ---- Mike Tyszka, Ph.D. MIT License Copyright (c) 2019 Mike Tyszka Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated doc...
BILITY, 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. """ import os import sys from glob import glob import argparse from pathlib import Path import pydicom from shutil import rmtree def main(): parser =...
, default='.', help='BIDS dataset directory containing sourcedata subdirectory') # Parse command line arguments args = parser.parse_args() dataset_dir = os.path.realpath(args.dataset) incoming_dir = os.path.join(dataset_dir, 'incoming') sourcedata_dir = os.path.join(dataset...
tbielawa/Taboot
taboot/__init__.py
Python
gpl-3.0
1,161
0
# -*- coding: utf-8 -*- # Taboot - Client utility for performing deployments with Func. # Copyright ยฉ 2009-2011, Red Hat, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 ...
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 received a copy of the GNU General Public License # along with this program....
asks to be run in a certain order against certain groups of hosts. """ __docformat__ = 'restructuredtext' __author__ = "John Eckersberg" __license__ = 'GPLv3+' __version__ = '0.4.0' __url__ = 'https://fedorahosted.org/Taboot/' edit_header = '/usr/share/taboot/edit-header'
mozaik-association/mozaik
mail_job_priority/wizards/mail_compose_message.py
Python
agpl-3.0
1,920
0
# Copyright 2018 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/ag
pl). import ast from odoo import api, exceptions, models, _ class MailComposeMessage(models.TransientModel): _inherit = 'mail.compose.message' @api.model def _get_priorities(self): """ Load priorities from parameters. :return: dict """ key = 'mail.sending.job.prior...
ion to have a understandable error message except (ValueError, SyntaxError): raise exceptions.UserError( _("Error to load the system parameter (%s) " "of priorities") % key) # As literal_eval can transform str into any format, check if we # have a re...
habibmasuro/django-wiki
wiki/plugins/attachments/migrations/0001_initial.py
Python
gpl-3.0
12,406
0.008061
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models try: from django.contrib.auth import get_user_model except ImportError: # django < 1.5 from django.contrib.auth.models import User else: User = get_user_model() user_orm_label...
.gf('django.db.models.fields.related.OneToOneField')(blank=True, related_name='current_set', unique=True, null=True, to=orm['attachments.Attach
mentRevision'])), ('original_filename', self.gf('django.db.models.fields.CharField')(max_length=256, null=True, blank=True)), )) db.send_create_signal('attachments', ['Attachment']) # Adding model 'AttachmentRevision' db.create_table('attachments_attachmentrevision', ( ...
sckasturi/saltlake
commands/time.py
Python
gpl-2.0
1,137
0.003518
# Copyright (C) 2013-20
14 Fox Wilson, Peter Foley, Srijay Kasturi, Samuel Damashek, James Forcier and Reed Koser # # 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)...
BILITY 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, Boston, MA 02110-1301, USA. impor...
infobloxopen/infoblox-netmri
infoblox_netmri/api/remote/models/device_object_object_remote.py
Python
apache-2.0
3,242
0.004318
from ..remote import RemoteModel from infoblox_netmri.utils.utils import check_api_availability class DeviceObjectObjectRemote(RemoteModel): """ Network Objects cross usage | ``DeviceObjectObjectID:`` The internal NetMRI identifier of this usage relationship between network objects. | ``attribute ...
perty @check_api_availability def device(self): """ The device from which this data was collected. ``attribute type:`` model """ return self.broker.device(**{"DeviceObjectObjectID": self.Devi
ceObjectObjectID})
hiidef/hiispider
hiispider/metacomponents/__init__.py
Python
mit
805
0.008696
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Meta level spider components. Eac
h communicates with one or more servers via sub-components. """ from .pagegetter import PageGetter from .worker import Worker from .interface import Interface from .jobgetter import JobGetter from .jobscheduler impo
rt JobScheduler from .identityscheduler import IdentityScheduler from .testing import Testing from .deltatesting import DeltaTesting from .identitygetter import IdentityGetter from .identityworker import IdentityWorker from .identityinterface import IdentityInterface from .base import MetaComponent __all__ = ['PageGet...
pombredanne/SourceForge-Allura
ForgeHg/forgehg/tests/functional/test_controllers.py
Python
apache-2.0
9,128
0.002082
import json import pkg_resources import pylons pylons.c = pylons.tmpl_context pylons.g = pylons.app_globals from pylons import c from ming.orm import ThreadLocalORMSession from datadiff.tools import assert_equal from allura.lib import helpers as h from allura.tests import decorators as td from allura import model as ...
: ci = self._get_ci() resp = self.app.get(ci + 'tree/READMEz', status=404) def test_diff(self):
ci = '/p/test/src-hg/ci/e5a0b44437be783c41084e7bf0740f9b58b96ecf/' parent = '773d2f8e3a94d0d5872988b16533d67e1a7f5462' resp = self.app.get(ci + 'tree/README?barediff=' + parent, validate_chunk=True) assert 'readme' in resp, resp.showbrowser() assert '+++' in resp...
TickSmith/tickvault-python-api
tickvaultpythonapi/parsing/predicate.py
Python
mit
3,342
0.002095
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2017 TickSmith Corp. # # Licensed under the MIT License # # 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, ...
x. '>' results in 'Gte', so that the query will be 'keyGte') "
"" try: return self.opClass.get_str(op) except Exception as e: sys.exit(e) def get_as_kv_pair(self): """ Get as key-value pair (ex. key = 'price', operation = '!=', value = '50', result= {"priceNeq" : "50"}) """ return {self.ke...
Osndok/zim-desktop-wiki
zim/plugins/bookmarksbar.py
Python
gpl-2.0
18,469
0.030646
# -*- coding: utf-8 -*- # Copyright 2015-2016 Pavel_M <[email protected]>, # released under the GNU GPL version 3. # This plugin is for Zim program by Jaap Karssenberg <[email protected]>. # # This plugin uses an icon from Tango Desktop Project (http://tango.freedesktop.org/) # (the Tango base icon theme is re...
bookmarks. self.plus_button = IconsButton(gtk.STOCK_ADD, gtk.STOCK
_REMOVE, relief = False) self.plus_button.set_tooltip_text(_('Add bookmark/Show settings')) self.plus_button.connect('clicked', lambda o: self.add_new_page()) self.plus_button.connect('button-release-event', self.do_plus_button_popup_menu) self.pack_start(self.plus_button, expand = False) # Create widget for...
natewlew/mythtvarchiveserver
setup.py
Python
gpl-2.0
1,038
0.014451
""" :synopsis: Setup :copyright: 2014 Nathan Lewis, See LICENSE.txt .. moduleauthor:: Nathan Lewis <[email protected]> """ __version__ = '0.1' __author__ = 'Nathan Lewis' __email__ = '[email protected]' __license__ = 'GPL Versi
on 2' try: import twisted except ImportError: raise SystemEx
it("twisted not found. Make sure you " "have installed the Twisted core package.") #python-sqlalchemy, python-twisted from setuptools import setup setup( name = "MythTVArchiveServer", version = __version__, author = __author__, author_email = __email__, license = __license__,...