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
RPiPasswordGenerator/Twitter-Password-Generator-for-Python
auth.py
Python
apache-2.0
672
0
#!/usr/bin/env python # Copyright 2014 RPiPasswordGenerator # file: auth.py # This file just needs to be run. import tweepy import sys CONSUMER_KEY = 'aLrazWkhGaRyLe30HWZcCJrnN' CONSUMER_SECRET = 'jNSbrJ9TkOobJTbzL4bfd7CWg5x0kv6KMLCZKO5FRAMdIaFvmK' auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.sec...
.get_authorization_url() print 'Please visit this URL, to get your access key: ' + auth_url verifier = raw_input('PIN: ').strip() auth.get_access_token(verifier) print "\nPlease put these codes where asked, in run.py\n" print "ACCESS_KEY = '%s'" % auth.access_token.key print "ACCESS
_SECRET = '%s'" % auth.access_token.secret
jithinbp/vLabtool-v0
v0/apps/scope.py
Python
gpl-3.0
18,018
0.051116
#!/usr/bin/python ''' oscilloscope for the vLabtool - version 0. \n Also Includes XY plotting mode, and fitting against standard Sine/Square functions\n ''' import os os.environ['QT_API'] = 'pyqt' import sip sip.setapi("QString", 2) sip.setapi("QVariant", 2) from PyQt4 import QtCore, QtGui import time,sys from v0.t...
="color: #FFF; font-size: 8pt;">
'+c+'</span></div>' def showgrid(self): return def start_capture(self): if self.finished: return if(self.freezeButton.isChecked()): self.timer.singleShot(200,self.start_capture) return temperature=self.I.get_temperature() self.plot.setTitle('%0.2f fps, %0.1f ^C' % (self.fps,temperature ) ) ...
elliotthill/django-oscar
sites/sandbox/apps/gateway/views.py
Python
bsd-3-clause
1,784
0.001121
import logging from django.views import generic from django.contrib.auth.models import User from django.contrib import messages from django.core.mail import send_mail from django import http from django.core.urlresolvers import reverse from django.template.loader import get_template from django.template import Context...
() email = 'dashboard-user-%[email protected]' % username user = self.create_dashboard_user(username, email, password) self.send_confirmation_email(real_email, user, password) logger.info("Created dashboard user #%d for %s",
user.id, real_email) messages.success( self.request, "The credentials for a dashboard user have been sent to %s" % real_email) return http.HttpResponseRedirect(reverse('gateway')) def create_dashboard_user(self, username, email, password): user = User.obj...
NeostreamTechnology/Microservices
venv/lib/python2.7/site-packages/connexion/cli.py
Python
mit
5,463
0.002014
import logging import sys from os import path import click from clickclick import AliasedGroup, fatal_error import connexion from connexion.mock import MockResolver logger = logging.getLogger('connexion.cli') CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) def validate_wsgi_server_requirements(ctx, par...
swagger_path=console_ui_from or None,
swagger_url=console_ui_url or None, auth_all_paths=auth_all_paths, debug=debug) app.add_api(spec_file_full_path, base_path=base_path, resolver_error=resolver_error, validate_respo...
kaspermarstal/SuperElastix
ContinuousRegistration/Source/make_evaluation.py
Python
apache-2.0
4,367
0.007786
import os, json, datetime from ContinuousRegistration.Source.make_registration_scripts import parser from ContinuousRegistration.Source.util import logging, load_submissions, write_json from ContinuousRegistration.Source.datasets import load_datasets def run(parameters): submissions = load_submissions(parameters) ...
'-ml', type=bool, default=False, help="Warp moving labels.") parser.add_argument('--make-difference-images', '-m
di', type=bool, default=False, help="Warp moving images and subtract from fixed images.") parser.add_argument('--make-checkerboards', '-mc', type=bool, default=False, help="Warp checkerboard pattern.") parser.add_argument('--make-image-checkerboards', '-mic', type=bool, default=False, he...
mbdriscoll/asp-old
specializers/stencil/stencil_python_front_end.py
Python
bsd-3-clause
6,699
0.00627
"""Takes a Python AST and converts it to a corresponding StencilModel. Throws an exception if the input does not represent a valid stencil kernel program. This is the first stage of processing and is done only once when a stencil class is initialized. """ from stencil_model import * from assert_utils import * import ...
honFrontEnd(ast.NodeTransformer): def __init__(self): super(StencilPythonFrontEnd, self).__init__() def parse(self, ast): return self.visit(ast) def visit_Module(self, node): body = map(self.visi
t, node.body) assert len(body) == 1 assert_has_type(body[0], StencilModel) return body[0] def visit_FunctionDef(self, node): assert len(node.decorator_list) == 0 arg_ids = self.visit(node.args) assert arg_ids[0] == 'self' self.output_arg_id = arg_ids[-1] ...
voiceofrae/Python
antivowel.py
Python
mit
201
0.0199
import re def anti_vowel(text):
newtext = re.sub('[AEIOUaeiou]', '', text) print newtext anti_vowel("Hey Look Words!") anti_vowel("THE QUICK BROWN FOX SLYLY JUMPED OVER TH
E LAZY DOG")
SINGROUP/pycp2k
pycp2k/classes/_check_spline3.py
Python
lgpl-3.0
674
0.002967
from pycp2k.inputsecti
on import InputSection from ._each295 import _each295 class _check_spline3(InputSection): def __init__(self): InputSection.__init__(self) self.Section_parameters = None self.Add_last = None self.Common_iteration_levels = None self.Filename = None self.Log_print_k
ey = None self.EACH = _each295() self._name = "CHECK_SPLINE" self._keywords = {'Log_print_key': 'LOG_PRINT_KEY', 'Filename': 'FILENAME', 'Add_last': 'ADD_LAST', 'Common_iteration_levels': 'COMMON_ITERATION_LEVELS'} self._subsections = {'EACH': 'EACH'} self._attributes = ['Section...
UQ-UQx/PerspectivesX
perspectivesx_project/django_auth_lti/tests/test_verification.py
Python
mit
1,706
0.005862
from unittest import TestCase from mock import MagicMock from django_auth_lti.verification import is_allowed from django.core.exceptions import ImproperlyConfigured, PermissionDenied class TestVerification(TestCase): def test_is_allowed_config_failure(self): request = MagicMock(LTI={}) allowed...
wed_success_one_role(self): request = MagicMock(LTI={"roles": ["admin"]}) allowed_roles = "admin" user_is_allowed = is_allowed(request, allowed_roles, False) self.assertTrue(user_is_allowed) def test_is_allowed_failure(self): request = MagicMock(LTI={"roles":[]}) ...
ser_is_allowed = is_allowed(request, allowed_roles, False) self.assertFalse(user_is_allowed) def test_is_allowed_failure_one_role(self): request = MagicMock(LTI={"roles":[]}) allowed_roles = "admin" user_is_allowed = is_allowed(request, allowed_roles, False) self.assertF...
huahbo/pyamg
pyamg/util/utils.py
Python
mit
65,500
0.000031
"""General utility functions for pyamg""" __docformat__ = "restructuredtext en" from warnings import warn import numpy as np import scipy as sp from scipy.sparse import isspmatrix, isspmatrix_csr, isspmatrix_csc, \ isspmatrix_bsr, csr_matrix, csc_matrix, bsr_matrix, coo_matrix, eye from scipy.sparse.sputils impo...
np.asarray(A.data, dtype=upcast(A.dtype, v.dtype)) else: v = np.asarray(v, dtype=A.dtype) if isspmatrix_csr(A): csr_scale_rows(M, N, A.indptr, A.indices, A.data, v) else:
R, C = A.blocksize bsr_scale_rows(M/R, N/C, R, C, A.indptr, A.indices, np.ravel(A.data), v) return A elif isspmatrix_csc(A): return scale_columns(A.T, v) else: return scale_rows(csr_matrix(A), v) def scale_columns(A, v, copy=True): """ S...
sameerparekh/pants
src/python/pants/version.py
Python
apache-2.0
320
0.003125
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.
md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_state
ment) VERSION = '0.0.50'
newcontext/rubypython
spec/python_helpers/basics.py
Python
mit
409
0.036675
#!/usr/bin/env python def iterate_list(): for item in [ 1, 2, 3 ]: yield item def identity(object): return object
def simple_callback(callback, value): return ca
llback(value) def simple_generator(callback): output = [] for i in callback(): output.append(i) return output def named_args(arg1, arg2): return [arg1, arg2] def expects_tuple(tvalue): return isinstance(tvalue, tuple)
bradjasper/django-jsonfield
jsonfield/__init__.py
Python
mit
53
0
from .fields i
mport JSONField, JSO
NCharField # noqa
clubcapra/capra_seagoat
src/seagoat_ros_client/seagoat_ros_client.py
Python
gpl-3.0
5,086
0.004915
#! /usr/bin/env python import rospy import math import numpy import cv2 from cv_bridge import CvBridge from sensor_msgs.msg import LaserScan from sensor_msgs.msg import Image from std_msgs.msg import Header from multiprocessing import Pool from multiprocessing import cpu_count class Line: def __init__(self, po...
= vision_raw_scan.shape if self.init is False: self._init_lines(image_size) self.init = True tasks = list() for line in range(self.number_lines): tasks.append((vision_raw_scan, self.lines[line])) laser_scan.ranges = self.pool.map(_getObstacle, task...
#pool.close() laser_scan.header = header #laser_scan.scan_time = 1.0/5.0 #laser_scan.time_increment = 1.0/5.0 return laser_scan def image_callback(self, msg): image = CvBridge().imgmsg_to_cv2(msg) self.vision_raw_scan = numpy.asanyarray(image) #cv2.imshow("...
creaktive/aircrack-ng
scripts/airgraph-ng/airgraphviz/libOuiParse.py
Python
gpl-2.0
8,152
0.008342
#!/usr/bin/env python __author__ = 'Ben "TheX1le" Smith, Marfi' __email__ = '[email protected]' __website__= '' __date__ = '04/26/2011' __version__ = '2011.4.26' __file__ = 'ouiParse.py' __data__ = 'a class for dealing with the oui txt file' """ ######################################## # # This program and its support...
irgraph-ng" %(error))) sys.exit(0) def identDeviceDict(self,fname): """ Create two dicts allowing device type lookup one f
or oui to device and one from device to OUI group """ self.ouitodevice = {} self.devicetooui = {} data = self.ouiOpen(fname,'RL') if data == False: self.last_error = "Unable to open lookup file for parsing" return False for line in data: ...
guyemerson/sem-func
src/preprocess/wikiwoods_extractcore.py
Python
mit
6,001
0.002333
import sys, os, gzip, pickle from xml.etree.ElementTree import ParseError from traceback import print_tb from multiprocessing import Pool # @UnresolvedImport from pydmrs.components import RealPred, GPred from pydmrs.core import ListDmrs as Dmrs PROC = 50 def is_verb(pred): # Ignore GPreds if not isinstance(...
pronouns elif pred == GPred('pron'): pronstring = end.sorti
nfo['pers'] try: pronstring += end.sortinfo['num'] except TypeError: # info is None pass try: pronstring += end.sortinfo['gend'] except TypeError: # info is None pass ...
rohitwaghchaure/frappe
frappe/utils/boilerplate.py
Python
mit
9,035
0.014721
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe, os, re from frappe.utils import touch_file, encode, cstr def make_boilerplate(dest, app_name): if not os.path.exists(dest): print "Destination directory does n...
e.event.event.get_permission_query_conditions", # }} # # has_permission = {{ # "Event": "frappe.desk.doctype.event.ev
ent.has_permission", # }} # Document Events # --------------- # Hook on document methods and events # doc_events = {{ # "*": {{ # "on_update": "method", # "on_cancel": "method", # "on_trash": "method" # }} # }} # Scheduled Tasks # --------------- # scheduler_events = {{ # "all": [ # "{app_name}.tasks.all"...
mikeshardmind/SinbadCogs
scheduler/converters.py
Python
mit
4,607
0.001954
from __future__ import annotations import argparse import dataclasses from datetime import datetime, timedelta, timezone from typing import NamedTuple, Optional, Tuple from redbot.core.commands import BadArgument, Context from .time_utils import parse_time, parse_timedelta class NonNumeric(NamedTuple): parsed:...
t command and not vals["command"]: raise BadArgument("You have to provide a command to run") command = command or " ".join(vals["command"]) for delta in ("in", "every"): if vals[delta]: parsed = parse_timedelta(" ".join(vals[delta])) if not parse...
start = datetime.now(timezone.utc) + parsed else: recur = parsed if recur.total_seconds() < 60: raise BadArgument( "You can't schedule something to happen that frequently, " ...
RagtagOpen/bidwire
bidwire/tests/test_knox_co_agenda_scraper.py
Python
mit
2,136
0.000468
import pytest import responses from document import Document from scrapers.knox_tn_agendas_scraper import KnoxCoTNAgendaScraper from . import common from . import utils class TestKnoxAgendaScraper(object): session = None page_str = "" def test_get_docs_from_page(self): scraper = KnoxCoTNAgendaSc...
RL, body=self.page_str, status=200, match_querystring=True ) scraper = KnoxCoTNAgendaScraper() scraper.scrape(self.session) docs = self.session.query(Document).all() assert len(docs) == 4 expected_titles = { 'June 28, 2017: ...
on', 'June 7, 2017: AGENDA COMMITTEE MEETING', } for doc in docs: assert doc.title in expected_titles @classmethod def setup_class(cls): cls.session = common.Session() with open(utils.get_abs_filename('knox-co-results-page.html'), 'r') as page: ...
redbear/Espruino
scripts/common.py
Python
mpl-2.0
16,565
0.020344
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 Gordon Williams <[email protected]> # # 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 ...
fo["build"]): for i in board.info["build"]["defines"]: print("Got define from board: " + i); defines.append(i) if parseArgs and len(sys.argv)>1: print("Using files from command line") for i in range(1,len(sys.argv)): arg = sys.argv[i] ...
rg[0]=="-": if arg[1]=="D": defines.append(arg[2:]) elif arg[1]=="B": board = importlib.import_module(arg[2:]) if "usart" in board.chip: defines.append("USART_COUNT="+str(board.chip["usart"])); if "spi" in board.chip: defines....
polyaxon/polyaxon
core/polyaxon/polyflow/events/__init__.py
Python
apache-2.0
6,731
0.001931
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
reaches a final state. For instance, a usual use-c
ase is to start a tensorboard as soon as training starts. In that case the downstream operation will watch for the `running` status. Events can be attached as well to a single operation to wait for an internal alert or external events, for instance if a user integrates Polyaxon with Github, they ca...
JoostvanPinxten/ConstraintPuzzler
constraints/__init__.py
Python
mit
296
0.006757
__all__ = ['Constraint', 'ConstraintGroup', 'TotalSumValueConstraint', 'UniqueVa
lueConstraint'] from .constraint import Constraint from .constraintgroup i
mport ConstraintGroup from .totalsumvalueconstraint import TotalSumValueConstraint from .uniquevalueconstraint import UniqueValueConstraint
LeZhang2016/openthread
tests/toranj/test-603-channel-manager-announce-recovery.py
Python
bsd-3-clause
4,783
0.005854
#!/usr/bin/env python # # Copyright (c) 2018, The OpenThread Authors. # All rights reserved. # # Redistributi
on and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reprodu...
he distribution. # 3. Neither the name of the copyright holder nor the # names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRE...
alirizakeles/zato
code/zato-scheduler/src/zato/scheduler/__init__.py
Python
gpl-3.0
238
0.004202
# -*- coding
: utf-8 -*- """ Copyright (C) 2016 Dariusz Suchojad <dsuch at zato.io> Licensed under LGPLv3, see LICENSE.txt for terms and conditions. """ from __future__ import absolute_import, division, print_fun
ction, unicode_literals
NeCTAR-RC/ceilometer
ceilometer/api/acl.py
Python
apache-2.0
2,172
0
# -*- encoding: utf-8 -*- # # Copyright © 2012 New Dream Network, LLC (DreamHost) # # Author: Doug Hellmann <[email protected]> # # 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 # # ...
turn: A tuple of (user, project), set to None if there's no limit on one of these. """ global _ENFORCER if not _ENFORCER: _ENFORCER = policy.Enforcer() if not _ENFORCER.enforce('context_is_admin', {}, {'roles': headers.get('X-Roles',...
et('X-User-Id'), headers.get('X-Project-Id') return None, None def get_limited_to_project(headers): """Return the project the request should be limited to. :param headers: HTTP headers dictionary :return: A project, or None if there's no limit on it. """ return get_limited_to(headers)[1]
paradiseOffice/Bash_and_Cplus-plus
CPP/full_examples/pyqt/chap08/addeditmoviedlg_ans.py
Python
gpl-2.0
3,155
0.001268
#!/usr/bin/env python3 # Copyright (c) 2008-9 Qtrac Ltd. All rights reserved. # This program or module 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 # version 3 of the License, or (at your option) a
ny later version. It is # provided for educational purposes and is distributed in the hope that # it will be useful, but WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See # the GNU General Public License for more details. from PyQt4.QtCore import (QDa...
OpenEngeneeringTaskForce/OETFDev
pycore/submit_util.py
Python
mit
1,401
0.004996
''' Created on Aug 21, 2014 @author: Dean4Devil ''' import mysql.connector from pycore.sql_util import MySQLHelper class Sub
mitTree(): 'A tree of all submits to that standard. I.e. OpenDriver is a tree, OpenDriver 0.2 is a submit.' def __init__(self, identifier): 'Create a new Tree in memory.' self.sql_helper
= MySQLHelper("oetf_submits") if self.sql_helper.check_exists(identifier): self.tree = self.sql_helper.query_data(identifier, "*", delimiter="", order="id", row_num=0) else: # First submit in that tree. Table does not exist yet. table = ( "CREATE TABLE...
rbernand/transfert
tests/unit/test_copy.py
Python
mit
1,619
0
import filecmp from transfert import Resource from transfert.actions import copy def estimate_nb_cycles(len_data, chunk_size): return (len_data // chunk_size) + [0, 1][(len_data % chunk_size) > 0] def test_simple_local_copy(tmpdir): src = tmpdir.join('alpha') dst = tmpdir.join('beta') src.writ
e('some data') assert src.check() assert not dst.check() copy(Resource('file://' + src.strpath), Resource('file://' + dst.strpath)) assert src.check() assert dst.check() assert filecmp.cmp(src.strpath, dst.strpath) def test_simple_local_copy_with_callback(tmpdir): def wrapper(size...
src.write(data) chunk_size = 1 assert src.check() assert not dst.check() copy(Resource('file://' + src.strpath), Resource('file://' + dst.strpath,), size=chunk_size, callback_freq=1, callback=wrapper) assert src.check() assert dst.check() assert filecmp.c...
mecwerks/fofix
src/audio/Microphone.py
Python
gpl-2.0
8,551
0.003158
##################################################################### # -*- coding: iso-8859-1 -*- # # # # Frets on Fire X (FoFiX) # # Copyright (C) 2009 Team FoFiX ...
]')} for devnum in range(pa.get_device_count()): devinfo = pa.get_device_info_by_index(devnum) if devinfo['maxInputChannels'] > 0: result[devnum] = devinfo['name'] return result class Microphone(Task): def __init__(self, engine, controlnu
m, samprate=44100): Task.__init__(self) self.engine = engine self.controlnum = controlnum devnum = self.engine.input.controls.micDevice[controlnum] if devnum == -1: devnum = None self.devname = pa.get_default_input_device_info()...
sgraham/nope
tools/gyp/test/rules-dirname/gyptest-dirname.py
Python
bsd-3-clause
1,475
0.00339
#!/usr/bin/env python # Copyright (c) 2011 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. "
"" Verifies simple rules when using an explicit build target of 'all'. """ import TestGyp import os import sys test = TestGyp.TestGyp(formats=['make', 'ninja', 'android', 'xcode', 'msvs']) test.run_gyp('actions.gyp', chdir='src') test.relocate('src', 'relocate/src') test.build('actions.gyp', chdir=
'relocate/src') expect = """\ no dir here hi c hello baz """ if test.format == 'xcode': chdir = 'relocate/src/subdir' else: chdir = 'relocate/src' test.run_built_executable('gencc_int_output', chdir=chdir, stdout=expect) if test.format == 'msvs': test.run_built_executable('gencc_int_output_external', chdir=chdir...
oferb/OpenTrains
webserver/opentrain/opentrain/print_settings.py
Python
bsd-3-clause
230
0.021739
import sys old_stdout = sys.stdout sys.stdout = open('/dev/null','w') import setti
ngs sys.stdout = old_stdout if __name__ == '__main__': if sys.a
rgv[1] == '-env': print 'export DATA_DIR="%s"' % (settings.DATA_DIR)
andydrop/ludicode
GameServers/__init__.py
Python
gpl-3.0
60
0
from .gameserver i
mport Game from .example import Tic
TacToe
marduk191/plugin.video.movie25
resources/libs/resolvers.py
Python
gpl-3.0
60,306
0.014012
# -*- coding: cp1252 -*- import urllib,urllib2,re,cookielib,string,os import xbmc, xbmcgui, xbmcaddon, xbmcplugin from t0mm0.common.net import Net as net addon_id = 'plugin.video.movie25' selfAddon = xbmcaddon.Addon(id=addon_id) datapath = xbmc.translatePath(selfAddon.getAddonInfo('profile')) elogo = xbmc.translatePat...
value2 = value2 def __str__(self): return repr(value,value2) def resolve_url(url, filename = False): stream_url = False if(url): try: url = url.split('"')[0] match = re.search('xoxv(.+?)xoxe(.+?)xoxc',url) print "host "+url if(match):...
ostedMediaFile(host=match.group(1), media_id=match.group(2)) if source: stream_url = source.resolve() elif re.search('billionuploads',url,re.I): stream_url=resolve_billionuploads(url, filename) elif re.search('180upload',url,re.I): ...
tisimst/pyDOE
pyDOE/doe_factorial.py
Python
bsd-3-clause
7,200
0.007917
""" This code was originally published by the following individuals for use with Scilab: Copyright (C) 2012 - 2013 - Michael Baudin Copyright (C) 2012 - Maria Christopoulou Copyright (C) 2010 - 2011 - INRIA - Michael Baudin Copyright (C) 2009 - Yann Collette Copyright (C) 2009 - CEA - Jean-Ma...
Examples -------- :: >>> fracfact("a b ab") array([[-1., -1., 1.], [ 1., -1., -1.], [-1., 1., -1.], [ 1., 1., 1.]]) >>> fracfact("A B AB") array([[-1., -1., 1.],
[ 1., -1., -1.], [-1., 1., -1.], [ 1., 1., 1.]]) >>> fracfact("a b -ab c +abc") array([[-1., -1., -1., -1., -1.], [ 1., -1., 1., -1., 1.], [-1., 1., 1., -1., 1.], [ 1., 1., -1., -1., -1.], ...
Jokeren/neon
examples/conv_autoencoder.py
Python
apache-2.0
3,219
0
#!/us
r/bin/env python # --------------------------
-------------------------------------------------- # Copyright 2015-2016 Nervana Systems Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
fcrepo4-archive/RDFDatabank
rdfdatabank/config/users.py
Python
mit
1,238
0.002423
#-*- coding: utf-8
-*- """ Copyright (c) 2012 University of Oxford 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, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS...
rlr/django_jinja_ref
django_jinja_ref/superadvanced/urls.py
Python
mpl-2.0
195
0
from django.conf.urls import url from django_jinja_ref.s
uperadvanced import views urlpatterns = [ url(r'^$', views.django, name='django'),
url(r'^jinja$', views.jinja, name='jinja'), ]
cglewis/bowl
bowl/cli_opts/snapshots.py
Python
apache-2.0
850
0.003529
""" This module is the snapshots command of bowl. Created on 17 July 2014 @author: Charlie Lewis """ import ast import os class snapshots(object): """ This class is responsible for the snapshots command of the cli. """ @classmethod def main(self, args): # !! TODO needs to implement login i...
r line in f: snapshot = ast.literal_eval(line.rstrip("\n")) snapshots.append(snapshot['snapshot_id'])
except: pass if not args.z: for snapshot in snapshots: print snapshot return snapshots
jiminliang/msda-denoising
spearmint_variable_noise/output2csv.py
Python
apache-2.0
1,028
0.066148
import os, re, csv # regular expressions for capturing the interesting quantities noise_pattern = 'noise: \[(.+)\]' res
_pattern = '^([0-9.]+$)' search_dir = "output" results_file = '../results.csv' os.chdir( search_dir ) files = filter( os.path.isfile, os.listdir( '.' )) #files = [ os.path.join( search_dir, f ) for f in files ] # add path to each file files.sort( key=lambda x: os.path.getmtime( x )) results = [] for file in fi
les: f = open( file ) contents = f.read() # noise matches = re.search( noise_pattern, contents, re.DOTALL ) try: noise = matches.group( 1 ) noise = noise.strip() noise = noise.split() except AttributeError: print "noise error 1: %s" % ( contents ) continue # rmse matches = re.search( res_patt...
cloudbase/neutron-virtualbox
neutron/plugins/nec/router_drivers.py
Python
apache-2.0
9,085
0.00011
# Copyright 2013 NEC Corporation. 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 ...
c.add_ofc_router_interface(context, router_id,
port_id, port_info) new_status = nconst.ROUTER_STATUS_ACTIVE self.plugin._update_resource_status( context, "port", port_id, new_status) return port except (nexc.OFCException, nexc.OFCMappingNotFound) as exc: with excutils.save_and_reraise_ex...
william-richard/moto
moto/secretsmanager/models.py
Python
apache-2.0
20,426
0.001175
# -*- coding: utf-8 -*- from __future__ import unicode_literals import time import json import uuid import datetime from boto3 import Session from moto.core import BaseBackend, BaseModel from .exceptions import ( SecretNotFoundException, SecretHasNoValueException, InvalidParameterException, ResourceE...
, secret_id, secret_string=None, secret_binary=None, **kwargs ): # error if secret does not exist if secret_id not in self.secrets.keys(): raise SecretNotFoundException() if self.secrets[secret_id].is_deleted(): raise InvalidRequestException( "An err...
(InvalidRequestException) when calling the UpdateSecret operation: " "Y
poffuomo/spark
python/pyspark/sql/dataframe.py
Python
apache-2.0
72,001
0.002736
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
Traceback (most recent call last): ... AnalysisException: u"Temporary table 'people' already exists;" >>> spark.catalog.dropGlobalTempView("people")
""" self._jdf.createGlobalTempView(name) @since(2.2) def createOrReplaceGlobalTempView(self, name): """Creates or replaces a global temporary view using the given name. The lifetime of this temporary view is tied to this Spark application. >>> df.createOrReplaceGlobalTempVie...
dashea/pykickstart
tests/commands/reboot.py
Python
gpl-2.0
2,617
0.002293
# # Brian C. Lane <[email protected]> # # Copyright 2012 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, modify, # copy, or redistribute it subject to the terms and conditions of the GNU # General Public License v.2. This program is distributed in the hope that it # will be useful,...
self.assertEqual(cmd.action, KS_SHUTDOWN) self.assertEqual(str(cmd), "# Shutdown after installation\n
shutdown\n") cmd = self.assert_parse("halt") # halt changed in F18 if self.__class__.__name__ in ("FC3_TestCase", "FC6_TestCase"): self.assertEqual(cmd.action, KS_SHUTDOWN) cmd = self.assert_parse("poweroff") self.assertEqual(cmd.action, KS_SHUTDOWN) class FC6_Test...
TrevorLowing/PyGames
pysollib/winsystems/__init__.py
Python
gpl-2.0
1,307
0.011477
#!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- ##---------------------------------------------------------------------------## ## ## Copyright (C) 1998-2003 Markus Franz Xaver Johannes
Oberhumer ## Copyright (C) 2003 Mt. Hood Playing Card Co. ## Copyright (C) 2005-2009 Skomoroh ## ## 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 Found
ation, 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 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for mor...
acdha/django-modeltranslation
modeltranslation/settings.py
Python
bsd-3-clause
2,611
0.00383
# -*- coding: utf-8 -*- from warnings import warn from django.conf import settings from django.core.exceptions import ImproperlyConfigured TRANSLATION_FILES = tuple(getattr(settings, 'MODELTRANSLATION_TRANSLATION_FILES', ())) TRANSLATION_REGISTRY = getattr(settings, 'MODELTRANSLATION_TRANSLATION_REGISTRY', None) if ...
NSLATION_FILES += (TRANSLATION_REGISTRY,) warn('The setting MODELTRANSLATION_TRANSLATION_REGISTRY is deprecated, ' 'use MODELTRANSLATION_TRANSLATION_FILES instead.', DeprecationWarning) AVAILABLE_LANGUAGE
S = [l[0] for l in settings.LANGUAGES] DEFAULT_LANGUAGE = getattr(settings, 'MODELTRANSLATION_DEFAULT_LANGUAGE', None) if DEFAULT_LANGUAGE and DEFAULT_LANGUAGE not in AVAILABLE_LANGUAGES: raise ImproperlyConfigured('MODELTRANSLATION_DEFAULT_LANGUAGE not in LANGUAGES setting.') elif not DEFAULT_LANGUAGE: DEFAULT...
TheTimmy/spack
var/spack/repos/builtin/packages/py-binwalk/package.py
Python
lgpl-2.1
1,674
0.000597
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, [email protected], All rights reserved. # LLNL-CODE-64...
neral Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ####################################################################...
""Binwalk is a fast, easy to use tool for analyzing, reverse engineering, and extracting firmware images.""" homepage = "https://github.com/devttys0/binwalk" url = "https://pypi.io/packages/source/b/binwalk/binwalk-2.1.0.tar.gz" version('2.1.0', '054867d9abe6a05f43200cf2591051e6') depends...
csecutsc/GmailBot
quickstart.py
Python
mit
2,344
0.00384
# Copyright (C) 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License")
; # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.o
rg/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 permission...
MichaelKohler/bedrock
tests/pages/firefox/welcome/page5.py
Python
mpl-2.0
1,575
0.00127
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from selenium.webdriver.common.by import By from pages.base import BasePage from pages.regions.modal import ModalProtoc...
(*self._lockwise_qr_code_locator) @property def is_primary_modal_button_displayed(self): return self.is_element_displayed(*self._mod
al_primary_button_locator) @property def is_secondary_modal_button_displayed(self): return self.is_element_displayed(*self._modal_secondary_button_locator) def open_modal(self, locator): modal = ModalProtocol(self) self.find_element(*locator).click() self.wait.until(lambda ...
oyang/testFalsk
app.py
Python
mit
109
0
from flask import Flask app = Flask(__name__) app.config.from_object("con
figs.appconfig.DevelopmentConfig")
bongo-project/bongo
src/libs/python/bongo/external/email/mime/multipart.py
Python
gpl-2.0
1,377
0.000726
# Copyright (C) 2002-2006 Python Software Foundation # Author: Barry Warsaw # Contact: [email protected] """Base class for MIME multipart/* type messages.""" __all__ = ['MIMEMultipart'] from bongo.external.email.mime.base import MIMEBase class MIMEMultipart(MIMEBase): """Base class for MIME multipart/* ty...
pe, defaulting to `mixed'. boundary is the multipart boundary string. By default it is calculated as needed. _subparts is a sequence of initial subparts for the payload. It must be an iterable object, such as a list. You can always attach new subparts to the message ...
m the keyword arguments (or passed into the _params argument). """ MIMEBase.__init__(self, 'multipart', _subtype, **_params) if _subparts: for p in _subparts: self.attach(p) if boundary: self.set_boundary(boundary)
sunqm/pyscf
examples/local_orb/nlocal.py
Python
apache-2.0
6,720
0.058333
# Copyright 2014-2018 The PySCF Developers. 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 appl...
n_v = occ[vorb].copy() mo_o,n_o,e_o = ulocal.psort(ova,fav,pT,almo) lmo2 = numpy.hstack((mo_c,mo_o,mo_v)) enorb = numpy.hstack([e_c,e_o,e_v]) occ = numpy.hstack([n_c,n_o,n_v]) assert len(enorb)==nb assert len(occ)==nb # CHECK diff = reduce(numpy.dot,(lmo2.T,ova,lmo2)) - numpy.identity(nb) pr...
linalg.norm(diff) ulocal.lowdinPop(mol,lmo,ova,enorb,occ) ulocal.dumpLMO(mol,fname+'_new',lmo2) print 'nalpha,nbeta,mol.spin,nb:',\ nalpha,nbeta,mol.spin,nb print 'diff(LMO2-LMO)=',numpy.linalg.norm(lmo2-lmo) nc = len(e_c) na = len(e_o) nv = len(e_v) assert na == len(actlst) assert ...
shuttl-io/shuttl
shuttl/tests/test_models/test_user.py
Python
mit
1,929
0.00311
from shuttl.tests import testbase from shuttl.Models.User import User, UserDataTakenException, NoOrganizationException, ToManyOrganizations from shuttl.Models.organization import Organization from shuttl.Models.Reseller import Reseller class UserTestCase(testbase.BaseTest): def _setUp(self): self.reselle...
user = User.Create(**data) self.assertRaises(UserData
TakenException, User.Create, **data) user2 = User.query.get(user.id) self.assertEqual(user2.username, user.username) self.assertEqual(user2, user) self.assertEqual(user2.password, user.password) self.assertNotEqual(user2.password, "Things") self.assertFalse(user.isAdmin) ...
endlessm/chromium-browser
tools/swarming_client/third_party/cachetools/lru.py
Python
bsd-3-clause
1,483
0
from __future__ import absolute_import import collections from .cache import Cache class LRUCache(Cache): """Least Recently Used (LRU) cache implementation.""" def __init__(self, maxsize, missing=None, getsizeof=None): Cache.__init__(self, maxsize, missing, getsizeof) self.__order = collect...
raise KeyError('%s is empty' % self.__class__.__name__) else: return (key, self.pop(key)) if hasattr(collections.OrderedDict, 'move_to_end'): def __update(self, key): try: self.__order.move_to_end(key) except KeyError: sel...
__order.pop(key) except KeyError: self.__order[key] = None
skywalka/splunk-for-nagios
bin/mklivestatus.py
Python
gpl-3.0
87
0.034483
#
Configs for mk-livestatus lookup scripts HOST = [ 'nagios', 'nagios1' ] PORT = 6557
vianasw/spot_launcher
spot_launcher/spot_launcher.py
Python
apache-2.0
4,508
0.004215
#!/usr/bin/env python # -*- coding
: utf-8 -*- import boto.ec2 from boto.ec2.blockdevicemapping import BlockDeviceType from boto.ec2.blockdevicemapping import Bl
ockDeviceMapping import time import copy import argparse import sys import pprint import os import yaml BASE_PATH = os.path.dirname(os.path.abspath(__file__)) CONFIG_PATH = os.path.join(BASE_PATH, '../configs') def launch_from_config(conn, instance_config_name, config_file_name): spot_requests_config = get_config...
BioroboticsLab/diktya
tests/test_blocks.py
Python
apache-2.0
1,576
0
# Copyright 2016 Leon Sixt # # 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 Lice
nse at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi
red 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 diktya.blo...
PressLabs/gitfs
tests/repository/base.py
Python
apache-2.0
759
0
# Copyright 2014-2016 Pre
sslabs SRL # # Licensed under the Apache License, Versi
on 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" BASI...
zuck/prometeo-erp
products/models.py
Python
lgpl-3.0
7,390
0.005954
#!/usr/bin/env python # -*- coding: utf-8 -*- """This file is part of the prometeo project. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option...
=_('max purchase discount (%)')) purchase_tax = models.FloatField(default=0.0
, verbose_name=_('purchase tax (%)')) lead_time = models.PositiveIntegerField(default=1, verbose_name=_('lead time (days)')) minimal_quantity = models.FloatField(default=1.0, verbose_name=_('minimal quantity')) warranty_period = models.PositiveIntegerField(default=settings.PRODUCT_DEFAULT_WARRANTY_PERIOD, v...
sanguinariojoe/FreeCAD
src/Mod/Fem/femtaskpanels/task_element_fluid1D.py
Python
lgpl-2.1
22,417
0.001695
# *************************************************************************** # * Copyright (c) 2016 Ofentse Kgoa <[email protected]> * # * Copyright (c) 2018 Bernd Hahnebach <[email protected]> * # * Based on the FemElementGeometry1D by Bernd Hahnebach * # * ...
* # * the License, or (at your option) any later version. * # * for detail see the LICENCE text file. * # * * # * This program is distributed in the hope that it will be useful, * # * ...
ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU Library General Public License for more details. * # * * # * You should have rece...
Wolfst0rm/Wolf-Cogs
quote/quote.py
Python
mit
2,264
0.025177
import discord from discord.ext import commands from random import choice as randomchoice from .utils.dataIO import fileIO from .utils import checks import os defaultQuotes = [ "Thats why I love switch hitting, I like to be in control ~ Jan, from the Hypermine Dragon Fight - 21st May 2016", "Thank you for wwaking wi...
ote not in self.quotes: await self.bot.say("That quote is already in the database!") else: self.quotes.remove(quote) self.save_quotes() await self.bot.say("Quote: " + quote + " has been removed from the database!") def check_folder(): if not os.path.exists("data/quote"
): print("Creating data/quote") os.makedirs("data/quote") def check_files(): fileName = "data/quote/quotes.json" if not fileIO(fileName, "check"): print("Creating Empty Quote.json File") print("Creation Complete! Enjoy your new Quote System ~ Wolfstorm") fileIO(fileName, "save", defaultQuotes) def setup(b...
minorua/QGIS
python/plugins/processing/algs/grass7/ext/v_in_geonames.py
Python
gpl-2.0
1,246
0
# -*- coding: utf-8 -*- """ *************************************************************************** v_in_geonames.py ---------------- Date : March 2016 Copyright : (C) 2016 by Médéric Ribreux Email : medspx at medspx dot fr *****************************...
* *************************************************************************** """ __author__ = 'Médéric Ribreux' __date__ = 'March 2016' __copyright__ = '(C) 2016, Médéric Ribreux' def processCommand(alg, parameters, context, feedback): # v.in.geonames needs to use WGS84...
tsl143/zamboni
mkt/webapps/tests/test_models.py
Python
bsd-3-clause
97,405
0
# -*- coding: utf-8 -*- import functools import hashlib import json import os import tempfile import unittest import uuid import zipfile from contextlib import nested from datetime import datetime, timedelta from decimal import Decimal from django import forms from django.conf import settings from django.contrib.auth....
els import update_status, Version from mkt.webapps.indexers import WebappIndexer from mkt.webapps.models import (AddonDeviceType, AddonExcludedRegion, AddonUpsell, AppFeatures, AppManifest, BlockedSlug, ContentRating, Geodata,
get_excluded_in, IARCInfo, Installed, Preview, RatingDescriptors, RatingInteractives, version_changed, Webapp) from mkt.webapps.signals import version_changed as version_changed_signal class TestWebapp(WebappTestCase): def add_paym...
repotvsupertuga/tvsupertuga.repository
script.module.streamlink.base/resources/lib/streamlink/plugins/mitele.py
Python
gpl-2.0
2,844
0.001758
import logging import re from streamlink.plugin import Plugin from streamlink.plugin.api import useragents from streamlink.plugin.api import validate from streamlink.stream import HLSStream from streamlink.utils import parse_json log = logging.getLogger(__name__) class Mitele(Plugin): _url_re = re.compile(r"ht...
pdata_url = "https://indalo.mediaset.es/mmc-player/api/mmc/v1/{channel}/live/html5.json" gate_url = "https://gatekeeper.mediaset.es" error_schema
= validate.Schema({ "code": validate.any(validate.text, int), "message": validate.text, }) pdata_schema = validate.Schema(validate.transform(parse_json), validate.any( validate.all( { "locations": [{ "gcp": validate.text, ...
TeamSPoon/logicmoo_workspace
packs_web/butterfly/lib/python3.7/site-packages/flake8/utils.py
Python
mit
15,155
0
"""Utility methods for flake8.""" import collections import fnmatch as _fnmatch import inspect import io import logging import os import platform import re import sys import tokenize from typing import Callable, Dict, Generator, List, Optional, Pattern from typing import Sequence, Set, Tuple, Union from flake8 import ...
) -> str stdin_value = sys.stdin.buffer.read() fd = io.BytesIO(stdin_value) try: coding, _ = tokenize.detect_encoding(fd.readline) return stdin_value.decode(coding) except (LookupError, SyntaxError, UnicodeError): return stdin_value.decode("utf-8") @lru_cache(maxsize=1) def std...
"""Get and cache it so plugins can use it.""" if sys.version_info < (3,): return sys.stdin.read() else: return _stdin_get_value_py3() def stdin_get_lines(): # type: () -> List[str] """Return lines of stdin split according to file splitting.""" if sys.version_info < (3,): retu...
dbbhattacharya/kitsune
vendor/packages/pylint/test/input/func_use_for_or_listcomp_var.py
Python
bsd-3-clause
560
0.014286
"""test a warning is triggered when using for a lists comprehension variable""" __revision__ = 'yo' TEST_LC = [C for C in __revision
__ if C.isalpha()] print C # WARN C = 4 print C # this one shouldn't trigger any warning B = [B for B in __revision__ if B.isalpha()] print B # nor this one for var1, var2 in TEST_LC: var1 = var2 + 4 print var1 # WARN for note in __revision__: note.something() for line in __revision__: for note in line:...
a : x)() # OK
maxBombrun/lipidDroplets
settings.py
Python
bsd-3-clause
1,178
0.034805
# settings.py ####################################################### # # Definition of the different paths: # - CellProfiler (Software, input, output) # - Input # - Output # ####################################################### import os def init(): global pathList CPPath= "D:/Logiciel/CellProfiler...
s.path.isdir(outputDetPath): os.mkdir(outputDetPath) if not os.path.isdir(inputCellProfilerPath): os.mkdir(inputCellProfilerPath) if not os.path.isdir(outputCellProfilerPath)
: os.mkdir(outputCellProfilerPath) pathList = [CPPath]+ [inputDataPath] + [resultPath] + [outputDetPath] + [inputCellProfilerPath] + [outputCellProfilerPath]
CruiseDevice/coala
tests/coalaFormatTest.py
Python
agpl-3.0
1,124
0
import os import re import sys import unittest fr
om coalib import coala_format from coalib.misc.
ContextManagers import prepare_file from tests.TestUtilities import bear_test_module, execute_coala class coalaFormatTest(unittest.TestCase): def setUp(self): self.old_argv = sys.argv def tearDown(self): sys.argv = self.old_argv def test_line_count(self): with bear_test_module()...
Azure/azure-sdk-for-python
sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py
Python
mit
5,377
0.004092
# 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 may ...
list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.ru...
ream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) ...
1flow/1flow
oneflow/core/migrations/0036_auto__add_userfeeds__add_usersubscriptions.py
Python
agpl-3.0
37,603
0.007872
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'UserFeeds' db.create_table(u'core_userfeeds', ( ...
d'])), ('sent_items', self.gf('dj
ango.db.models.fields.related.OneToOneField')(blank=True, related_name='sent_items', unique=True, null=True, to=orm['core.BaseFeed'])), ('received_items', self.gf('django.db.models.fields.related.OneToOneField')(blank=True, related_name='received_items', unique=True, null=True, to=orm['core.BaseFeed'])), ...
sid88in/incubator-airflow
tests/sensors/test_sql_sensor.py
Python
apache-2.0
2,780
0.001799
# -*- coding: utf-8 -*- # # 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 #...
sql_alchemy_conn'), "this is a mysql test") def test_sql_sensor_mysql(self): t = SqlSensor( task_id='sql_sensor_check', conn_id='mysql_default', sql="SELECT count(1) FROM INFORMATION_SCHEMA.TABLES", dag=self.dag ) t.run(start_date=DEFAULT_DATE,...
, ignore_ti_state=True) @unittest.skipUnless( 'postgresql' in configuration.conf.get('core', 'sql_alchemy_conn'), "this is a postgres test") def test_sql_sensor_postgres(self): t = SqlSensor( task_id='sql_sensor_check', conn_id='postgres_default', sql="SELECT...
divio/django-shop
shop/migrations/0009_delete_email.py
Python
bsd-3-clause
361
0
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-02-25 19:51 from __future__ import unicode_
literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('shop', '0008_notification_recipient'), ] operations = [ migrations.DeleteModel( name='Email'
, ), ]
fireduck64/electrum
lib/dnssec.py
Python
mit
10,409
0.00221
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # 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...
N7SWXgnLh4+B5xQlNVz8Og8kvArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU='), # KSK-2010: dns.rrset.from_text('.', 15202, 'IN...
'257 3 8 AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS Qageu+ipAdTTJ25AsRTAoub8ON...
open-synergy/runbot-addons
runbot_build_instructions/runbot_build.py
Python
agpl-3.0
6,892
0.000145
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2010 - 2014 Savoir-faire Linux # (<http://www.savoirfairelinux.com>). # # This program is free software: you can redistribute it a...
'w') as f:
f.write('consider tests as passed: ' '.modules.loading: Modules loaded.') return MAGIC_PID_RUN_NEXT_JOB else: return super(runbot_build, self).job_20_test_all( cr, uid, build, lock_path, log_path ) def sub_cmd(self, build, ...
atvcaptain/enigma2
lib/python/Screens/TaskView.py
Python
gpl-2.0
5,728
0.027235
from __future__ import absolute_import from Screens.Screen import Screen from Components.ConfigList import ConfigListScreen from Components.config import ConfigSubsection, ConfigSelection, getConfigListEntry from Components.SystemInfo import SystemInfo from Components.Task import job_manager from Screens.InfoBarGeneric...
t MessageBox if self.settings.afterEvent.value == "deepstandby": if not Screens.Standby.inTryQuitMainloop: Tools.Notifications.AddNotificationWithCallback(self.sendTryQuitMainloopNotification, MessageBox, _("A sleep timer wants to shut down\nyour %s %s. Shutdown now?") % (getMachineB
rand(), getMachineName()), timeout = 20) elif self.settings.afterEvent.value == "standby": if not Screens.Standby.inStandby: Tools.Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _("A sleep timer wants to set your\n%s %s to standby. Do that now?") % (getMachineBrand(), getMa...
brmedeiros/dicey9000
tests.py
Python
mit
7,240
0.008702
import unittest import unittest.mock as mock import dice import dice_config as dcfg import dice_exceptions as dexc class DiceInputVerificationTest(unittest.TestCase): def test_dice_roll_input_wod(self): examples = {'!r 5':[5, 10, None, 10, 8, 'wod', None], '!r 2000':[2000, 10, None, 10,...
wod', None], '!r 15d20?20':[15, 20, None, None, 20, 'wod', None], '!r 39d10x5?8':[39, 10, None, 5, 8, 'wod', None], '!r 1d4x4?4':[1, 4, None, 4, 4, 'wod', None], '!r 6d6+':[6, 6, 0, None, None, 'wod', None], '
!r 5d32+5':[5, 32, 5, None, None, 'wod', None], '!r 17d4-12':[17, 4, -12, None, None, 'wod', None], '!r 3d12+x12':[3, 12, 0, 12, None, 'wod', None], '!r 10d20-7?15':[10, 20, -7, None, 15, 'wod', None], '!r 768d37+33x5?23':[768, 37, 33, 5, 2...
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/numpy/linalg/__init__.py
Python
agpl-3.0
2,178
0
""" Core Linear Algebra Tools ========================= ============
=== ========================================================== Linear algebra basics ========================================================================== norm Vector or matrix norm inv Inverse of a square matrix solve Solve a linear system of equations det Determinant ...
v Pseudo-inverse (Moore-Penrose) calculated using a singular value decomposition matrix_power Integer power of a square matrix =============== ========================================================== =============== ========================================================== Eigenvalues ...
intel/ipmctl
BaseTools/Source/Python/Eot/Parser.py
Python
bsd-3-clause
33,751
0.004207
## @file # This file is used to define common parsing related functions used in parsing # Inf/Dsc/Makefile process # # Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD Li...
# # @return TableList: A list of tables # def GetTableList(FileModelList, Table, Db): TableList = [] SqlCommand = """select ID, FullPath from File where Model in %s""" % st
r(FileModelList) RecordSet = Db.TblFile.Exec(SqlCommand) for Record in RecordSet: TableName = Table + str(Record[0]) TableList.append([TableName, Record[1]]) return TableList ## GetAllIncludeDir() method # # Find all Include directories # # @param Db: Eot database # # @re...
CognitionGuidedSurgery/restflow
doc/conf.py
Python
gpl-3.0
8,911
0.005948
# -*- coding: utf-8 -*- # # restflow documentation build configuration file, created by # sphinx-quickstart on Thu Jul 31 07:32:50 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
y_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking fo
r source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all desc...
pablorecio/Cobaya
src/cobaya/app.py
Python
gpl-3.0
4,990
0.000601
############################################################################### # 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 # ...
# # # # You should have receive
d a copy of the GNU General Public License # # along with this program. If not, see <http://www.gnu.org/licenses/>. # # # # Copyright (C) 2010, Pablo Recio Quijano <[email protected]> # # 2010, Lor...
celiafish/scikit-xray
skxray/core/utils.py
Python
bsd-3-clause
38,692
0.00031
#! encoding: utf-8 # ###################################################################### # Copyright (c) 2014, Brookhaven Science Associates, Brookhaven # # National Laboratory. All rights reserved. # # # # Redistr...
x into non-indexable things # or from trying to use iterables longer than 2 except TypeError: tmp[key_split[-1]] = md_value(val, None) def __getitem__(self, key): key_split = key.split(self._split)
tmp = self._dict for k in key_split[:-1]: try: tmp = tmp[k]._dict except: tmp[k] = type(self)() tmp = tmp[k]._dict if isinstance(tmp, md_value): # TODO make message better raise KeyError(...
jessicalucci/TaskManagement
taskflow/persistence/backends/sqlalchemy/models.py
Python
apache-2.0
3,197
0
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. # Copyright (C) 2013 Rackspace Hosting Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance wi...
idutils.generate_uuid, primary_key=True, nullable=False, unique=True) name = Column(String, nullable=True) meta = Column(Json, nullable=True) class LogBook(BASE, ModelBase): """Represents a logbook for a set of flows""" __tablename__ = 'logbooks' # Relationsh
ips flowdetails = relationship("FlowDetail", single_parent=True, backref=backref("logbooks", cascade="save-update, delete, " "merge")) class FlowDetai...
usc-isi-i2/etk
etk/cli/cryptographic_hash_extractor.py
Python
mit
947
0.004224
import warnings import sys import argparse from etk.extractors.
cryptographic_hash_extractor import Cryptogra
phicHashExtractor cryptographic_hash_extractor = CryptographicHashExtractor() def add_arguments(parser): """ Parse arguments Args: parser (argparse.ArgumentParser) """ parser.description = 'Examples:\n' \ 'python -m etk cryptographic_hash_extractor /tmp/input.txt\...
ruymanengithub/vison
vison/campaign/CEAFPAcampaign.py
Python
gpl-3.0
4,667
0.003643
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Description of the CEA FPA Campaign. :History: Created on Wed Oct 02 17:26:00 2019 :author: Ruyman Azzollini """ # IMPORT STUFF from collections import OrderedDict from pdb import set_trace as stop import numpy as np import copy #from vison.pipe import lib as pil...
NJ from vison.fpatests.cea_dec19 import FPA_DARK # END IMPORT def generate_test_sequence(toGen, elvis='FPA', FPAdesign='final'): """ | Function that generates a number of tests, as instances of their corresponding task classes. | Aimed at the TVAC campaign of the FPA at CEA (december 2019). ""...
sequence = OrderedDict() for taskname in taskslist: if not toGen[taskname]: continue strip_taskname, iteration = utils.remove_iter_tag(taskname, Full=True) _toGen = OrderedDict() _toGen[strip_taskname] = True ans = _generate_test_sequence(_toGen, elvis=elvis, FPA...
wprice/qpid-proton
proton-c/bindings/python/proton/handlers.py
Python
apache-2.0
20,366
0.002062
# # 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...
, the ``delivery`` should be used, also obtainable via a property on the event. """ if self.delegate: dispatch(self.delegate, 'on_message', event) def on_settled(self, event): if self.delegate: dispatch(self.delegate, 'on_settled', event) class EndpointState...
""" A utility that exposes 'endpoint' events i.e. the open/close for links, sessions and connections in a more intuitive manner. A XXX_opened method will be called when both local and remote peers have opened the link, session or connection. This can be used to confirm a locally initiated actio...
openmaraude/APITaxi
APITaxi_models2/migrations/versions/20170314_18:59:50_ccd5b0142a76_add_customer_foreign_key.py.py
Python
agpl-3.0
631
0.011094
"""Add customer foreign key Revision ID: ccd5b0142a76 Revises: 243adac5e3e9 Create Date: 2017-03-14 18:59:50.5
05319 """ # revision identifiers, used by Alembic. revision = 'ccd5b0142a76' down_revision = '243adac5e3e9' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_foreign_key('hail_custome...
r', ['customer_id', 'added_by'], ['id', 'moteur_id']) ### end Alembic commands ### def downgrade(): op.drop_constraint('hail_customer_id', 'hail', type_='foreignkey')
thuydang/djagazin
docs/9_tmp/hatta-wiki-1.5.3/dev.py
Python
bsd-2-clause
466
0.002146
#! /usr/bin/env python # -*- coding
: utf-8 -*- """ An auto-reloading standalone wiki server, useful for development. """ import hatta import werkzeug if __name__=="__main__": config = hatta.WikiConfig() config.parse_args() # config.parse_files() application = hatta.Wiki(config).
application host = config.get('interface', 'localhost') port = int(config.get('port', 8080)) werkzeug.run_simple(host, port, application, use_reloader=True)
dpaiton/OpenPV
pv-core/python/probe_analysis/readProbeParams.py
Python
epl-1.0
4,842
0.028501
from collections import OrderedDict #*************************# # PARAMS # #*************************# #Paths #workspaceDir = "/Users/slundquist/workspace" #filenames = [("sheng","/Users/slundquist/Desktop/ptLIF.txt")] #filenames = [("sheng","/Users/slundquist/Desktop/retONtoLif.txt")] worksp...
ght_4_7'] =
100 #scale['weight_4_8'] = 100 #scale['weight_4_9'] = 100 #scale['weight_4_10'] = 100 #scale['weight_4_11'] = 100 #scale['weight_4_12'] = 100 #scale['weight_4_13'] = 100 #scale['weight_4_14'] = 100 #scale['weight_4_15'] = 100 #scale['weight_4_16'] = 100 #scale['weight_4_17'] = 100 #scale['weight_4_18'] = 100 #scale[...
CIGIHub/greyjay
greyjay/articles/migrations/0076_articlepage_video_document.py
Python
mit
598
0.001672
# -*- coding: utf-8 -*- from __future__ import unicode_literals import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [
('wagtaildocs', '0003_add
_verbose_names'), ('articles', '0075_auto_20151015_2022'), ] operations = [ migrations.AddField( model_name='articlepage', name='video_document', field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtaildo...
GoogleCloudPlatform/professional-services-data-validator
third_party/ibis/ibis_addon/operations.py
Python
apache-2.0
5,439
0.001839
# Copyright 2020 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, ...
parison, Reduction, ValueOp ) import ibis.expr.rules as rlz from ibis.expr.types import ( BinaryValue, IntegerColumn, StringValue ) from ibis.backends.impala.compiler import ImpalaExprTranslator from ibis.backends.pandas import client a
s _pandas_client from ibis.backends.base_sqlalchemy.alchemy import AlchemyExprTranslator from third_party.ibis.ibis_oracle.compiler import OracleExprTranslator from third_party.ibis.ibis_teradata.compiler import TeradataExprTranslator # from third_party.ibis.ibis_mssql.compiler import MSSQLExprTranslator # TODO figur...
daikk115/test-rolling-upgrade-openstack
graceful_exit.py
Python
mit
2,834
0.001059
"""This script reponsible put all of send_get_request() function results into list, gracefull exit any script import it and return analytics """ import time import signal import sys from requests_futures.sessions import FuturesSession tasks = [] session = FuturesSession() def bg_cb(sess, resp): "Callback funct...
background_callback=bg_cb, **kwargs) elif method == 'POST': return session.post(url, headers=headers, data=data, background_callback=bg_cb, **kwargs)
elif method == 'PUT': return session.put(url, headers=headers, data=data, background_callback=bg_cb, **kwargs) elif method == 'PATCH': return session.patch(url, headers=headers, data=data, background_callback=bg_cb, **kwargs) elif method =...
laurentb/weboob
modules/lameteoagricole/module.py
Python
lgpl-3.0
1,524
0
# -*- coding: utf-8 -*- # Copyright(C) 2017 Vincent A # # This file is part of a weboob module. # # This weboob module 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 Licen...
ffero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this weboob module. If not, see <http://www.gnu.org/licenses/>. from __future__ import unicode_literals from weboob.tools.backend import Module from weboob.capabilities.weather imp...
LameteoagricoleModule(Module, CapWeather): NAME = 'lameteoagricole' DESCRIPTION = u'lameteoagricole website' MAINTAINER = u'Vincent A' EMAIL = '[email protected]' LICENSE = 'AGPLv3+' VERSION = '2.1' BROWSER = LameteoagricoleBrowser def iter_city_search(self, pattern): return self....
sealhuang/FreeROI
froi/gui/component/intersectdialog.py
Python
bsd-3-clause
3,390
0.00177
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from PyQt4.QtCore import * from PyQt4.QtGui import * from froi.algorithm import imtool class IntersectDialog(QDialog): """A dialog for action of intersection.""" def __init__(self, model, parent...
grid_layout.addWidget(ou
t_label, 1, 0) grid_layout.addWidget(self.out_edit, 1, 1) # button config self.run_button = QPushButton("Run") self.cancel_button = QPushButton("Cancel") hbox_layout = QHBoxLayout() hbox_layout.addWidget(self.run_button) hbox_layout.addWidget(self.cancel_button)...
hansroh/skitai
skitai/corequest/httpbase/task.py
Python
mit
22,202
0.022205
import time from aquests.athreads import socket_map from aquests.athreads import trigger from rs4.cbutil import tuple_cb from aquests.client.asynconnect import AsynSSLConnect, AsynConnect from aquests.dbapi.dbconnect import DBConnect import threading from aquests.protocols.http import request as http_request from aques...
self.__response.expt except AttributeError: # redircting to HTTPError raise exceptions.HTTPError ("%d %s" % (self.status_code, self.reason)) else:
self.__response.raise_for_status () return self def close (self): self.__response = None def cache (self, timeout = 60, cache_if = (200,)): if not timeout: return if self.status != NORMAL or self.status_code not in cache_if: return ...
enthought/etsproxy
enthought/traits/ui/qt4/ui_live.py
Python
bsd-3-clause
50
0
# p
roxy module from traitsui.qt4.ui_live import
*
the-linux-schools-project/karoshi-client
clientsetup/buildclient/config/usr/lib/gedit/plugins/advancedfind/find_result.py
Python
agpl-3.0
21,931
0.031143
# -*- encoding:utf-8 -*- # find_result.py is part of advancedfind-gedit. # # # Copyright 2010-2012 swatch # # advancedfind-gedit is free
software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY...
copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # from gi.repository import Gtk, Gedit, Gio import os.path import urllib import re import config_manager import shutil import gettext APP_NAM...
DBuildService/atomic-reactor
atomic_reactor/plugins/pre_koji_parent.py
Python
bsd-3-clause
14,943
0.003279
""" Copyright (c) 2017, 2019 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ from atomic_reactor.plugin import PreBuildPlugin from atomic_reactor.constants import ( INSPECT_CONFIG, PLUGIN_KOJI_PARENT_KEY, BASE...
else: self.log.error(err_msg) raise RuntimeError(err_msg) if manifest_mismatches: mismatch_msg = ('Error while comparing parent images manifest digests in koji with ' 'related values from registries: %s') if get_fail_...
meError(mismatch_msg % manifest_mismatches) self.log.warning(mismatch_msg, manifest_mismatches) return self.make_result() def check_manifest_digest(self, image, build_info): """Check if the manifest list digest is correct. Compares the manifest list digest with the value in ko...
gwenniger/joshua
scripts/toolkit/extract_references.py
Python
lgpl-2.1
1,922
0.023413
#!/usr/bin/env python import os, sys, codecs, re def usage(): print "Usage info for extract_references.py" print " extract_references.py ref_sgml ref_prefix" print sys.exit() def main(): if (len(sys.argv) < 3 or sys.argv[1] == "-h"): usage() sgml = codecs.open(sys.argv[1], "r", "utf-8") pref...
"</refset " in line or ("<doc " in line and cur_doc in map(lambda x: x[0], cur_ref_set))): ref_sets.append(cur_ref_set) cur_ref_set = [] if ("<seg " in line): cur_seg = seg_pattern.search(line).groups()[0] cur_txt = re.sub("<[^>]*>", "", line_tc) cur_ref_set.append((cur_doc, ...
if (ref_count != len(ref_set)): print "[ERR] reference lengths do not match: " + str(ref_count) \ + " vs. " + str(len(ref_set)) + " (ref " + str(i) + ")" ref_files.append(codecs.open(prefix + "_ref." + str(i), "w", "utf-8")) for j in range(ref_count): (cur_doc, cur_seg, cur_txt) = ref_...
jnns/wagtail
wagtail/core/models/view_restrictions.py
Python
bsd-3-clause
2,789
0.003944
""" Base model definitions for validating front-end user access to resources such as pages and documents. These may be subclassed to accommodate specific models such as Page or Collection, but the definitions here should remain generic and not depend on the base wagtail.core.models module or specific models defined the...
if self.id not in passed_restrictions: return False elif self.restriction_type == BaseViewRestriction.LOGIN:
if not request.user.is_authenticated: return False elif self.restriction_type == BaseViewRestriction.GROUPS: if not request.user.is_superuser: current_user_groups = request.user.groups.all() if not any(group in current_user_groups for group in s...
JrtPec/opengrid
opengrid/library/plotting.py
Python
apache-2.0
6,242
0.001922
# -*- coding: utf-8 -*- """ Created on Wed Nov 26 18:03:24 2014 @author: KDB """ import numpy as np import pandas as pd import datetime as dt import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.dates import date2num, num2date, HourLocator, DayLocator, AutoDateLocator, DateFormatter from matplotl...
} - no data'.format(title)) return ts = timeseries.resample('min', how='mean', label='left', closed='left') # convert to dataframe with date as index and time as columns by # first replacing the index by a MultiIndex # tz_convert('UTC'): workaro
und for https://github.com/matplotlib/matplotlib/issues/3896 mpldatetimes = date2num(ts.index.tz_convert('UTC').astype(dt.datetime)) ts.index = pd.MultiIndex.from_arrays( [np.floor(mpldatetimes), 2 + mpldatetimes % 1]) # '2 +': matplotlib bug workaround. # and then unstacking the second index level...
oinopion/django
django/db/backends/oracle/base.py
Python
bsd-3-clause
24,986
0.001641
""" Oracle database backend for Django. Requires cx_Oracle: http://cx-oracle.sourceforge.net/ """ from __future__ import unicode_literals import datetime import decimal import os import platform import sys import warnings from django.conf import settings from django.db import utils from django.db.backends.base.base ...
, 'gte': '>= %s', 'lt': '< %s', 'lte': '<= %s', 'startswith': "LIKE TRANSLATE(%s USING NCHAR_CS) ESCAPE TRANSLATE('\\' USING NCHAR_CS)", 'endswith': "LIKE TRANSLATE(%s USING NCHAR_CS) ESCAPE TRANSLATE('\\' USING NCHAR_CS)", 'istartswith': "LIKE UPPER(TRANSLATE(%s USING NC...
ATE('\\' USING NCHAR_CS)", 'iendswith': "LIKE UPPER(TRANSLATE(%s USING NCHAR_CS)) ESCAPE TRANSLATE('\\' USING NCHAR_CS)", } _likec_operators = _standard_operators.copy() _likec_operators.update({ 'contains': "LIKEC %s ESCAPE '\\'", 'icontains': "LIKEC UPPER(%s) ESCAPE '\\'", ...