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
CCI-MOC/GUI-Backend
core/tasks.py
Python
apache-2.0
1,847
0.001624
# -*- coding: utf-8 -*- """ Core application tasks """ from celery.decorators import task from django.core.mail import EmailMessage from atmosphere import settings from threepio import celery_logger, email_logger from core.models.status_type import get_status_type @task(name="send_email") def send_email(subject,
body, from_email, to, cc=None, fail_silently=False, html=False): """ Use django.core.mail.EmailMessage to send and log an Atmosphere email. """ try: msg = EmailMessage(subject=subject, body=body, from_email=from_email, to=to,...
{0}\n> To:{1}\n> Cc:{2}\n> Subject:{3}\n> Body:\n{4}" args = (from_email, to, cc, subject, body) email_logger.info(log_message.format(*args)) if getattr(settings, "SEND_EMAILS", True): msg.send(fail_silently=fail_silently) email_logger.info("NOTE: Above message sent succe...
hfp/tensorflow-xsmm
tensorflow/python/kernel_tests/conv1d_test.py
Python
apache-2.0
3,666
0.009547
# 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...
ims(filters, 2) # out_channels # Filters is 2x1x1 for stride in [1, 2]: with self.cached_session(use_gpu=test.is_gpu_available()): c = nn_ops.conv1d(x, filters, stride, padding="VALID") reduced = array_ops.squeeze(c) output = self.evaluate(reduced) if stride ...
3 + 1 * 4]) else: self.assertEqual(len(output), 2) self.assertAllClose(output, [2 * 1 + 1 * 2, 2 * 3 + 1 * 4]) def testConv1DTranspose(self): with self.cached_session(): stride = 2 # Input, output: [batch, width, depth] x_shape = [2, 4, 3] y_shape = [2, ...
madscatt/zazzie_1.5
trunk/sassie/interface/capriqorn_filter.py
Python
gpl-3.0
3,940
0.011168
''' SASSIE: Copyright (C) 2011 Joseph E. Curtis, Ph.D. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
ames : '+pdbfile) return error if dcdfile[-3:] == 'dcd': ev,value=input_filter.chec
k_pdb_dcd(dcdfile,'dcd') value = 0 if(ev == 1): # if the file exists if(value == 0): # not a pdb file # 'checking infile : as dcd' ev,value=input_filter.check_pdb_dcd(dcdfile,'dcd') if(value == 1): cvalue=input_f...
agendaTCC/AgendaTCC
tccweb/apps/website/views.py
Python
gpl-2.0
8,944
0.017008
# -*- coding: utf-8 -*- from django.shortcuts import render_to_response, redirect, render from django.contrib import messages from django.template import RequestContext from django.contrib.auth import forms, authenticate, views, login from django.contrib.auth.decorators import login_required from django import http fro...
ibir_noticias = modelo.exibir_noticias exibir_texto = modelo.exibir_texto exibir_imagens = modelo.exibir_imagens return render_to_response('website/splash.html', { 'imagens':imagens, 'texto': texto, 'exibir_noticias':exibir_noticias, 'exibir_texto': exibir_texto, 'exi...
ens':exibir_imagens, # 'noticias': noticias, }, context_instance=RequestContext(request)) @login_required def dashboard(request): usuario = request.user semestres = request.session.get("semestre") departamentos = Departamento.objects.all() todos_semestres = {} for departamento in ...
limix/glimix-core
glimix_core/mean/_sum.py
Python
mit
2,431
0
from numpy import add from optimix import Function class SumMean(Function): """ Sum mean function, 𝐟₀ + 𝐟₁ + …. The mathematical representation is 𝐦 = 𝐟₀ + 𝐟₁ + … In other words, it is a sum of mean vectors. Example ------- .. doctest:: >>> from glimix_core.mean ...
6 -0.2] >>>
g = mean.gradient() >>> print(g["SumMean[0].effsizes"]) [[ 5.1 1. ] [ 2.1 -0.2]] >>> print(g["SumMean[1].offset"]) [1. 1.] >>> mean0.name = "A" >>> mean1.name = "B" >>> mean.name = "A+B" >>> print(mean) SumMean(means=...): A+B L...
Shouqun/node-gn
tools/depot_tools/third_party/logilab/astroid/brain/pysix_moves.py
Python
mit
8,703
0.000575
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:[email protected] # # This file is part of astroid. # # astroid is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the F...
longest as zip_longest, izip as zip) import htmlentitydefs as html_entities import HT
MLParser as html_parser import httplib as http_client import cookielib as http_cookiejar import Cookie as http_cookies import Queue as queue import repr as reprlib from pipes import quote as shlex_quote import SocketServer as socketserver import SimpleXMLR...
JonasT/pyrsnapshotd
src/pysnapshotd/pipeobject.py
Python
gpl-2.0
4,032
0.001488
# This file is a part of pysnapshotd, a program for automated backups # Copyright (C) 2015-2016 Jonas Thiem # # 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,...
i = 0 while i < self.waiting_for_content_counter:
self.waiting_for_content_semaphore.\ release() i += 1 finally: self.access_mutex.release() def read(self, amount): print(" >> PIPE READ: " + str(amount)) if amount <= 0: print(" >> PIPE READ DATA: <empty read>") ...
DiptoDas8/Biponi
lib/python2.7/site-packages/braintree/exceptions/configuration_error.py
Python
mit
119
0.008403
from braintree.exceptions.unexpected_error import UnexpectedError class ConfigurationError(UnexpectedError): pa
ss
51reboot/actual_09_homework
10/jinderui/cmdb/user/models.py
Python
mit
3,490
0.056291
#coding:utf-8 from dbutils import MySQLConnection class User(object): def __init__(self,id,username,password,age): self.id = id self.username = username self.password = password self.age = age @classmethod def validate_login(self,username,password): _columns = ('id','username') _sql = 'select id,userna...
return False, u'年龄不正确' return True, '' @classmethod def change_user(self,userid,updateage): user_list = self.get_users() for users in user_list: if users['age'] != updateage: _sql = 'update user set age=%s where id =%s' _args = (updateage,userid) MySQLConnection.execute_sql(_sql,_args,Fal...
rname,mpassword): if not self.validate_login(musername,mpassword): return False,"管理员密码错误" if self.get_user(userid) is None: return False, u'用户信息不存在' if len(upassword) <6: return False,u'密码必须大于等于6' return True, '' @classmethod def charge_user_password(self,userid,upassword): _sql = 'update user set...
Yadnyawalkya/integration_tests
cfme/tests/configure/test_tag.py
Python
gpl-2.0
18,479
0.002327
# -*- coding: utf-8 -*- import fauxfactory import pytest from cfme import test_requirements from cfme.cloud.provider import CloudProvider from cfme.infrastructure.provider import InfraProvider from cfme.markers.env_markers.provider import ONE from cfme.markers.env_markers.provider import ONE_PER_CATEGORY from cfme.res...
e.utils.rest import delete_resources_from_collection from cfme.utils.rest import delete_resources_from_detail from cfme.utils.update import update from cfme.utils.
wait import wait_for CLOUD_COLLECTION = [ "availability_zones", "cloud_networks", "cloud_subnets", "flavors", "network_routers", "security_groups", ] INFRA_COLLECTION = [ "clusters", "hosts", "data_stores", "providers", "resource_pools", "services", "service_templat...
fergalmoran/dss
core/realtime/notification.py
Python
bsd-2-clause
928
0.002155
import requests import logging import redis from requests.packages.urllib3.exceptions import ConnectionError from core.serialisers import json from dss import localsettings # TODO([email protected]): refactor these out to # classes to avoid duplicating constants below HEADERS = { 'content-type': 'application/j...
payload
= { 'sessionid': session_id, 'image': image, 'message': message } data = json.dumps(payload) r = requests.post( localsettings.REALTIME_HOST + 'notification', data=data, headers=HEADERS ) if r.status_code == ...
hernejj/vizigrep
vizigrep/guiapp/SuperGtkBuilder.py
Python
gpl-2.0
939
0.005325
import gi gi.require_version('GtkSource', '3.0') from gi.repository import Gtk, GObject, GtkSource # GtkBuilder that will populate the given object (representing a Window) with # all of that window's UI elements as found in the GtkBuilder UI file. class SuperGtkBuilder(Gtk.Builder): def __init__(self, window_obje...
Builder.__init__(self) GObject.type_register(GtkSource.View) # Needed to work with GtkSourceView objects self.add_from_file(ui_file_path) self.populate_window_with_ui_elements(window_object) # Create a data-member in window_object to represent each ui e
lement # found in the GtkBuilder UI file. def populate_window_with_ui_elements(self, window_object): for ui_element in self.get_objects(): if isinstance(ui_element, Gtk.TreeSelection): continue setattr(window_object, Gtk.Buildable.get_name(ui_element), ui_element)
NejcZupec/ggrc-core
src/ggrc_gdrive_integration/migrations/versions/20140912211135_1efacad0fff5_index_for_object_folders.py
Python
apache-2.0
609
0.006568
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICE
NSE file> """Index for object_folders Revision ID: 1efacad0fff5 Revises: 4d7ce1eaddf2 Create Date: 2014-09-12 21:11:35.908034 """ # revision identifiers, used by Alembic. revision = '1efacad0fff5' down_revision = '4d7ce1eaddf2' from alembic import op import sqlalchemy as sa def upgrade(): op.create_index('i...
olderable_id']) pass def downgrade(): op.drop_index('ix_folderable_id_type', table_name='object_folders') pass
dhermes/gcloud-python
videointelligence/synth.py
Python
apache-2.0
2,452
0.002855
# Copyright 2018 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, s...
oud-videointelligence', ).version", ) s.replace( "tests/unit/gapic/**/test_video_intelligence_service_client_*.py", "^(\s+)expected_request = video_intelligence_
pb2.AnnotateVideoRequest\(\)", "\g<1>expected_request = video_intelligence_pb2.AnnotateVideoRequest(\n" "\g<1> input_uri=input_uri, features=features)", ) # ---------------------------------------------------------------------------- # Add templated files # --------------------------------------------------...
devanshdalal/scikit-learn
sklearn/cross_validation.py
Python
bsd-3-clause
72,259
0.000028
""" The :mod:`sklearn.cross_validation` module includes utilities for cross- validation and performance evaluation. """ # Author: Alexandre Gramfort <[email protected]>, # Gael Varoquaux <[email protected]>, # Olivier Grisel <[email protected]> # License: BSD 3 clause fro...
rates integer indices corresponding to test sets.""" raise NotImplementedError def _empty_mask(self): return np.zeros(self.n, dtype=np.bool) class LeaveOneOut(_PartitionIterator): """Leave-One-Out cross validation iterator. .. deprecated:: 0.18 This module will be removed in 0.20...
sed once as a test set (singleton) while the remaining samples form the training set. Note: ``LeaveOneOut(n)`` is equivalent to ``KFold(n, n_folds=n)`` and ``LeavePOut(n, p=1)``. Due to the high number of test sets (which is the same as the number of samples) this cross validation method can be ve...
sio2project/sioworkers
sio/compilers/system_fpc.py
Python
gpl-3.0
500
0.002
from __future__ import absolute_import from sio.compilers.common import Compiler from sio.workers.util import tempcwd class FPCCompiler(Compiler): lang = 'pas'
options = ['-O2', '-XS', '-Xt'] output_file = 'a' def _make_cmdline(self, executor): # Addinational sources are automatically included return ( ['fpc', tempcwd('a.pas')] + self.options +
list(self.extra_compilation_args) ) def run(environ): return FPCCompiler().compile(environ)
zhyu/leetcode
algorithms/largestNumber/largestNumber.py
Python
mit
254
0
class Solution: # @param num, a list of integers # @return a string def largestNumber(self, num): retu
rn ''.join(sorted(map(str, num), cmp=self.cmp)).lstrip('0') or '0' def cmp(self, x, y): return [1,
-1][x + y > y + x]
primaeval/script.tvguide.fullscreen
playwithchannel.py
Python
gpl-2.0
5,207
0.009602
import sys import xbmc,xbmcaddon,xbmcvfs,xbmcgui import sqlite3 import datetime import time import subprocess from subprocess import Popen import re import os,stat def log(what): xbmc.log(repr(what),xbmc.LOGERROR) ADDON = xbmcaddon.Addon(id='script.tvguide.fullscreen') channel = sys.argv[1] start = sys.argv[2] ...
eg_src if ffmpeg: try: st = os.stat(ffmpeg) if not (st.st_mode & stat.S_IXUSR): try: os.chmod(ffmpeg, st.st_mode | stat.S_IXUSR) except: pass except: pass if xbmcvfs.exists(ffmpeg): ...
return ffmpeg else: xbmcgui.Dialog().notification("TVGF", "ffmpeg exe not found!") sqlite3.register_adapter(datetime.datetime, adapt_datetime) sqlite3.register_converter('timestamp', convert_datetime) ADDON.setSetting('playing.channel',channel) ADDON.setSetting('playing.start',start) path = xbmc.transla...
pyexcel/pyexcel-text
.moban.d/setup.py
Python
bsd-3-clause
264
0.045455
{% exten
ds 'setup.py.jj2' %} {%block platform_block%} {%endblock%} {%block additional_keywords%} "plain", "simple", "grid", "pipe", "orgtbl", "rst", "mediawiki", "latex", "latex_booktabs", "html", "json" {%endblock%}
jasimmonsv/CodingExercises
EulerProject/python/problem4.py
Python
gpl-2.0
510
0.033333
#! /usr/bin/python answerx = 0 answery=0 def palindrom(
num): palin='' tmp = str(num) y=0 for x in reversed(range(len(tmp))): palin=palin+str(tmp[x]) y=y+1 return int(palin) for x in range(100,999): for y in range(100,999): if (x * y) == palindrom(x*y):
if x*y > answerx*answery: answerx = x answery = y y=y+1 y=100 x = x+1 print(answerx) print(answery) print(answerx * answery)
Elizaveta239/PyDev.Debugger
tests_python/debugger_fixtures.py
Python
epl-1.0
14,176
0.001975
from contextlib import contextmanager import os import threading import time import pytest from tests_python import debugger_unittest from tests_python.debugger_unittest import get_free_port, overrides, IS_CPYTHON, IS_JYTHON, IS_IRONPYTHON, \ IS_PY3K import sys def get_java_location(): from java.lang impor...
ad(self, uri): outer = self class T(threading.Thread): def run(self): try: from urllib.request import urlopen except ImportError:
from urllib import urlopen for _ in range(10): try: stream = urlopen('http://127.0.0.1:%s/%s' % (outer.django_port, uri)) contents = stream.read() if IS_PY3K: contents ...
py-in-the-sky/challenges
codility/brackets.py
Python
mit
531
0
""" https://cod
ility.com/programmers/task/brackets/ """ from collections import deque def solution(S): q = deque() for char in S: if char in ')]}': if q and are_mirrors(char, q[-1]): q.pop() else: return 0 else: q.append(char) return...
ource == ']': return target == '[' else: return target == '{'
fabiocaccamo/django-admin-interface
admin_interface/migrations/0009_add_enviroment.py
Python
mit
960
0.001042
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(
migrations.Migration): dependencies = [ ("admin_interface", "0008_change_related_modal_background_opacity_type"), ] operat
ions = [ migrations.AddField( model_name="theme", name="env", field=models.CharField( choices=[ ("development", "Development"), ("testing", "Testing"), ("staging", "Staging"), ("pr...
apdavison/space-station-transylvania
xkcd.py
Python
mit
870
0
""" Example taken from http://matplotlib.org/1.5.0/examples/showcase/xkcd.html """ import matplotlib.pyplot as plt import numpy as np
with plt.xkcd(): # Based on "The Data So Far" from XKCD by Randall Monroe # http://xkcd.com/373/ index = [0, 1] data = [0, 100] labels = ['CONFIRMED BY EXPERIMENT', 'REFUTED BY EXPERIMENT']
fig = plt.figure() ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) ax.bar(index, data, 0.25) ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') ax.xaxis.set_ticks_position('bottom') ax.set_xticks([0, 1]) ax.set_xlim([-0.5, 1.5]) ax.set_ylim([0, 110]) ax.set_xtickla...
tickbox-smc-ltd/xfero
src/xfero/test/test_copy_file.py
Python
agpl-3.0
18,198
0.001649
#!/usr/bin/env python '''Test Copy FIle''' import os import shutil import unittest import /xfero/.workflow_manager.copy_file as copy_file class Test(unittest.TestCase): ''' **Purpose:** Unit Test class for the function ```copy_file``` +------------+-------------+-----------------...
file(*args) self.assertEqual(expected, moved_fn, "Not moved correctly") # Ensure file is on os self.assertEqual( os.path.exists(expected) == 1, True, "File not renamed correctly") def test_success_move_targetdir_exists(self): ''' **P
urpose:** Uses the ```move_file``` function to move the file to a new location. The new location exists so there is no need to create it *Test Confirmation* The following assertions are performed: Performs an ```assertEqual``` on the result of the call to ``...
jabbalaci/Bash-Utils
is_net_back.py
Python
mit
866
0.001155
#!/usr/bin/env python3 """ Play a sound when the Internet connection is back. """ import os import socket from pathlib import Path from time import sleep from lib import network from lib.audio import play ROOT = os.path.dirname(os.path.abspath(__file__)) TIMEOUT = 3 AUDIO = str(Path(ROOT, "assets", "alert.wav")) ...
in(): cnt = 0 while True: cnt += 1 print('# testing...' if cnt == 1 else '# test again...') if network.is_internet_on(method=3): print('# Whoa, your net is alive!') play(AUDIO) play(AUDIO) play(AUDIO) break else: ...
sleep(10) ############################################################################# if __name__ == "__main__": socket.setdefaulttimeout(TIMEOUT) main()
bcgov/gwells
app/backend/wells/migrations/0123_retire_wells_sub_class_codes_water_1589.py
Python
apache-2.0
22,630
0.006673
# Generated by Django 2.2.18 on 2021-02-17 22:10 from django.db import migrations # What are we doing in this migration?: # As per WATER-1589 JIRA ticket, we: # - create a new Not Applicable for WATR_SPPLY well_sublclass_code # - retire well_subclass_code = 'SPECIAL' AND well_class_code = 'GEOTECH' # well...
ate, update_user, update_date, well_class_code, description, display_order, effective_date, expiry_date) SELECT '{ETL_USER}', '2017-07-01 08:00:00+00', '{ETL_USER}', '2017-07-01 08:00:00+00', 'WATR_SPPLY', 'Water Supply', 2, '2018-05-17 00:00:00+00', '{DEFAULT_NEVER_EXPIRES_DATE}' WHERE NOT EXISTS (SELECT 1...
Y'); INSERT INTO well_class_code(create_user, create_date, update_user, update_date, well_class_code, description, display_order, effective_date, expiry_date) SELECT '{ETL_USER}', '2017-07-01 08:00:00+00', '{ETL_USER}', '2017-07-01 08:00:00+00', 'MONITOR', 'Monitoring', 4, '2018-05-17 00:00:00+00', '{D...
seblefevre/testerman
plugins/codecs/SoapDigitalSignature.py
Python
gpl-2.0
12,816
0.025523
# -*- coding: utf-8 -*- ## # This file is part of Testerman, a test automation system. # Copyright (c) 2011 Sebastien Lefevre and other contributors # # 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 # Foundat...
Fw0xMzAxMDUxMDM5MjRaMFkxCzAJBgNVBAYTAkZSMQ8wDQYDVQQIEwZGcmFu Y2UxEjAQBgNVBAoTCVRlc3Rlcm1hbjElMCMGA1UEAxMcVGVzdGVybWFuIFdzLVNl Y3VyaXR5IFNhbXBsZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2uzPG3YQ spbOXwHAeIZ17DEhPOKo63DRMU/VYC0L8JwoMPMYI21Wz1srMibpho1lTdWD/Ubs BlrqtAa6MZRaOeGTJ3mXECptHtvtJ
wE7c0RfY+qN15HDMEHy4wvQFBuW1eqHcC23 ha7Slv3mTBqA01afwQYICWG88j3jdEsrUMMCAwEAAaOBvjCBuzAdBgNVHQ4EFgQU 3MarnhFZj6o3UUfblFzxjuVVOH8wgYsGA1UdIwSBgzCBgIAU3MarnhFZj6o3UUfb lFzxjuVVOH+hXaRbMFkxCzAJBgNVBAYTAkZSMQ8wDQYDVQQIEwZGcmFuY2UxEjAQ BgNVBAoTCVRlc3Rlcm1hbjElMCMGA1UEAxMcVGVzdGVybWFuIFdzLVNlY3VyaXR5 IFNhbXBsZYIJAIq7T1myCRCT...
wangyixiaohuihui/spark2-annotation
python/pyspark/ml/__init__.py
Python
apache-2.0
1,130
0.000885
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may n...
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 t...
cense for the specific language governing permissions and # limitations under the License. # """ DataFrame-based machine learning APIs to let users quickly assemble and configure practical machine learning pipelines. """ from pyspark.ml.base import Estimator, Model, Transformer from pyspark.ml.pipeline import...
ssharpjr/loader-controller
examples/lcd_mcp.py
Python
mit
749
0.001335
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Initialize the LCD. import Adafruit_CharLCD as LCD import Adafruit_GPIO.MCP230xx as MCP import RPi.GPIO as io # For standard GPIO
methods. # Define the MCP pins connected to the LCD. lcd_rs = 0 lcd_en = 1 lcd_d4 = 2 lcd_d5 = 3 lcd_d6 = 4 lcd_d7 = 5 lcd_red = 6 lcd_green = 7 lcd_blue = 8 # Define LCD column and row size for a 20x4 LCD. lcd_columns = 20 lcd_rows = 4 # Initialize MCP23017 device using its default 0x20 I2C address. gpio = MCP.MCP2...
e the LCD using the pins. lcd = LCD.Adafruit_RGBCharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_red, lcd_green, lcd_blue, gpio=gpio)
finron/finepy
fine/models/tag.py
Python
bsd-3-clause
1,612
0.00062
# coding: utf-8 ''' tag.py ~~~~~~ ''' from fine import db class Tag(db.Model): __tablename__ = 'tags' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(32), unique=True) weight = db.Column(db.Integer) note = db.Column(db.String(140)) def __init__(self,
*args, **kwargs): super(Tag, self).__init__(*args, **kwargs) def __repr__(self): return '<Tag %d>' % self.id @staticmethod def generate_fake(): rv = ['Python', 'Linux', 'C', 'stackoverflow', 'JavaScript', 'Alogrithms', 'Vim', 'Nginx', 'Flask', ...
t_one(x) if t: t.weight += 1 db.session.commit() continue t = Tag(name=x, weight=i, note='test'+str(i)) db.session.add(t) db.session.commit() @staticmethod def get_posts(self): ''' Get posts ...
olivierdalang/stdm
third_party/FontTools/fontTools/ttLib/tables/T_S_I_J_.py
Python
gpl-2.0
76
0.039474
import asciiTable class table_T_S_
I_J_(asciiTable.asciiTable): pass
Johnzero/OE7
OE-debug文件/oecn_base_fonts/__openerp__.py
Python
agpl-3.0
2,131
0.007977
# -*- encoding: utf-8 -*- # __author__ = [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,...
"description": """ Fonts defined in the default report may not support chara
cters in your language, which may cause jarbled characters in the printed pdf report. This addon will solve abovementioned issue elegently by using openerp customfonts API to replace the original fonts with your seleted fonts. Please click open Settings/Configuration/Configuration Wizards/Conf...
oyamad/QuantEcon.py
quantecon/filter.py
Python
bsd-3-clause
1,768
0.00509
""" function for filtering """ import numpy as np def hamilton_filter(data, h, *args): r""" This function applies "Hamilton filter" to the data http://econweb.ucsd.edu/~jhamilto/hp.pdf Parameters ---------- data : arrray or dataframe h : integer Time hor...
y = np.asarray(data, float) # sample size T = len(y) if len(args) == 1: # if p is supplied p = args[0] # construct X matrix of lags X = np.ones((T-p-h+1, p+1)) for j in range(1, p+1): X[:, j] = y[p-j:T-h-j+1:1] # do OLS regression b ...
p.linalg.solve(X.transpose()@X, X.transpose()@y[p+h-1:T]) # trend component (`nan` for the first p+h-1 period) trend = np.append(np.zeros(p+h-1)+np.nan, X@b) # cyclical component cycle = y - trend elif len(args) == 0: # if p is not supplied (random walk) cycle = np.ap...
orlenko/bccf
src/mezzanine/generic/migrations/0009_auto__del_field_threadedcomment_email_hash.py
Python
unlicense
7,904
0.008097
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'ThreadedComment.email_hash' db.delete_column('generic_threadedcomment', 'email_hash') ...
': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField',
[], {'max_length': '50'}) }, 'auth.user': { 'Meta': {'object_name': 'User'}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 4, 18, 17, 51, 43, 560694)'}), 'email': ('django.db.models.fields.EmailField', [], {'max_leng...
summychou/GGFilm
WeRoBot/myrobot/admin.py
Python
apache-2.0
1,012
0.000988
from django.contrib import admin from models import FilmSearch, Films, Developers, Notes class FilmSearchAdmin(admin.ModelAdmin): list_display = ( "Film",
"Developer", "Dilution", "ASA_ISO", "create_timestamp", "last_update_timestamp", ) list_filter = ( "Film", ) class FilmsAdmin(admin.ModelAdmin): list_display = ( "Film", "create
_timestamp", "last_update_timestamp", ) list_filter = ( "Film", ) class DevelopersAdmin(admin.ModelAdmin): list_display = ( "Developer", "create_timestamp", "last_update_timestamp", ) list_filter = ( "Developer", ) class NotesAdmin(admin.ModelAdmin): list_di...
abpai/mailin-test
python/dkim/canonicalization.py
Python
mit
4,252
0
# This software is provided 'as-is', without any express or implied # warranty. In no event will the author be held liable for any damages # arising from the use of this software. # # Permission is granted to anyone to use this software for any purpose, # including commercial applications, and to alter it and redistri...
append(b'simple') can_headers, can_body = m try: header_algorithm = ALGORITHMS[can_headers] body_algorithm = ALGORITHMS[can_body] except KeyError as e: raise InvalidCanonica
lizationPolicyError(e.args[0]) return cls(header_algorithm, body_algorithm) def to_c_value(self): return b'/'.join( (self.header_algorithm.name, self.body_algorithm.name)) def canonicalize_headers(self, headers): return self.header_algorithm.canonicalize_headers(headers) ...
aterrel/blaze
blaze/serve/server.py
Python
bsd-3-clause
2,462
0.000812
from __future__ import absolute_import, division, print_function from collections import Iterator from flask import Flask, request, jsonify, json from functools import partial, wraps from .index import parse_index class Server(object): __slots__ = 'app', 'datasets' def __init__(self, name='Blaze-Server', da...
lf.datasets = datasets or dict() for args, kwargs, func in routes: func2 = wraps(func)(partial(func, self.datasets)) app.route(*args, **kwargs)(func2) def __getitem__(self, key): return self.datasets[key] def __setitem__(self, key, value): self.datasets[key] = ...
def f(func): routes.append((args, kwargs, func)) return func return f @route('/datasets.json') def dataset(datasets): return jsonify(dict((k, str(v.dshape)) for k, v in datasets.items())) @route('/data/<name>.json', methods=['POST', 'PUT', 'GET']) def data(datasets, name): """ Basic ...
motomizuki/Qlone
app/views/view.py
Python
mit
6,101
0.00359
# -*- coding: utf-8 -*- __author__ = 'hmizumoto' from flask import Blueprint, request, render_template, abort from app.utils import jwt_decode from app.views.auth import check_login, authorized_user, login from app.models import DOMAIN from app import app from app.decoretor import login_required from bson import Object...
target=target, prefix=app.config["APPLICATION_ROOT"]) else: abort(404) @module.route("/tags") @login_required def tags_index(): """ タグ一覧 """ user = authorized_user() model = DOMAIN['items'] tags = model.get_all_tags() return render_template('tags_index.html', user=user, tags=t...
= authorized_user() model = DOMAIN['items'] items = model.get_index({'tags': tag_name}) follower = DOMAIN['users'].get_index({'following_tags': tag_name}) return render_template('tags.html', user=user, items=items, tag_name=tag_name, follower_count=follower['count'], prefix=a...
lesina/labs2016
contests_1sem/8/F.py
Python
gpl-3.0
127
0.015748
d, n
= list(map(int, input().split())) answer = 0 while n%10: if n%10 == d: answer += 1
n //= 10 print(answer)
lefnire/tensorforce
tensorforce/core/optimizers/subsampling_step.py
Python
apache-2.0
4,026
0.002235
# Copyright 2017 reinforce.io. 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...
nput=some_argument)[0] num_samples
= tf.cast( x=(self.fraction * tf.cast(x=batch_size, dtype=util.tf_dtype('float'))), dtype=util.tf_dtype('int') ) num_samples = tf.maximum(x=num_samples, y=1) indices = tf.random_uniform(shape=(num_samples,), maxval=batch_size, dtype=tf.int32) subsampled_arguments...
raamana/pyradigm
pyradigm/__init__.py
Python
mit
792
0.001263
__all__ = [ 'ClassificationDataset', 'RegressionDataset', 'BaseDataset', 'check_compatibility', 'pyradigm', 'MLDataset', 'cli_run'] from sys import version_info if version_info.major >= 3: from pyradigm.base import BaseDataset from pyradigm.classify import Classifi
cationDataset from pyradigm.regress import RegressionDataset from pyradigm.pyradigm import MLDataset, cli_run f
rom pyradigm.multiple import MultiDatasetClassify, MultiDatasetRegress from pyradigm.utils import check_compatibility else: raise NotImplementedError('pyradigm supports only Python 3 or higher! ' 'Upgrade to Python 3+ is recommended.') from ._version import get_versions __version...
frzdian/jaksafe-engine
jaksafe/jaksafe/jakservice/post_processing/dala.py
Python
gpl-2.0
29,206
0.00137
# coding = utf-8 __AUTHOR__ = 'Abdul Somat Budiaji' import logging import os import sys import pandas as pd import numpy as np from qgis.core import NULL import asumsi import config from error import * import hazard import shape logger = logging.getLogger('jakservice.post_processing.dala') class Dala(): """ ...
fh.close() def dala_satu(self, aset): """ Perhitungan DaLA per unit aset """ logger.info('Dala.dala_satu') # input # impact osm atau impact aggregat # matriks asumsi kerusakan # matriks asumsi kerugian impact_file = self.path.impact_...
= self.path.assumption_dir + 'asumsi_kerusakan.csv' rugi_file = self.path.assumption_dir + 'asumsi_kerugian.csv' # raise errro if no file exist if not os.path.isfile(impact_file): raise NoImpactOsmError if not os.path.isfile(agg_file): raise NoImpactAggError ...
vecnet/vnetsource
transmission_simulator/views/IndexView.py
Python
mpl-2.0
1,472
0.003397
# PEP 0263 # -*- coding: utf-8 -*- ######################################################################################################################## # VECNet CI - Prototype # Date: 4/5/2013 # Institution: University of Notre Dame # Primary Authors: # Alexander Vyushkov <[email protected]> #############...
w, passing it a {{ params }} template variable, which is a dictionary of the parameters captured in the URL and modified by get_context_data. """ template_name = 'transmission_simulator/index.html' def get_context_data(self, **kwargs): """ Return a context data dictionary consisting of ...
(IndexView, self).get_context_data() # Add TS version to the {{ params }} template variable # TS version is to be displayed in the page title context['version'] = "v" + transmission_simulator.__version__ # set flag for nav menu activation context['nav_button'] = 'index' ...
davebridges/Lab-Website
projects/models.py
Python
mit
6,048
0.020668
'''This file is the model configuration file for the :mod`projects` app. There is one model in this app, :class:`~projects.models.Project`. ''' from django.db import models from django.template.defaultfilters import slugify from personnel.models import Person from papers.models import Publication class Project(mode...
text="What was the funding agency", blank=True, null=True) start_date = models.DateField(help_text="The start date of this award", blank=True, null=True) end_date = models.DateField(help_text="When this
award ends", blank=True, null=True) summary = models.TextField(help_text="The abstract of the award", blank=True, null=True) full_text = models.TextField(help_text="HTML Formatted full text", blank=True, null=True) publications = models.ManyToManyField(Publi...
EmadMokhtar/Django
tests/model_fields/test_textfield.py
Python
mit
1,367
0.000735
from unittest import skipIf from django import forms from django.db import connection, models from django.test import TestCase from .models import Post class TextFieldTests(TestCase): def test_max_length_passed
_to_formfield(self): """ TextField passes its max_length attribute to form fields created using their formfield() method. """ tf1 = models.TextField() tf2 = models.TextField(max_length=2345) self.assertIsNone(tf1.formfield(
).max_length) self.assertEqual(2345, tf2.formfield().max_length) def test_choices_generates_select_widget(self): """A TextField with choices uses a Select widget.""" f = models.TextField(choices=[('A', 'A'), ('B', 'B')]) self.assertIsInstance(f.formfield().widget, forms.Select) ...
rosix-ru/django-quickapi
quickapi/apps.py
Python
agpl-3.0
1,015
0
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Grigoriy Kramarenko <[email protected]> # # This file is part of QuickAPI. # # QuickAPI 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 (at your option) any later version. # # QuickAPI 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 PARTICULA...
he GNU Affero General Public # License along with QuickAPI. If not, see # <http://www.gnu.org/licenses/>. # from django.apps import AppConfig as BaseAppConfig from django.utils.translation import ugettext_lazy as _ class AppConfig(BaseAppConfig): name = 'quickapi' verbose_name = _('Application Programmin...
certik/pyjamas
examples/libtest/I18N/__init__.py
Python
apache-2.0
680
0.008824
class I18N(object): def example(self): return "This is an example" def another_example(self): return "This is another example" i18n = I18N() locale = 'en' domains = [] import domain domains.append('domain') import domain.subdomain domains.append(
'domain.subdomain') def set_locale(loc): global i18n try: path = "I18N.%s" % loc c = __import__(path) except ImportError, e: print "Failed to import %s" % e domains.sort() for domain in domains: try: path = "I18N.%s.%s" % (domain, loc) __impor...
print "Failed to import %s" % e
IOT-410c/IOT-DB410c-Course-3
Modules/Module_6_Infrared_Sensors/Lesson_3_IR_Remote/IRRemote.py
Python
apache-2.0
3,447
0.015956
from GPIOLibrary import GPIOProcessor import time GP = GPIOProcessor() # GPIO Assignments #Din = 27 #A1 = 34 Green #A2 = 33 White #A3 = 24 Black #A4 = 26 Yellow #PIR = 29 #Ind = 30 Din = GP.getPin27() Din.input() A1 = GP.getPin34() A1.out() A2 = GP.getPin33() A2.out() A3 = GP.getPin24() A...
PIR*M - 0.5*M < counter < n_PIR*M + 0.5*M: if PIR_status == 0: PIR.high() PIR_status = 1 print 'PIR on' else:
PIR.low() PIR_status = 0 print 'PIR off' elif n_90*M - 0.5*M < counter < n_90*M + 0.5*M: FR = 0 x = int(90/1.8) print '90' elif n_R90*M - 0.5*M < counter < n_R90*M + 0.5*M: ...
lmazuel/azure-sdk-for-python
azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/__init__.py
Python
mit
3,596
0.001112
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
es from .kuber
netes_cluster_properties import KubernetesClusterProperties from .system_service import SystemService from .acs_cluster_properties import AcsClusterProperties from .app_insights_properties import AppInsightsProperties from .ssl_configuration import SslConfiguration from .service_auth_configuration import ServiceAuthCon...
parseendavid/Andela-Developer-Challenge---Shopping-List-V2.0
tests/items_test.py
Python
mit
2,665
0.002251
"""TESTS FOR SHOPPING LIST ITEMS""" import unittest from datetime import date from app import shopping_lists_items class TestCasesItems(unittest.TestCase): """TESTS FOR ITEMS CREATION AND BEHAVIOUR""" def setUp(self): self.item = shopping_lists_items.ShoppingListItems() def tearDown(self): ...
ame provided is similar to an existing item """ self.item.list_of_shopping_list_items = [{'user': '[email protected]', 'list': 'Adventure', 'name': 'Snacks'}, ...
'list': 'Adventure', 'name': 'Booze'}] msg = self.item.edit( 'Snacks', 'Booze', 'Adventure', "[email protected]") self.assertEqual(msg, "Name already used on another item") if __name__ == '__main__': unittest.main()
alexhayes/django-async-test
django_async_test/tests/testapp/settings.py
Python
mit
695
0
# -*- coding: utf-8 -*- """ module.name ~~~~~~~~~~~~~~~ Preamble... """ from __future__ import absolute_import, print_function, unicode_literals import json # TEST SETTINGS import random TEST_RUNNER = 'django.test.
runner.DiscoverRunner' # Django replaces this, but it still wants it. *shrugs* DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.admin', 'django.con...
CRET_KEY = '53cr3773rc3553cr3773rc3553cr3773rc3553cr3773rc35'
cbertinato/pandas
pandas/tests/io/msgpack/test_extension.py
Python
bsd-3-clause
2,167
0
import array import pandas.io.msgpack as msgpack from pandas.io.msgpack import ExtType from .common import frombytes, tobytes def test_pack_ext_type(): def p(s): packer = msgpack.Packer() packer.pack_ext_type(0x42, s) return packer.bytes() assert p(b'A') == b'\xd4\x42A' # fixext 1 ...
pe(0x42, b'A' * 0x00012345)) # ext 32 def test_extension_type(): def default(obj): print('default called', obj) if isinstance(obj, array.array): typecode = 123 # application specific typecode data = tobytes(obj) return ExtType(typecode, data) raise Typ...
(obj, )) def ext_hook(code, data): print('ext_hook called', code, data) assert code == 123 obj = array.array('d') frombytes(obj, data) return obj obj = [42, b'hello', array.array('d', [1.1, 2.2, 3.3])] s = msgpack.packb(obj, default=default) obj2 = msgpack.unpa...
Bytewerk/mpdsync
mpdsync.py
Python
gpl-3.0
2,455
0.029735
from mpd import MPDClient from time import sleep import RPi.GPIO as GPIO currentSong = None bingoMPD = None selfMPD = None def setupGPIO(): GPIO.setmode(GPIO.BOARD) GPIO.setup(7, GPIO.IN) def fadeOver(newSong): global selfMPD global bingoMPD oldVol = int(selfMPD.status()["volume"]) #fade out for vol in range(...
len(currentSong) > 0
: print("Remote song changed, syncing...") updateSong(currentSong) else: print("Remote song is empty, skipping...") oldSong = currentSong # If the switch gets toggled from "custom play mode" to "sync mode" then fade over to the current playing song if (currentSwitchState != oldSwitchState): if (curren...
SubhasisDutta/subhasisdutta.com
src/controller/HomeContoller.py
Python
mit
644
0.018634
import webapp2 import os from google.appengine.ext.webapp import template from src.model.WorkModels import Work class HomePage(webapp2.RequestHandler): def get(self): self.response.headers["Content-Type
"]="text/html" publishedWork=Wor
k.gql("WHERE publish=True ORDER BY order ") template_values = { 'pageTitle':"Subhasis Dutta - Profile", 'works':publishedWork } path=os.path.join(os.path.dirname(__file__),'../../template/index.html') page=template...
izapolsk/integration_tests
cfme/intelligence/reports/schedules.py
Python
gpl-2.0
12,942
0.001854
"""Module handling schedules""" import attr from navmazing import NavigateToAttribute from navmazing import NavigateToSibling from widgetastic.exceptions import NoSuchElementException from widgetastic.widget import Checkbox from widgetastic.widget import Text from widgetastic.widget import TextInput from widgetastic.wi...
chedules.is_opened and self.s
chedules.tree.currently_selected == ["All Schedules", self.context["object"].name] ) class ScheduleDetailsView(CloudIntelReportsView): title = Text("#explorer_title_text") schedule_info = SummaryForm("Schedule Info") @property def is_displayed(self): return ( self.in_intel...
rcosnita/fantastico
fantastico/rendering/tests/itest_component_reusage.py
Python
mit
3,406
0.004698
''' Copyright 2013 Cosnita Radu Viorel 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, distribute...
uest) def assert_ok(server): self.assertIsNotNone(self._response) self.assertEqual(200, self._response.getcode()) self.assertEqual("text/html; charset=UTF-8", self._response.info()["Content-Type"]) body = self._response.read().decode() self.assertTr...
rver(retrieve_menu_items, assert_ok)
citrix-openstack-build/keystone
keystone/openstack/common/loopingcall.py
Python
apache-2.0
4,679
0
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Justin Santa Barbara # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may #...
return else:
done.send(True) self.done = done greenthread.spawn(_inner) return self.done
bluestemscott/librarygadget
librarygadget/librarybot/findlibraries/bing_finder.py
Python
mit
1,859
0.003228
import sys import urllib import json import requests class BingApiResult(): def __init__(self, json_result): self.response = json.loads(json_result)['SearchResponse']['Web'] self.total = self.response['Total'] def find_libraries(self): libraries = [] return self.r...
8&Sources=Web&Version=2.0&Market=en-us&Adult=Moderate&Web.Options=DisableQueryAlterations" offset = 0 libraries = [] new_libraries = bing_search(search_terms, base_url, offset)
while len(new_libraries) != 0: libraries.extend(new_libraries) offset += len(new_libraries) new_libraries = bing_search(search_terms, base_url, offset) for library in libraries: print library['Title'] + ',' + library['Url'] if __name__ == '__main__': main()
edisonlz/fruit
web_project/base/site-packages/docutils/parsers/rst/__init__.py
Python
apache-2.0
14,192
0.000141
# $Id: __init__.py 6141 2009-09-25 18:50:30Z milde $ # Author: David Goodger <[email protected]> # Copyright: This module has been placed in the public domain. """ This is ``docutils.parsers.rst`` package. It exports a single class, `Parser`, the reStructuredText parser. Usage ===== 1. Create a parser:: pa...
a single parameter, the option argument (a string or ``None``), validate it and/or convert it to
the appropriate form. Conversion functions may raise `ValueError` and `TypeError` exceptions. - `has_content`: A boolean; True if content is allowed. Client code must handle the case where content is required but not supplied (an empty content list will be supplied). Argume
calben/mcgillbas
mcgillbas/cmdline.py
Python
mit
1,148
0.003484
#!/usr/bin/env python # Copyright (c) 2014 Calem J Bendell <[email protected]> # # 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 ri...
t notice and this permission notice shall be included in all # copies or substantia
l portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAM...
brabemi/sw_config_backup
sw_config_backup.py
Python
gpl-2.0
5,888
0.031929
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # vim:set sw=4 ts=4 et: import sys import pexpect import threading import os import shutil import logging import time import configparser import ast import subprocess def backup(switch, server): if switch['type'].lower() == '3com': return backup_3com(switch, server) ...
Connection failed(%s)\n \t%s" % (switch['name'], ssh.before)) return 1 try: ssh.sendline('%s' % switch['password']) logging.debug('%s: authenticating username: %s' % (switch['name'], switch['username'])) ssh.expect('>') except: logging.error("Authorization failed(%s)\n \tusername: %s" % (switch['name'], sw...
p-configuration to %s %s.cfg" % (server, switch['name'])) logging.debug('%s: backuping to server: %s' % (switch['name'], server)) ssh.expect('finished!\s+<.*>',timeout=30) ssh.sendline('quit') except: logging.error("Backup failed(%s)\n \t%s" % (switch['name'], ssh.before)) return 3 logging.info("Configurat...
pford68/nupic.research
sensorimotor/sensorimotor/sensorimotor_experiment_runner.py
Python
gpl-3.0
9,403
0.006594
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
ixin) class MonitoredGeneralTemporalMemory(TemporalMemoryMonitorMixin, GeneralTemporalMemory): pass class MonitoredTemporalPooler(TemporalPoolerMonitorMixin, TemporalPooler): pas
s """ Experiment runner class for running networks with layer 4 and layer 3. The client is responsible for setting up universes, agents, and worlds. This class just sets up and runs the HTM learning algorithms. """ realDType = GetNTAReal() class SensorimotorExperimentRunner(object): DEFAULT_TM_PARAMS = { #...
jackromo/RandTerrainPy
randterrainpy/terraindisplay.py
Python
mit
3,444
0.001452
"""Module for displaying Terrain, both in 2D and 3D. (Not accessible outside of package; use display methods of Terrain instead.) """ from Tkinter import Tk, Canvas, Frame, BOTH from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np class Terrain2D(Frame): """2D graphical re...
Args: terrain (Terrain): Terrain to display. """ root = Tk() dim
ensions = "{0}x{1}".format(terrain.width * Terrain2D.SQUARE_SIDE, terrain.length * Terrain2D.SQUARE_SIDE) root.geometry(dimensions) app = Terrain2D(root, terrain) root.mainloop() def __init__(self, parent, terrain): """Make self child of a TK pa...
zgchizi/oppia-uc
extensions/interactions/GraphInput/GraphInput.py
Python
apache-2.0
3,179
0
# coding: utf-8 # # Copyright 2014 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
oftwar # 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 extensions.interact
ions import base class GraphInput(base.BaseInteraction): """Interaction for evaluating graphs.""" name = '几何图形' description = '允许创建多种几何图形' display_mode = base.DISPLAY_MODE_SUPPLEMENTAL is_trainable = False _dependency_ids = [] answer_type = 'Graph' instructions = '创建几何图形' narrow_i...
NickDaly/GemRB-MultipleConfigs
gemrb/GUIScripts/bg2/LoadScreen.py
Python
gpl-2.0
1,632
0.026961
# -*-python-*- # GemRB - Infinity Engine Emulator # Copyright (C) 2003-2004 The GemRB Project # # 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 opt...
GemRB.LoadTable ("loadhint") tmp = Table.GetRowCount () tmp = GemRB.Roll (1,tmp,0) HintStr = Table.GetValue (tmp, 0) TextArea = LoadScreen.GetControl (2) TextArea.SetText (HintStr) Bar = LoadScreen.GetControl (0) Bar.SetVarAssoc ("Progre
ss", Progress) LoadScreen.SetVisible (WINDOW_VISIBLE)
nngroup/django-pagebits
pagebits/migrations/0002_page_include_in_search.py
Python
bsd-3-clause
401
0
# -*- coding: utf-8 -*- from
__future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pagebits', '0001_initial'), ] operations = [ migrations.AddField( model_name='page', name='include_in_search',
field=models.BooleanField(default=True), ), ]
Manolaru/Python_Mantis
Working version/test/test_add_project.py
Python
apache-2.0
614
0.011401
from model.project import Project def test_add_project(app): project=Project(name="students_project", description="ab
out Project") try: ind = app.project.get_project_list().index(project) app.project.delete_named_project(project) except ValueError: pass old_projects = app.project.get_project_list() app.project.create(project) new_projects = app.project.get_project_list() assert len(old_...
_projects,key=Project.id_or_max)
phvu/nervanagpu
benchmarks/minibatch_layout_diff.py
Python
apache-2.0
3,364
0.01308
#!/usr/bin/python # Copyright 2014 Nervana Systems 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 req...
cuda import cublas print(context.get_device().name
()) ng = NervanaGPU(stochastic_round=False, bench=True) handle = cublas.cublasCreate() start, end = (drv.Event(), drv.Event()) def cublas_dot(op, A, B, C, repeat=1, warmup=False): lda = A.shape[0] ldb = B.shape[0] ldc = C.shape[0] m = C.shape[0] n = C.shape[1] k = A.shape[1] if op[0] == 'n...
ttgc/TtgcBot
src/utils/converters.py
Python
gpl-3.0
4,827
0.016988
#!usr/bin/env python3.7 #-*-coding:utf-8-*- ## TtgcBot - a bot for discord ## Copyright (C) 2017 Thomas PIOT ## ## This program is fre
e software: you can redistribute it and/or modify ## it und
er the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of #...
proyectosdeley/proyectos_de_ley
proyectos_de_ley/stats/migrations/0002_dispensed.py
Python
mit
1,175
0.005106
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('stats', '0001_initial'), ] operations = [ migrations.CreateModel( name='Dispensed', fields=[ ...
('dispensed_by_spokesmen', models.Inte
gerField(help_text='Those projects dispensed due to `junta de portavoces`.')), ('dispensed_others', models.IntegerField(help_text='All other projects dispensed, and those with no specific reason.')), ], options={ }, bases=(models.Model,), ), ]
leojohnthomas/ahkab
mosq.py
Python
gpl-2.0
18,308
0.032936
# -*- coding: iso-8859-1 -*- # mosq.py # Implementation of the square-law MOS transistor model # Copyright 2012 Giuseppe Venturini # # This file is part of the ahkab simulator. # # Ahkab is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the...
lf.get_ports()) time: the simulation time at which the evaluation is performed. Set it to None during DC analysis. """ assert op_index == 0 assert port_index < 3 if port_index == 0: g = self.mosq_model.get_gmd(self.device, ports_v, self.opdict) elif port_index == 1: g = self.mosq_model.get_gm...
elf.device, ports_v, self.opdict) if op_index == 0 and g == 0: if port_index == 2: sign = -1 else: sign = +1 g = sign*options.gmin*2 #print type(g), g if op_index == 0 and port_index == 0: self.opdict.update({'gmd':g}) elif op_index == 0 and port_index == 1: self.opdict.update({'gm':g}...
skuschel/postpic
postpic/datahandling.py
Python
gpl-3.0
89,742
0.002518
# # This file is part of postpic. # # postpic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # postpic is distributed in the hope th...
self._n = kwargs.pop('n', None) # kwargs must be exhausted now if len(kwargs) > 0: raise TypeError('got an unexpcted keyword argument "{}"'.format(kwargs)) if self._grid_node is None: if self._grid is None: if self._extent is None or self._n is None: ...
r("Missing required arguments for Axis construction.") # only extent and n have been passed, use that to create a linear grid_node self._grid_node = np.linspace(self._extent[0], self._extent[-1], self._n+1, endpoint=True) else: ...
mudream4869/imaginary-city
admin/app.py
Python
apache-2.0
3,380
0
import tornado.ioloop import tornado.web import os import json import datetime from blogpost import BlogpostHandler from image import ImageHandler from setting import SettingHandler class DateTimeEncoder(json.JSONEncoder): def default(self, o): # pylint: disable=E0202 if isinstance(o, datetime.datetime...
e") ImageHandler.inst.uploadImage( filepath, filename, upload_file['body']) elif method == "deleteImage": filename = self.get_argument("filename") ImageHandler.inst.deleteImage(filepath, file
name) _settings = { "static_path": os.path.join(os.path.dirname(__file__), "static"), "template_path": os.path.join(os.path.dirname(__file__), "templ"), "autoreload": True, "debug": True } application = tornado.web.Application([ (r"/blog/(.*)", BlogServer), (r"/setting/(.*)", SettingServer),...
catlee/hashsync
upload.py
Python
bsd-3-clause
2,595
0.003854
#!/usr/bin/env python # -*- coding: utf-8 -*- from hashsync.connection import connect from hashsync.transfer import upload_directory import logging log = logging.getLogger(__name__) def main(): import argparse import sys import gzip parser = argparse.ArgumentParser() # TODO: These aren't require...
output_file = sys.stdout else: output_file = open(args.output, 'wb') # Enable compression by default if we're writing out to a file if args.compress_manifest is None: args.compress_manifest = True if args.compress_manifest: output_file = gzip.GzipFile(fileob...
dupes() if __name__ == '__main__': main()
PanDAWMS/autopyfactory
autopyfactory/plugins/queue/sched/StatusOffline.py
Python
apache-2.0
2,304
0.011285
#! /usr/bin/env python # from autopyfactory.interfaces import SchedInterface import logging class StatusOffline(SchedInterface): id = 'statusoffline' def __init__(self, apfqueue, config, section): try: self.apfqueue = apfqueue self.log = logging.getLogger(...
'sched.statusoffline.pilots', 'getint', default_value=0) self.log.debug("SchedPlugin: Object initialized.") except Excep...
calcSubmitNum(self, n=0): self.log.debug('Starting.') self.wmsqueueinfo = self.apfqueue.wmsstatus_plugin.getInfo( queue=self.apfqueue.wmsqueue) self.siteinfo = self.apfqueue.wmsstatus_plugin.getSiteInfo( site=self.apfqueue...
Logan213/is210-week-04-warmup
task_05.py
Python
mpl-2.0
452
0
#!/usr/bin/env python # -*- coding: utf-8 -*- """Blood Pressure Reading""" MYINPUT = raw_input('What is your blood pressure? ') MYINPUT = int(MYINPUT) if MYINPUT <= 89: BP_STATUS = 'Low' elif 89 < MYINPUT <= 119: BP_STATUS = 'Ideal' elif 119 < MYINPUT <= 139: BP_STATUS = 'Warning' elif 139 < MYINPUT <= 15...
T
michalkurka/h2o-3
h2o-py/tests/testdir_algos/gam/pyunit_PUBDEV_7367_random_gridsearch_generic.py
Python
apache-2.0
3,832
0.010177
from __future__ import division from __future__ import print_function from past.utils import old_div import sys sys.path.insert(1, "../../../") import h2o from tests import pyunit_utils from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator from h2o.grid.grid_search import H2OGridSearch # In this test, we chec...
)) def train_models(self): self.h2o_model = H2OGridSearch(H2OGeneral
izedAdditiveEstimator(family="gaussian", keep_gam_cols=True), hyper_params=self.hyper_parameters, search_criteria=self.search_criteria) self.h2o_model.train(x = self.myX, y = self.myY, training_frame = self.h2o_data) for model in sel...
RedbackThomson/LoLAlerter
lolalerter/twitchalerts/DonateTracker.py
Python
mit
2,854
0.0459
''' LoLAlerter: Every LoL partner's pal Copyright (C) 2015 Redback This file is part of LoLAlerter ''' import json import threading import time import urllib.error from alerterredis import AlerterRedis from logger import Logger import constants as Constants class DonateTracker(object): ''' The DonateTracker is...
Fetches a list of the latest donations :param count: The amount of donations to fetch :param key: The auth key for the TwitchAlerts API ''' url = str(Constants.TWITCHALERTS_URI).format(token=key) try: opener = urllib.request.build_opener() opener.addheaders = [('User-agent', 'LoLAlerter')] o...
s(response.decode('utf8'))[:count] except urllib.error.HTTPError as e: if(e.code != 404): Logger().get().exception(e) return [] except urllib.error.URLError as e: Logger().get().exception(e) return [] @staticmethod def parse_donations(response): ''' Parses the TwitchAlerts API JSON i...
Mega-DatA-Lab/mxnet
tests/python/unittest/test_multi_device_exec.py
Python
apache-2.0
3,000
0.013
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
ymbol.SoftmaxOutput(data = dot, name = 'softmax') set_stage2 = set(softmax.list_arguments()) - set_stage1 group2ctx = { 'stage1' : mx.cpu(1), 'stage2' : mx.cpu(2) } texec = softmax.simple_bind(mx.cpu(0), group2ctx=group2ctx, lhs=(32,200), rhs=(200, 5)) ...
in zip(texec.arg_arrays, softmax.list_arguments()): if name in set_stage1: assert arr.context == group2ctx['stage1'] else: assert arr.context == group2ctx['stage2'] if __name__ == '__main__': test_ctx_group() test_ctx_group_sparse()
erdc/proteus
scripts/pyadhRunSSO.py
Python
mit
19,696
0.013201
from __future__ import print_function ## Automatically adapted for numpy.oldnumeric Apr 14, 2008 by -c #! /usr/bin/env python from future import standard_library standard_library.install_aliases() from builtins import str from builtins import input from builtins import zip from builtins import range import os ## need...
() if len(filenames) == 2: pList.append(__import__(filenames[0][:-3])) pNameList.append(filenames[0][:-3]+filenames[1][:-3]) nList.append(__import__(filenames[1][:-3])) if opts.batchFileName != "": inputStream = open(opts.batchFileName,'r') else: input...
tream = sys.stdin pNameAll = '' for pName in pNameList: pNameAll+=pName if opts.logLevel > 0: Profiling.openLog(pNameAll+".log",opts.logLevel) if opts.viewer: Viewers.viewerOn(pNameAll,opts.viewer) running = True while running: if opts.interactive: use...
jeremybanks/stack-suggestions-bot
src/stackexchange/stackexchange.py
Python
mit
2,984
0
import json import requests from .site import Site from .errors import APIError class StackExchange(object): """ A simple wrapper for the Stack Exchange API V2.2. This doesn't consider rate limiting or any important things like that. Careless use could result in being blocked. This doesn't sup...
, site_data) sites[site.api_site_parameter] = site # maps from site API identifiers to Site objects self.sites = sites def _request(self, path, site=None, object_hook=None, **kwargs): url = self.API_ROOT + path params = dict(kwargs) # The "unsafe" mode returns...
t aren't # included by default. Ideally, we may want to create a custom # filter returning what we actually know how to use. params['filter'] = 'unsafe' if site: params['site'] = site if self._key: params['key'] = self._key response = requests.g...
hzlf/openbroadcast.org
website/base/templatetags/daterange_tags.py
Python
gpl-3.0
201
0
import datetime from django import template register = template.Library() @register.filter def
xxxx_to_now(value): value = int(value) return range(va
lue, datetime.datetime.now().year + 2)
SaschaMester/delicium
build/get_landmines.py
Python
bsd-3-clause
3,458
0.010989
#!/usr/bin/env python # Copyright 2013 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. """ This file emits the list of reasons why a particular build needs to be clobbered (or a list of 'landmines'). """ import sys impor...
dding a # landmine. if (distributor() == 'goma' and platform() == 'win32' and builder() == 'ninja'): print 'Need to clobber winja goma due to backend cwd cache fix.' if platform() == 'android': print 'Clobber: to handle new way of suppressing findbugs failures.' print 'Clobber to fix gyp not re...
ux' and builder() == 'ninja': print 'Builders switching from make to ninja will clobber on this.' if platform() == 'mac': print 'Switching from bundle to unbundled dylib (issue 14743002).' if platform() in ('win', 'mac'): print ('Improper dependency for create_nmf.py broke in r240802, ' 'fixe...
Dima73/pli-openmultibootmanager
src/ubi_reader/ubi_io/__init__.py
Python
gpl-2.0
5,452
0.00055
#!/usr/bin/env python ############################################################# # ubi_reader/ubi_io # (c) 2013 Jason Pruitt ([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 Founda...
d) return buf class leb_virtual_file(): def __init__(self, ubi, volume): self._ubi = ubi self._volume = volume self._blocks = sort.by_leb(
self._volume.get_blocks(self._ubi.blocks)) self._seek = 0 self.leb_data_size = len(self._blocks) * self._ubi.leb_size self._last_leb = -1 self._last_buf = '' def read(self, i): buf = '' leb = int(self.tell() / self._ubi.leb_size) offset = self.tell() % self._...
timothycrosley/pies
pies2overrides/html/parser.py
Python
mit
65
0
from
__future__ import absolute_import from HTMLParser imp
ort *
TouchBack/leap-gl-test
gl.py
Python
gpl-3.0
3,061
0.031036
from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * import Leap from Leap import * from time import sleep window = 0
# glut window number width, height = 800, 600
# window size x,y = 0,0 leap = None r = 1.0 g = 0.0 b = 0.0 def draw_rect(x, y, width, height): glBegin(GL_QUADS) # start drawing a rectangle glVertex2f(x, y) # bottom left point glVertex2f(x + width, y) ...
abhattad4/Digi-Menu
tests/model_fields/tests.py
Python
bsd-3-clause
35,232
0.000539
from __future__ import unicode_literals import datetime import unittest from decimal import Decimal from django import forms, test from django.core import checks, validators from django.core.exceptions import ValidationError from django.db import IntegrityError, connection, models, transaction from django.db.models.f...
lse) self.assertFalse(form_field.show_hidden_initial) def test_nullbooleanfield_blank(self): """ Regression test for #13071: NullBooleanField should not throw a validation error when given a value of None. """ nullboolean = NullBoolea
nModel(nbfield=None) try: nullboolean.full_clean() except ValidationError as e: self.fail("NullBooleanField failed validation with value of None: %s" % e.messages) def test_field_repr(self): """ Regression test for #5931: __repr__ of a field also displays its...
ldjebran/robottelo
robottelo/cli/module_stream.py
Python
gpl-3.0
494
0
# -*- encoding: utf-8 -*- """ Usage:: hamm
er module-stream [OPTIONS] SUBCOMMAND [ARG] ... Parameters:: SUBCOMMAND subcommand [ARG] ... subcommand arguments Subcommands:: info Show a module-stream list List module-streams """ from robottelo.cli.base impo...
le-stream'
archangd/leetcode
1.two_sum.py
Python
lgpl-3.0
350
0
class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ temp = {} for i, n in enumerate(nums): if (target - n) in temp: return [temp[target
- n], i] else: temp[n] = i
Endika/hr
hr_report_payroll_attendance_summary/wizard/__init__.py
Python
agpl-3.0
850
0
# -*- coding:utf-8 -*- # # # Copyright (C) 2013 Michael Telahun Makonnen <[email protected]>. # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, eit...
sion 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...
# from . import attendance_summary
City-of-Helsinki/devheldev
users/models.py
Python
agpl-3.0
107
0
from django.db import models from helusers.m
odels import AbstractUser
class User(AbstractUser): pass
LxMLS/lxmls-toolkit
lxmls/sequences/bak/basic_feature.py
Python
mit
2,225
0
import id_feature as idf class BasicFeatures(idf.IDFeatures): def __init__(self, dataset): idf.IDFeatures.__init__(self, dataset) # def add_next_word_context_feature(self,next_word,tag,idx): # feat = "next_word:%s::%s"%(next_word,tag) # nr_feat = self.add_feature(feat) #
idx.append(nr_feat) # return idx # def add_prev_word_context_feature(self,prev_word,tag,idx): # feat = "prev_word:%s::%s"%(prev_word,tag) # nr_feat = self.add_feature(feat) # idx.append(nr_feat) #
return idx def add_node_feature(self, seq, pos, y, idx): x = seq.x[pos] word = self.dataset.int_to_word[x] if self.dataset.word_counts[x] > 5: y_name = self.dataset.int_to_pos[y] word = self.dataset.int_to_word[x] feat = "id:%s::%s" % (word, y_name) ...
rohitranjan1991/home-assistant
homeassistant/components/homekit_controller/lock.py
Python
mit
4,317
0.000695
"""Support for HomeKit Controller locks.""" from __future__ import annotations from typing import Any from aiohomekit.model.characteristics import CharacteristicsTypes from aiohomekit.model.services import Service, ServicesTypes from homeassistant.components.lock import STATE_JAMMED, LockEntity from homeassistant.co...
M_CURRENT_STATE) if CURRENT_STATE_MAP
[value] == STATE_UNKNOWN: return None return CURRENT_STATE_MAP[value] == STATE_LOCKED @property def is_locking(self) -> bool: """Return true if device is locking.""" current_value = self.service.value( CharacteristicsTypes.LOCK_MECHANISM_CURRENT_STATE ) ...
vv-p/jira-reports
filters/filters.py
Python
mit
977
0.009212
import re import os def g
et_emoji_content(filename): full_filename = os.path.join(os.path.dirname(__file__), 'emojis', filename) with open(full_filename, 'r') as fp: return fp.read() def fix_emoji(value): """ Replace some text emojis with pictures """ emojis = { '(+)': get_emoji_content('plus.html'), ...
ion.html'), '(!)': get_emoji_content('alarm.html'), '(/)': get_emoji_content('check.html'), } for e in emojis: value = value.replace(e, emojis[e]) return value def cleanup(value): """ Remove {code}...{/code} and {noformat}...{noformat} fragments from worklog comment :pa...
kpbochenek/empireofcode
common_words.py
Python
apache-2.0
640
0.009375
#[email protected] def common_words(first, second): dd = set(
) for s in first.split(","): dd.add(s) return ",".join(sorted([w for w in second.split(",") if w in dd])) if __name__ == '__main__': # These "asserts" using only for self-checking and not necessary for auto-testing assert common_words("hello,world", "hello,earth") == "hello", "Hello" assert common...
3" print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")
jrg365/gpytorch
gpytorch/likelihoods/likelihood_list.py
Python
mit
1,999
0.004002
#! /usr/bin/env python3 from torch.nn import ModuleList from gpytorch.likelihoods import Likelihood def _get_tuple_args_(*args): for arg in args: if isinstance(arg, tuple): yield arg else: yield (arg,) class LikelihoodList(Likelihood): def __init__(self, *likelihood...
args_, noise_ in zip(self.li
kelihoods, _get_tuple_args_(*args), noise) ] else: return [ likelihood.forward(*args_, **kwargs) for likelihood, args_ in zip(self.likelihoods, _get_tuple_args_(*args)) ] def pyro_sample_output(self, *args, **kwargs): return [ ...
unomena/django-saml2-sp
saml2sp/xml_render.py
Python
bsd-3-clause
899
0.002225
""" Functions for creating XML output. """ import logging import string from xml_signing import get_signature_xml from xml_templates import AUTHN_REQUEST def _get_authnrequest_xml(template, parameters, signed=False): # Reset signature. params = {} params.update(parameters) params['AUTHN_REQUEST_SIGNATU...
_xm
l(AUTHN_REQUEST, parameters, signed)
Distrotech/bzr
bzrlib/tests/test_selftest.py
Python
gpl-2.0
153,857
0.002145
# Copyright (C) 2005-2011 Canonical Ltd # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distribute...
tests, transport, workingt
ree, workingtree_3, workingtree_4, ) from bzrlib.repofmt import ( groupcompress_repo, ) from bzrlib.symbol_versioning import ( deprecated_function, deprecated_in, deprecated_method, ) from bzrlib.tests import ( features, test_lsprof, test_server, TestUtil, ) from ...
sixuanwang/SAMSaaS
wirecloud-develop/src/wirecloud/platform/wiring/utils.py
Python
gpl-2.0
2,913
0.003434
# -*- coding: utf-8 -*- # Copyright (c) 2012-2014 CoNWeT Lab., Universidad Politécnica de Madrid # This file is part of Wirecloud. # Wirecloud 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 v...
view_available and ('iwidgets' in wiring['views'][0]) and (iwidget.id in wiring['views'][0]['iwidgets']): del wiring['views'][0]['iwidgets'][iwidget.id] connection_view_available = view_available and 'connections' in wiring['views'][0] for connection in connections_to_remove: wiring['connection...
'views'][0]['connections']) > connection['index']: del wiring['views'][0]['connections'][connection['index']] def get_operator_cache_key(operator, domain, mode): return '_operator_xhtml/%s/%s/%s?mode=%s' % (operator.cache_version, domain, operator.id, mode) def generate_xhtml_operator_code(js_files,...