code
stringlengths
3
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
3
1.05M
from twisted.internet.protocol import ServerFactory from twisted.python.components import registerAdapter from ldaptor.inmemory import fromLDIFFile from ldaptor.interfaces import IConnectedLDAPEntry from ldaptor.protocols.ldap.ldapserver import LDAPServer from cStringIO import StringIO """ This is a pure Python implem...
slipeer/synapse-ldap-password-provider
tests/ldap_server.py
Python
apache-2.0
2,667
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
fengbeihong/tempest_automate_ironic
tempest/api/network/base.py
Python
apache-2.0
18,134
# -*- coding: utf-8 -*- from jpnetkit.weblio import Weblio class TestWeblio: """Test Weblio""" def test_can_get_definitions(self): """Test that we can get definitions from Weblio""" word = u'妖精' examples = Weblio().examples(word) assert len(examples) == 4 for example,...
Xifax/jp-net-kit
jpnetkit/test/weblio_test.py
Python
bsd-2-clause
393
#!/usr/bin/python import os import re import sys import traceback import hooking ''' scratchpad vdsm hook ==================== Hook creates a disk for a VM onetime usage, the disk will be erased when the VM destroyed. VM cannot be migrated when using scratchpad hook syntax: scratchpad=size,path ie: scra...
futurice/vdsm
vdsm_hooks/scratchpad/before_vm_start.py
Python
gpl-2.0
3,936
""" Meraki API Testing module. """ import unittest # The context.py file on this folder sets up the context for the test case. from context import MerakiAPI KEY = "SOME_KEY" ORGANIZATION_ID = 1234 class TestMerakiApi(unittest.TestCase): """ Meraki API test case. """ def test_organizations_index(self): ...
guzmonne/meraki_api
tests/test_organizations.py
Python
mit
5,092
# # Copyright (c) 2012 Will Page <compenguy@gmail.com> # Derivative of VantagePro.py and wmrx.py, credit to Tom Keffer <tkeffer@gmail.com> # # See the file LICENSE.txt for your full rights. # # $Revision: 841 $ # $Author: compenguy $ # $Date: 2013-01-20 05:03:14 -0800 (Sun, 20 Jan 2013) $ # """Classes...
hoevenvd/weewx_poller
bin/weewx/WMR918.py
Python
gpl-3.0
17,273
def isPhoneNumber(text): if len(text) != 12: return False for i in range(0,3): if not text[i].isdecimal(): return False if text[3] != '-': return False for i in range(4,7): if not text[i].isdecimal(): return False if text[7] != '-': r...
vdrey/Toolbox
Python/AutomateBoringStuff/isPhoneNumber.py
Python
mit
724
"""Tests for the samsungtv component."""
fbradyirl/home-assistant
tests/components/samsungtv/__init__.py
Python
apache-2.0
41
"""Test script for the dbm.open function based on testdumbdbm.py""" import os import unittest import glob import test.support # Skip tests if dbm module doesn't exist. dbm = test.support.import_module('dbm') try: from dbm import ndbm except ImportError: ndbm = None _fname = test.support.TESTFN # # Iterates...
timm/timmnix
pypy3-v5.5.0-linux64/lib-python/3/test/test_dbm.py
Python
mit
5,779
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsRasterBandComboBox. .. note:: 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....
geopython/QGIS
tests/src/python/test_qgsrasterbandcombobox.py
Python
gpl-2.0
3,809
""" sentry.plugins.bases.notify ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import logging from django import forms from sentry.app import ( digests...
mitsuhiko/sentry
src/sentry/plugins/bases/notify.py
Python
bsd-3-clause
5,617
#!/usr/bin/python import time import serial import avr_control #Set of commands to control esp 8266 #Connects to the pstorm server #and gets back some data # # def ser_check_reply(ser1, s1, s2): c= ser1.read(10000) print("Line is: " + c) if (s1 in c) or (s2 in c): return 'success' else: ...
dsiganos/motoplug
esp.py
Python
gpl-3.0
1,519
# -*- coding: utf-8 -*- from django.conf.urls import url from . import views urlpatterns = [ url(r"^$", views.events_view, name="events"), url(r"^/add$", views.add_event_view, name="add_event"), url(r"^/request$", views.request_event_view, name="request_event"), url(r"^/modify/(?P<id>\d+)$", views.mo...
jacobajit/ion
intranet/apps/events/urls.py
Python
gpl-2.0
791
#!/usr/bin/python3 #TODO: проверять первый запуск. записывать ежедневный файл, поставить в авто запуск и смотреть есть ли запись за сегодня и предлагать уже в зависимости. import os import subprocess import sys import time work_dir = sys.path[0] lib_dir = os.path.join(work_dir, './lib') sys.path.append('./weather') sys...
anokata/pythonPetProjects
_autostart.py
Python
mit
4,367
# # Paasmaker - Platform as a Service # # 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/. # import unittest import json import datetime import uuid import hashlib import ...
kaze/paasmaker
paasmaker/model.py
Python
mpl-2.0
61,296
#! /usr/bin/env python2 # -*- coding: utf-8 -*- from __future__ import (unicode_literals, absolute_import, division) import datetime as dt from collections import namedtuple import requests import re from threading import Thread import traceback import socket import sys import xbmc import websocket from chromote impo...
eirki/script.service.koalanrk
lib/playback.py
Python
mit
10,972
"""scandir, a better directory iterator and faster os.walk(), now in the Python 3.5 stdlib scandir() is a generator version of os.listdir() that returns an iterator over files in a directory, and also exposes the extra information most OSes provide while iterating files in a directory (such as type and stat informatio...
fabioz/Pydev
plugins/org.python.pydev.core/pysrc/_pydev_bundle/fsnotify/scandir_vendored.py
Python
epl-1.0
26,249
# # Copyright (C) 2008 The Android Open Source Project # # 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 la...
Himmele/git-repo
subcmds/init.py
Python
apache-2.0
13,495
from sakura.common.errors import APIRequestErrorOfflineDaemon, APIRequestError from sakura.daemon.processing.plugs.base import PlugBase class InputPlug(PlugBase): def __init__(self, operator, label, required = True, on_change = None): super().__init__() self.label = label self.source_plug =...
eduble/panteda
sakura/daemon/processing/plugs/input.py
Python
gpl-3.0
2,152
# Copyright (C) 2010-2012 Red Hat, Inc. # This work is licensed under the GNU GPLv2 or later. # To test console mutual exclusivity import libvirt from libvirt import libvirtError from exception import TestError from libvirttestapi.src import sharedmod required_params = ('guestname',) optional_params = {'device': 'se...
libvirt/libvirt-test-API
libvirttestapi/repos/domain/console_mutex.py
Python
gpl-2.0
2,726
from pysnmp.entity import engine, config from pysnmp.carrier.asynsock.dgram import udp from pysnmp.entity.rfc3413 import ntforg, context from pysnmp.proto.api import v2c # Create SNMP engine instance snmpEngine = engine.SnmpEngine() # SecurityName <-> CommunityName mapping config.addV1System(snmpEngine, 'my-area', 'p...
HuaweiSNC/OPS2
src/python/manager/trap/snmpagent.py
Python
mit
2,125
############################################################################# ## ## Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com> ## ## This file is part of PyQt5. ## ## This file may be used under the terms of the GNU General Public License ## version 3.0 as published by the Free Softw...
baoboa/pyqt5
pyuic/uic/port_v3/string_io.py
Python
gpl-3.0
1,060
from Components.HTMLComponent import HTMLComponent from Components.GUIComponent import GUIComponent from Components.VariableText import VariableText from enigma import eLabel from Tools.NumericalTextInput import NumericalTextInput #import os class Input(VariableText, HTMLComponent, GUIComponent, NumericalTextInput):...
sklnet/beyonwiz-enigma2
lib/python/Plugins/Extensions/FileCommander/Inputmod.py
Python
gpl-2.0
6,786
#!/usr/bin/env python3 import gi gi.require_version('Gimp', '3.0') from gi.repository import Gimp from gi.repository import GObject def run_plug_in(name, *args): # run-mode, if present, must be the first argument. if type(args[0]) is gi.repository.Gimp.RunMode: run_mode = args[0] args = args...
akkana/gimp-plugins
3.0/gimphelpers.py
Python
gpl-2.0
1,121
import numpy as np import syft __all__ = [ 'equal', 'TensorBase', ] def _ensure_ndarray(arr): if not isinstance(arr, np.ndarray): arr = np.array(arr) return arr def _ensure_tensorbase(tensor): if not isinstance(tensor, TensorBase): tensor = TensorBase(tensor) return tensor d...
cypherai/PySyft
syft/tensor.py
Python
apache-2.0
13,072
import urllib.request URL = "http://www.example.com/login.html" # 설명을 위한 코드라고 함 auth_handler = urllib.request.HTTPBasicAuthHandler() auth_handler.add_password(realm='PDQ Application', uri='https://mahler:8092/site-updates.py', user='klem', ...
gnidoc327/django_web_dev_chater_2
src/client/urllib_ex/auth35.py
Python
mit
512
#!/usr/bin/env python3 """Unit tests for pyvxl.vxl.""" import pytest from time import sleep from random import random from pyvxl import VxlCan from pyvxl.vxl import Vxl, VxlChannel, BUS_TYPE_CAN, BUS_TYPE_LIN from pyvxl import vxl as vxl_file @pytest.fixture def vxl(): """Test fixture for pyvxl.vxl....
cmcerove/pyvxl
pyvxl/tests/test_vxl.py
Python
mit
12,959
import numpy as np import tables import matplotlib.pyplot as plt from util.ObsFile import ObsFile import os import hotpix.hotPixels as hp from util.FileName import FileName from util.popup import plotArray,PopUp import astrometry.CentroidCalc as cc import multiprocessing from photonlist.photlist import writePhotonList ...
bmazin/ARCONS-pipeline
examples/Pal2014-J0337/writePhotLists.py
Python
gpl-2.0
3,340
import unittest import os import __builtin__ from katello.tests.core.action_test_utils import CLIOptionTestCase, CLIActionTestCase from katello.tests.core.organization import organization_data from katello.tests.core.template import template_data import katello.client.core.template from katello.client.core.template i...
beav/katello
cli/test/katello/tests/core/template/template_import_test.py
Python
gpl-2.0
2,327
# Copyright 2013 The Swarming Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 that # can be found in the LICENSE file. """subprocess42 is the answer to life the universe and everything. It has the particularity of having a Popen implementation that can yield o...
m0ppers/arangodb
3rdParty/V8/V8-5.0.71.39/tools/swarming_client/utils/subprocess42.py
Python
apache-2.0
19,552
# # 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...
aosagie/spark
python/pyspark/streaming/tests/test_dstream.py
Python
apache-2.0
24,164
from . import prediction import sys sys.modules["prediction"] = prediction
bdzimmer/handwriting
handwriting/__init__.py
Python
bsd-3-clause
75
# Copyright Xavier Pouyollon 2013-2014 # GPL v3 License import bottle import argparse import soundplayer import dmxhandler import models import sessionsq import uuid import scenes import os from subprocess import call from bottle import route, run, request, abort, static_file app = bottle.Bottle() args = {} sessio...
XavierP56/Cameleon
src/scenic.py
Python
gpl-3.0
8,162
__author__ = 'moskupols' import os from hb_res.storage import get_storage, FileExplanationStorage from preparation import modifiers from preparation.resources.Resource import gen_resource, applied_modifiers CUR_DIR = os.path.dirname(os.path.abspath(__file__)) INPUT_PATH = os.path.join(CUR_DIR, 'Selected.asset') OUTP...
hatbot-team/hatbot_resources
preparation/selection/apply_missed_modifiers.py
Python
mit
917
#!/usr/bin/python from datetime import * from ccalculator import * """ planets_cal=array("Sun","Moon","Moon_Node","Apogee","Mercury", "Venus","Mars","Jupiter","Saturn","Uranus","Neptune","Pluto", "Chiron","Quaoar","Sedna","Sgr AGalCtr");""" planets_cal=["Sun","Moon","Moon_Node","Mercury","Venus","Mars","Jupi...
sandeva/appspot
astro/common/calculator.py
Python
apache-2.0
4,063
#!/usr/bin/env ambari-python-wrap """ 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...
odpi/bigtop
bigtop-packages/src/common/ambari/ODPi/1.0/services/stack_advisor.py
Python
apache-2.0
104,340
# -*- coding: utf-8 -*- from __future__ import absolute_import from celery.schedules import crontab from configurations import values from froide.settings import Base from froide.settings import ThemeBase from froide.settings import os_env import os import re rec = lambda x: re.compile(x, re.I | re.U) class UipaOr...
CodeforHawaii/uipa_org
uipa_org/settings.py
Python
mit
20,233
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyDictdiffer(PythonPackage): """Dictdiffer is a helper module that helps you to diff and p...
LLNL/spack
var/spack/repos/builtin/packages/py-dictdiffer/package.py
Python
lgpl-2.1
782
from PyQt5 import QtGui, QtCore, QtWidgets from ob_menu_qt.ui.obmenuwidget import ObMenuWidget from ob_menu_qt.ui.aboutwidget import ObAboutWidget class UiMainWindow(QtWidgets.QMainWindow): def __init__(self, version, auto_configure=True, icon_path=None, file_path=None): """ Constructs the main wi...
shaggyz/obmenu-qt
ob_menu_qt/ui/main.py
Python
gpl-2.0
7,905
__source__ = 'https://leetcode.com/problems/number-of-lines-to-write-string/' # Time: O(S.length) # Space: O(1) # # Description: Leetcode # 806. Number of Lines To Write String # # We are to write the letters of a given string S, # from left to right into lines. Each line has maximum width 100 units, # and if writing ...
JulyKikuAkita/PythonPrac
cs15211/NumberofLinesToWriteString.py
Python
apache-2.0
3,035
from qlearning4k.agents.agents_twenty48 import * from qlearning4k.games.twenty48 import Twenty48 import os.path from multiprocessing import Pool def do_agent(i): def num_zeros_border(state): return num_zeros(state) + np_on_edge(state) def all_heuristics(state): return num_zeros(state) + np_on_...
bhillmann/2048-rl
examples/experiment_agents/run_baseline_agents.py
Python
mit
1,100
import os import sys from clarifai.client import ClarifaiApi import win32api, win32con def click(x,y): win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0) def main(argv): clarifai_api = ClarifaiApi() # assumes...
dlchiang/recaptchaclarifai
script.py
Python
mit
2,605
# coding=utf-8 from model_utils import Choices EXPORT_STATUS = Choices( ("CREATED", "created", "created"), ("FAILED", "failed", "failed"), ("STARTED", "started", "started") )
ministryofjustice/cla_backend
cla_backend/apps/reports/constants.py
Python
mit
181
from datasift import ( DataSiftUser, DataSiftDefinition, DataSiftStream, DataSiftStreamListener )
msmathers/datasift-python
__init__.py
Python
mit
105
# -*- coding: utf-8 -*- ## ## ## This file is part of Indico. ## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN). ## ## Indico 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; eith...
Ictp/indico
indico/MaKaC/webinterface/pages/base.py
Python
gpl-3.0
9,937
## Merge series together from copy import copy import pandas as pd import datetime from syscore.dateutils import SECONDS_PER_DAY from syscore.objects import arg_not_supplied, named_object from sysdata.config.production_config import get_production_config class mergeStatus(object): def __init__(self, text): ...
robcarver17/pysystemtrade
syscore/merge_data.py
Python
gpl-3.0
21,597
# This file is part of Merlin. # Merlin is the Copyright (C)2008,2009,2010 of Robin K. Hansen, Elliot Rosemarine, Andreas Jacobsen. # Individual portions may be copyright by individual contributors, and # are included in this collective work with permission of the copyright # owners. # This program is free software; ...
ellonweb/merlin
Core/router.py
Python
gpl-2.0
4,260
# -*- coding: utf-8 -*- """ Created on Wed Jun 01 21:37:20 2016 @author: Administrator """ import pandas as pd import pandas.io.sql as pd_sql import sqlite3 as sql df_file_all = pd.read_csv('../data/CS_table_No2_No4_new.csv',delimiter=";", skip_blank_lines = True, error_bad_lines=False,encoding='ut...
wasit7/book_pae
pae/final_code/src/convert_sub_home_name_tojson.py
Python
mit
5,762
# from . import initialize_settings # add the following to operations in migrations # migrations.RunPython(initialize_settings), def initialize_settings(apps, schema_editor): SettingsCategory = apps.get_model('tethys_compute', 'SettingsCategory') Setting = apps.get_model('tethys_compute', 'Setting') ...
CI-WATER/django-tethys_compute
tethys_compute/migrations/__init__.py
Python
bsd-2-clause
762
from dataclasses import dataclass from typing import Dict import pytest from nassl.ssl_client import ClientCertificateRequested from sslyze.plugins.http_headers_plugin import ( HttpHeadersImplementation, HttpHeadersScanResult, _detect_http_redirection, HttpHeadersScanResultAsJson, ) from sslyze.serve...
nabla-c0d3/sslyze
tests/plugins_tests/test_http_headers_plugin.py
Python
agpl-3.0
8,841
#!/usr/bin/env python """Return frequency of kmers present in a fasta file Usage: python fasta_count_kmer.py genome_file kmer_length """ # Importing modules from signal import signal, SIGPIPE, SIG_DFL from collections import defaultdict import sys # Defining classes class Fasta(object): """Fasta object with ...
wkh124/wkh124
fasta_count_kmers.py
Python
gpl-3.0
1,809
from setuptools import setup import sys,os inst_requires = ['numpy>=1.10', 'pandas>=0.20', 'seaborn>=0.7', 'scikit-learn>=0.23.2', 'pyfaidx>=0.5.4', 'pysam>=0.10.0', 'HTSeq>=0.6', ...
dmnfarrell/smallrnaseq
setup.py
Python
gpl-3.0
1,729
from zeit.cms.content.util import objectify_soup_fromstring from zeit.cms.i18n import MessageFactory as _ import HTMLParser import lxml.etree import lxml.objectify import xml.dom.minidom import zeit.cms.content.cmssubset import zope.interface import zope.location.location import zope.proxy import zope.schema import zop...
ZeitOnline/zeit.cms
src/zeit/cms/content/field.py
Python
bsd-3-clause
4,076
import predictionio client = predictionio.Client(appkey="rraLZVM7xUiBX30jvOM3vgz16Wbr1MnJ8pLibo1Mj4r2bVmgrbaEdrlIrcZKOnPr") # Recommend 5 items to each user user_ids = [str(x) for x in range(1, 6)] for user_id in user_ids: print "Most used route for ", user_id try: client.identify(user_id) rec...
joemathai/snippets
Python/traffic_ML/show.py
Python
mit
479
''' Created on 07/10/2013 @author: felipelindemberg ''' import unittest import os import sys lib_path = os.path.abspath('../') sys.path.append(lib_path) try: from Comodo.Room import * # @UnusedWildImport except ImportError: from trunk.Comodo.Room import * # @UnusedWildImport class TesteComodo(unittest.Tes...
felipelindemberg/ControleMultimidiaUniversal
Python_Controle_Multimidia_Universal/trunk/Tests/TesteComodo.py
Python
apache-2.0
2,801
# Copyright (C) 2012-2013,2015 Codethink Limited # # 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; version 2 of the License. # # This program is distributed in the hope that it will be useful, ...
nuxeh/morph
morphlib/repoaliasresolver_tests.py
Python
gpl-2.0
5,961
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 NEC Corporation # # 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 #...
neumerance/deploy
openstack_dashboard/dashboards/admin/networks/tests.py
Python
apache-2.0
36,453
NAME = 'emperor_amqp' CFLAGS = [] LDFLAGS = [] LIBS = [] GCC_LIST = ['amqp', 'emperor_amqp']
Ashald/uwsgi
plugins/emperor_amqp/uwsgiplugin.py
Python
gpl-2.0
95
""" Finite Discrete Random Variables Module See Also ======== diofant.stats.frv_types diofant.stats.rv diofant.stats.crv """ import random from itertools import product from ..core import Dict, Eq, Expr, Lambda, Mul, Symbol, Tuple, cacheit, sympify from ..functions import Piecewise from ..logic import And, Or from ...
diofant/diofant
diofant/stats/frv.py
Python
bsd-3-clause
9,812
__author__ = """Copyright Martin J. Bligh, 2006, Copyright IBM Corp. 2006, Ryan Harper <ryanh@us.ibm.com>""" import os, shutil, copy, pickle, re, glob from autotest_lib.client.bin import kernel, kernel_config, os_dep, test from autotest_lib.client.bin import utils class xen(kernel.kernel): def l...
yochow/autotest
client/bin/xen.py
Python
gpl-2.0
7,532
"""This section introduces classes used by pulsar :ref:`wsgi application <apps-wsgi>` to pass a request/response state during an HTTP request. .. contents:: :local: The :class:`WsgiRequest` is a thin wrapper around a WSGI ``environ`` dictionary. It contains only the ``environ`` as its private data. The :class:`Ws...
quantmind/pulsar
pulsar/apps/wsgi/wrappers.py
Python
bsd-3-clause
13,989
"""hotac_tracker URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Cla...
sheepeatingtaz/hotac-tracker
campaign/urls/mission.py
Python
mit
827
# -*- coding: utf-8 -*- # # escpos/retry.py # # Copyright 2018 Base4 Sistemas Ltda ME # # 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 # # Un...
base4sistemas/pyescpos
escpos/retry.py
Python
apache-2.0
4,778
"""This Admin class turns the background of a Person's first name pink if its first name doesn't start with a capital""" from PyQt4.QtGui import QColor from camelot.model.authentication import Person def first_name_background_color(person): import string if person.first_name: if person.first_name[0] ...
kurtraschke/camelot
test/snippet/background_color.py
Python
gpl-2.0
497
# Django from django import template from django.utils.safestring import mark_safe register = template.Library() @register.simple_tag def print_none(obj): if obj is None: return '' else: return str(obj) HTML_GLOBAL_ATTRS = ['accesskey', 'class', 'cont...
DISBi/django-disbi
disbi/templatetags/custom_template_tags.py
Python
mit
2,240
import subprocess from utlz import func_has_arg, namedtuple CmdResult = namedtuple( typename='CmdResult', field_names=[ 'exitcode', 'stdout', # type: bytes 'stderr', # type: bytes 'cmd', 'input', ], lazy_vals={ 'stdout_str': lambda self: self.stdout.d...
theno/utlz
utlz/cmd.py
Python
mit
2,420
######### # Copyright (c) 2016 GigaSpaces Technologies Ltd. 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...
cloudify-cosmo/cloudify-agent
cloudify_agent/installer/runners/local_runner.py
Python
apache-2.0
2,455
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def constructMaximumBinaryTree(self, nums): """ :type nums: List[int] :rtype: TreeNode "...
qiyuangong/leetcode
python/654_Maximum_Binary_Tree.py
Python
mit
1,293
# coding=utf-8 from __future__ import unicode_literals from django.shortcuts import redirect from django.views.generic import TemplateView from django.contrib.auth import logout from imager.settings import STATIC_URL from imager_images.models import Photo, Album from imager_profile.models import ImagerProfile from djan...
jmcclena94/django-imager
imager/imager/views.py
Python
mit
7,709
import os from setuptools import setup, find_packages name = 'caliopen_website' here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'README.rst')) as f: README = f.read() with open(os.path.join(here, 'CHANGES.rst')) as f: CHANGES = f.read() requires = [ 'pyramid', 'pyramid_...
CaliOpen/caliopen-public-site
setup.py
Python
gpl-3.0
1,071
"""Support for TCP socket based sensors.""" import logging import socket import select import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( CONF_NAME, CONF_HOST, CONF_PORT, CONF_PAYLOAD, CONF_TIMEOUT, CONF_UNIT_OF_MEASUREMENT, CONF_VALUE_TEMPLA...
MartinHjelmare/home-assistant
homeassistant/components/tcp/sensor.py
Python
apache-2.0
4,695
""""ML-ENSEMBLE Testing suite for Layer and Transformer """ from mlens.testing import Data, EstimatorContainer, get_layer, run_layer def test_fit(): """[Parallel | Layer | Threading | Stack | No Proba | No Prep] test fit""" args = get_layer('fit', 'threading', 'stack', False, False) run_layer(*args) de...
flennerhag/mlens
mlens/parallel/tests/test_b2_layer_stack.py
Python
mit
3,130
#!/usr/bin/env python # # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, ...
datalogics/scons
test/Perforce/P4COMSTR.py
Python
mit
4,112
"""engine.SCons.Variables.PackageVariable This file defines the option type for SCons implementing 'package activation'. To be used whenever a 'package' may be enabled/disabled and the package path may be specified. Usage example: Examples: x11=no (disables X11 support) x11=yes (will search for the...
engineer0x47/SCONS
engine/SCons/Variables/PackageVariable.py
Python
mit
3,559
#!/usr/bin/env python """ Python Character Mapping Codec for ROT13. This codec de/encodes from str to str. Written by Marc-Andre Lemburg (mal@lemburg.com). """ import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self, input, errors='strict'): return (str.translate(input, ro...
prefetchnta/questlab
bin/x64bin/python/37/Lib/encodings/rot_13.py
Python
lgpl-2.1
2,561
""" Base model used for products. Stores hierarchical categories as well as individual product level information which includes options. """ from decimal import Context, Decimal, ROUND_FLOOR from django import forms from django.conf import settings from django.contrib.sites.models import Site from django.core import u...
mitchellzen/pops
satchmo/apps/product/models.py
Python
bsd-3-clause
62,983
""" pifacecad.py Provides I/O methods for interfacing with the RaspberryPi human interface Copyright (C) 2013 thomasmarkpreston@gmail.com 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 versio...
nach00/Test4
pifacecad/__init__.py
Python
gpl-3.0
1,145
from __future__ import annotations import os import procrunner import pytest from dxtbx.model.experiment_list import ExperimentListFactory def plot_beam_centre_error(ideal_bc, obs_bc): import matplotlib.pyplot as plt ideal_x, ideal_y = zip(*ideal_bc) obs_x, obs_y = zip(*obs_bc) del_x = [a - b for ...
dials/dials
tests/algorithms/refinement/test_scan_varying_beam_refinement.py
Python
bsd-3-clause
2,914
# -*- python -*- # -*- coding: utf-8 -*- # # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2011-2016 Serge Noiraud # # 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 ver...
sam-m888/gramps
gramps/plugins/view/geofamclose.py
Python
gpl-2.0
36,568
#Alex Holcombe alex.holcombe@sydney.edu.au #See the github repository for more information: https://github.com/alexholcombe/twoWords from __future__ import print_function from psychopy import monitors, visual, event, data, logging, core, sound, gui import psychopy.info import numpy as np from math import atan, log, cei...
alexholcombe/twoWords
specialFieldsStudentCode/twoWordsExperimentInvertedbackMayAlexContinue.py
Python
mit
52,568
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-15 18:35 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('restaurant', '0016_auto_20170215_1800'), ] operations = [ migrations.AlterModelOpti...
midhun3112/restaurant_locator
Restaurant_Finder_App/restaurant_finder_app/restaurant_finder_app/restaurant/migrations/0017_auto_20170215_1835.py
Python
apache-2.0
454
# # 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...
markflyhigh/incubator-beam
sdks/python/apache_beam/runners/portability/expansion_service.py
Python
apache-2.0
4,082
# This file is distributed under the terms of the GNU General Public license. # Copyright (C) 2018 Erik Ogenvik (See the file COPYING for details). import server from atlas import Operation, Entity from world.utils import Usage from world.StoppableTask import StoppableTask def sow(instance): Usage.set_cooldown_...
worldforge/cyphesis
data/rulesets/deeds/scripts/world/objects/tools/Trowel.py
Python
gpl-2.0
1,592
import numpy def oversample(images, crop_dims): """Crop an image into center, corners, and mirror images.""" # Dimensions and center. channels, src_h, src_w = images[0].shape cy, cx = src_h / 2.0, src_w / 2.0 dst_h, dst_w = crop_dims # Make crop coordinates crops_ix = numpy.empty((5, 4),...
rezoo/chainer
chainer/utils/imgproc.py
Python
mit
992
############################################################################## # adaptiveMD: A Python Framework to Run Adaptive Molecular Dynamics (MD) # Simulations on HPC Resources # Copyright 2017 FU Berlin and the Authors # # Authors: Jan-Hendrik Prinz # Contributors: # # `adaptiveMD` is free software: ...
thempel/adaptivemd
adaptivemd/mongodb/base.py
Python
lgpl-2.1
9,063
import csv from collections import defaultdict import StringIO from google.appengine.ext import blobstore from google.appengine.ext.webapp import blobstore_handlers from jinja_template import JinjaTemplating from google.appengine.ext import db from google.appengine.api import memcache from questions_details_from_google...
HadiOfBBG/pegasusrises
cron_read_data_from_aggregate.py
Python
apache-2.0
3,173
from utils import * NDEBUG = 0 def prn(*args, **kwargs): if not NDEBUG: print(*args, **kwargs) def atom(s): if surrwith(s, '"') or surrwith(s, "'"): return s[1:-1] else: try: return int(s) except: try: return float(s) except: raise ValueError("invalid literal (st...
bapcyk/jsontools
query.py
Python
gpl-2.0
2,764
from ccdc import grid from ccdc import ids from ccdc import timeseries from copy import deepcopy from pyspark import SparkContext from pyspark.sql import SparkSession, SQLContext import ccdc import pytest import test def get_chip_ids_rdd(chipids): sc = SparkSession(SparkContext.get...
USGS-EROS/lcmap-firebird
test/conftest.py
Python
unlicense
1,707
#Kyle Stanfield #Convert decimal integer to binary string and tests def decimalToBinary(x): "Given an integer x, will return an equivalent binary string" binary = "" while x >= 1: binary += str(x%2) x //= 2 return binary[::-1] def test_dec2Bin_1(): assert decimalToBinary(1) == ...
kylestanfield/BaseConversion
decimalToBinary.py
Python
gpl-3.0
640
#!/usr/bin/env python import sys, rospy, actionlib from control_msgs.msg import PointHeadAction, PointHeadGoal if __name__ == '__main__': rospy.init_node('look_at_bin') head_client = actionlib.SimpleActionClient("head_controller/point_head", PointHeadAction) head_client.wait_for_server() goal = PointHeadGo...
osrf/rosbook
stockroom_bot/look_at_bin.py
Python
apache-2.0
601
from os.path import dirname, join from setuptools import setup setup( name='state_chain', author='Chad Whitacre et al.', author_email='team@aspen.io', description="Model algorithms as a list of functions operating on a shared state object.", long_description=open(join(dirname(__file__), 'README.rs...
gratipay/algorithm.py
setup.py
Python
mit
825
# Copyright (c) 2015-2021 Patricio Cubillos and contributors. # mc3 is open-source software under the MIT license (see LICENSE). __all__ = [ 'ROOT', 'ignore_system_exit', 'parray', 'saveascii', 'loadascii', 'savebin', 'loadbin', 'isfile', 'burn', 'default_parnames', ] import os imp...
pcubillos/MCcubed
mc3/utils/utils.py
Python
mit
10,390
import os PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) PROJECT_DIRNAME = PROJECT_ROOT.split(os.sep)[-1] ROOT_URLCONF = "%s.urls" % PROJECT_DIRNAME TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, "templates"),) SECRET_KEY = "hi mom" DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite...
wlanslovenija/django-overextends
test_project/settings.py
Python
bsd-2-clause
527
import nltk import re import pprint def main(): IN = re.compile(r'.*\bin\b(?!\b.+ing)') for doc in nltk.corpus.ieer.parsed_docs('NYT_19980315'): for rel in nltk.sem.extract_rels('ORG', 'LOC', doc, corpus='ieer', pattern=IN): print nltk.sem.relextract.rtuple(rel) if __name__ == "__main__":...
attibalazs/nltk-examples
7.6_Relation_Extraction.py
Python
mit
332
""" Permissions for Content Libraries (v2, Blockstore-based) """ from bridgekeeper import perms, rules from bridgekeeper.rules import Attribute, ManyRelation, Relation, in_current_groups from openedx.core.djangoapps.content_libraries.models import ContentLibraryPermission # Is the user active (and their email verifie...
edx/edx-platform
openedx/core/djangoapps/content_libraries/permissions.py
Python
agpl-3.0
4,141
from django.conf.urls import url from django.contrib.auth.decorators import login_required, permission_required from django.urls import path from . import views app_name = 'home' urlpatterns = [ url(r'^contact_chart/$', views.recent_contact_chart, name='contact_chart'), path( 'sales_sheet/', ...
asterix135/infonex_crm
home/urls.py
Python
mit
474
import logging from datetime import date from ..models import Materia from ..views.sist_acad import parse_materias_aprobadas from .common import BaseUserTestCase logging.disable(logging.CRITICAL) GOOD_LINES = '6108 Analisis Matematico II 9 8 - ocho OBL 20-2-2012 1234 12345 6103\n' # noqa GOOD_LINES +=...
maru/fiubar
fiubar/facultad/tests/test_views_sist_acad.py
Python
mit
3,670
from django.db import models from django.db.models import Q from django.contrib import admin from django.contrib.auth.models import User, Group from django.utils.translation import ugettext_lazy as _ from django.forms.models import model_to_dict from django.utils.timezone import now from django.conf import settings fr...
ipernet/RatticWeb
cred/models.py
Python
gpl-2.0
8,096
from abapy.postproc import FieldOutput, TensorFieldOutput, VectorFieldOutput, Identity_like data11 = [0., 0., 1.] data22 = [0., 0., -1] data12 = [1., 2., 0.] labels = range(1,len(data11)+1) fo11 = FieldOutput(labels = labels, data=data11,position='node') fo22 = FieldOutput(labels = labels, data=data22,position='node') ...
lcharleux/abapy
doc/example_code/postproc/TensoFieldOutput-eigen.py
Python
gpl-2.0
498
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- ### BEGIN LICENSE # Copyright (C) 2014 Brian Douglass bhdouglass@gmail.com # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Softwa...
bhdouglass/agui
agui/aextras/timeout.py
Python
gpl-3.0
1,363