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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# coding=utf-8
from xlrd import open_workbook;
from xlwt import easyxf;
from xlutils.copy import copy;
from xlutils.styles import Styles
class XlsMod:
def __init__(self, name):
self.filename = name;
self.rb = open_workbook(self.filename, formatting_info = True, on_demand = Tr... | gwq5210/python_learn | monitor/XlsMod.py | Python | gpl-2.0 | 1,176 |
#######################################
# NER with NLTK
# Tokenize into sentences
sentences = nltk.sent_tokenize(article)
# Tokenize into words
token_sentences = [nltk.word_tokenize(sent) for sent in sentences]
# parts of speech
pos_sentences = [nltk.pos_tag(sent) for sent in token_sentences]
# named entity chun... | Ventrosky/python-scripts | nlp-scripts/demo-chatbot/ne_recon.py | Python | gpl-3.0 | 2,459 |
"""icopen patch
OVERVIEW
icopen patches MacOS Python to use the Internet Config file mappings to select
the type and creator for a file.
Version 1 released to the public domain 3 November 1999
by Oliver Steele (steele@cs.brandeis.edu).
DETAILS
This patch causes files created by Python's open(filename, 'w') command... | teeple/pns_server | work/install/Python-2.7.4/Lib/plat-mac/icopen.py | Python | gpl-2.0 | 2,068 |
#!/usr/bin/env python
"""
Copyright (C) 2010 David Fong and Michael Saunders
LSMR uses an iterative method.
07 Jun 2010: Documentation updated
03 Jun 2010: First release version in Python
David Chin-lung Fong clfong@stanford.edu
Institute for Computational and Mathematical Engineering
Stanford University
... | JKrehl/Electrons | Electrons/Tomography/Solvers/lsmr.py | Python | isc | 11,404 |
from fabric.api import local, lcd
def test():
with lcd('./bookmarklets'):
local('python manage.py test --settings=bookmarklets.settings.test')
def deploy():
pass | assertnotnull/bookmarklets | fabfile.py | Python | mit | 181 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from pants_test.contrib.python.checks.checker.plugin_test_base import CheckstylePluginTes... | twitter/pants | contrib/python/tests/python/pants_test/contrib/python/checks/checker/test_pyflakes.py | Python | apache-2.0 | 1,425 |
""" Driver that listens to the serial port to receive the data from the Wii Nunchuck.
The Arduino code to get the data from the device is here: https://github.com/Butakus/NunchuckController
"""
from nunchuck_limits import *
import serial
from time import sleep
from threading import Thread
class NunchuckDriver(T... | Butakus/Roberto | master/src/roberto_teleop/src/nunchuck_driver/nunchuck_driver.py | Python | gpl-3.0 | 2,850 |
#!/usr/bin/env python
# The MIT License (MIT)
# Copyright (c) 2017 Ishit Mehta
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR... | mpatacchiola/deepgaze | examples/ex_cnn_cascade_training_face_detection/nms.py | Python | mit | 2,690 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import pytest
@pytest.mark.online
class TestNfoLookupWithMovies(object):
base = "nfo_lookup_test_dir/"
config = """
tasks:
... | jawilson/Flexget | flexget/tests/test_nfo_lookup.py | Python | mit | 14,992 |
#
# Created January 2008 by Pearu Peterson
#
""" Provides Calculus class.
"""
__docformat__ = "restructuredtext"
__all__ = ['Calculus', 'I']
from ..core import classes, defined_functions
from ..utils import TERMS, str_PRODUCT, SYMBOL, NUMBER
from ..heads import APPLY, CALLABLE, TERM_COEFF, TERM_COEFF_DICT
from ..heads... | pearu/sympycore | sympycore/calculus/algebra.py | Python | bsd-3-clause | 11,505 |
from __future__ import absolute_import, print_function, division
from copy import copy, deepcopy
from functools import wraps
import logging
import sys
import unittest
from nose_parameterized import parameterized
from six import integer_types
from six.moves import StringIO
try:
from nose.plugins.attrib import attr... | Weihonghao/ECM | Vpy34/lib/python3.5/site-packages/theano/tests/unittest_tools.py | Python | agpl-3.0 | 16,692 |
# This file is part of Buildbot. Buildbot 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.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | wainersm/buildbot | master/buildbot/test/unit/test_worker_base.py | Python | gpl-2.0 | 22,347 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import string
from collections import namedtuple
from sqlalchemy.ext.declarative import declared_attr
fr... | pferreir/indico | indico/core/db/sqlalchemy/colors.py | Python | mit | 3,614 |
#
# 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... | ueshin/apache-spark | python/pyspark/mllib/random.py | Python | apache-2.0 | 19,614 |
import os
import json
from django.db import transaction
import requests
from django.db.models.signals import post_save
from django.http import HttpResponse
from django.utils.http import urlquote
from django.contrib.auth.models import User
from analytics.models import Algorithm, Category
from linda_app.models import g... | LinDA-tools/LindaWorkbench | linda/linda_app/installer/views.py | Python | mit | 11,816 |
# set encoding=utf-8
from logging import getLogger
log = getLogger('robokassa.view')
from django.views.generic import RedirectView, View
from django.shortcuts import get_object_or_404
from django.db.models import get_model
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponse... | temaput/django-oscar-robokassa | robokassa/views.py | Python | mit | 6,379 |
#------------------------------------------------------------------------------
# direncrypt - Sync contents between encrypted and decrypted directories
# Copyright (C) 2015 Domagoj Marsic
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... | dmarsic/direncrypt | test/test_fileops.py | Python | gpl-3.0 | 2,406 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_qm_about.ui'
#
# Created: Mon Mar 12 16:01:29 2012
# by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Att... | tsw-apropos/qmarxan | ui_qm_about.py | Python | gpl-2.0 | 4,972 |
#!/usr/bin/env python3
# Questo file modifica chiavi "sets" redis
# Predisposto per gruppi di I (input)
# Serve per la parte di gestione html in python
import cgi
import cgitb
# Abilita gli errori al server web/http
cgitb.enable()
# Le mie librerie mjl (Json, Files), mhl (Html), flt (T w/ Redis)
import mjl, mhl, fl... | raspibo/Livello1 | var/www/cgi-bin/changesetsredis.py | Python | mit | 4,398 |
"""Sensor for the CityBikes data."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant.components.sensor import ENTITY_ID_FORMAT, PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION, ATTR_ID, ATTR_LATITUDE, A... | MartinHjelmare/home-assistant | homeassistant/components/citybikes/sensor.py | Python | apache-2.0 | 10,247 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | wagavulin/arrow | python/benchmarks/microbenchmarks.py | Python | apache-2.0 | 1,610 |
"""Tests to make sure that 'iotile build' works."""
# This file is adapted from python code released by WellDone International
# under the terms of the LGPLv3. WellDone International's contact information is
# info@welldone.org
# http://welldone.org
#
# Modifications to this file from the original created at WellDone... | iotile/coretools | iotilebuild/test/test_iotilebuild/test_scons.py | Python | gpl-3.0 | 16,037 |
#!/usr/bin/env python
import argparse
from datetime import date
import os
import pandas as pd
import sqlite3 as sq
from dbfread import DBF, FieldParser
from pprint import pprint
class DbfUtil():
def __init__(self, argv=None) -> None:
self.dbf = None
self.parseArgs(argv)
@property
def fi... | anselmobd/fo2 | script/dbf_util.py | Python | mit | 7,824 |
# -*- 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):
# Deleting field 'SupplyReservation.supply'
db.delete_column(u'logistics_... | agepoly/truffe2 | truffe2/logistics/migrations/0013_auto__del_field_supplyreservation_supply.py | Python | bsd-2-clause | 18,139 |
import simplejson
# declare direct exports here
loads = simplejson.loads
JSONDecodeError = simplejson.JSONDecodeError
def _simplejson_datetime_serializer(obj):
""" Designed to be passed as simplejson.dumps default serializer.
Serializes dates and datetimes to ISO strings.
"""
if hasattr(obj, 'isoform... | memsql/memsql-mesos | memsql_framework/util/json.py | Python | apache-2.0 | 1,725 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
from units.compat.mock import patch
from ansible.modules.network.cnos import cnos_vlan
from units.modules.utils import set_module_args
from .cnos_module import TestCnosModule, load_fixture
class TestCnosVlan... | sgerhart/ansible | test/units/modules/network/cnos/test_cnos_vlan.py | Python | mit | 1,862 |
"""Simple HTTP Server.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
__version__ = "0.6"
__all__ = ["SimpleHTTPRequestHandler"]
import os
import posixpath
import BaseHTTPServer
import urllib
import urlparse
import cgi
import shutil
... | pymo/pymo | symbian/PythonForS60_1.9.6/module-repo/standard-modules/SimpleHTTPServer.py | Python | mit | 7,106 |
from .mosaic import PixelArt
| indraniel/tinted-mosaic | mosaic/__init__.py | Python | bsd-2-clause | 29 |
#!/usr/bin/env python
import os
import sys
from django.conf import settings as django_settings
from test import settings as test_settings
if __name__ == "__main__":
if not django_settings.configured:
django_settings.configure(test_settings)
from django.core.management import execute_from_command_line... | revpoint/prefs-n-perms | manage.py | Python | mit | 362 |
from __future__ import division
from past.utils import old_div
import astromodels
import numpy as np
import os
import yaml
from threeML.exceptions.custom_exceptions import custom_warnings
from threeML.io.file_utils import sanitize_filename
from threeML.plugin_prototype import PluginPrototype
from threeML.plugins.gamma... | giacomov/3ML | threeML/plugins/FermipyLike.py | Python | bsd-3-clause | 16,461 |
"""
=============================================
A demo of the mean-shift clustering algorithm
=============================================
Reference:
Dorin Comaniciu and Peter Meer, "Mean Shift: A robust approach toward
feature space analysis". IEEE Transactions on Pattern Analysis and
Machine Intelligence. 2002. ... | scikit-learn/scikit-learn | examples/cluster/plot_mean_shift.py | Python | bsd-3-clause | 1,650 |
#!/usr/bin/env python
from clusto import script_helper
import clusto
import simplejson as json
import httplib2
import sys
import os
class AWSCleanup(script_helper.Script):
def __init__(self):
script_helper.Script.__init__(self)
def run(self, args):
servers = dict([(x.name, x) for x in clusto... | simplegeo/clusto-sgext | sgext/commands/aws_cleanup.py | Python | bsd-2-clause | 1,678 |
"""
Generate tf.Records files for the Training of DeeProtein.
"""
import json
import argparse
from helpers import OptionHandler, TFrecords_generator
def main():
with open(FLAGS.config_json) as config_fobj:
config_dict = json.load(config_fobj)
optionhandler = OptionHandler(config_dict)
batchgen = ... | thbuerg/Heidelberg_2017 | DeeProtein/generate_batches.py | Python | mit | 833 |
import os
import sys
from android_base import Android
class _YT911C1ZCP(Android):
SERIAL = "YT911C1ZCP"
TMP_PICTURE="%s_TMP.png" % SERIAL
IP = ""
PORT = ""
NAME = "Xperia A4"
WIDTH = "1280"
HEIGHT = "720"
LOCATE = "H"
EXERCISES_X = "1060"
EXERCISES_Y = "260"
EXERCISES_WID... | TE-ToshiakiTanaka/atve | project/fleet/conf/profile/_YT911C1ZCP.py | Python | mit | 639 |
# pylint: disable=redefined-outer-name
"""NovoEd task tests"""
import pytest
from novoed.tasks import enroll_users_in_novoed_course, unenroll_user_from_novoed_course
from profiles.factories import UserFactory
pytestmark = pytest.mark.django_db
FAKE_COURSE_STUB = "my-course"
@pytest.fixture
def patched_novoed_api(mo... | mitodl/bootcamp-ecommerce | novoed/tasks_test.py | Python | bsd-3-clause | 1,438 |
"""Results of coverage measurement."""
import os
from .backward import iitems, set, sorted # pylint: disable=W0622
from .misc import format_lines, join_regex, NoSource
from .parser import CodeParser
class Analysis(object):
"""The results of analyzing a code unit."""
def __init__(self, cov, code_unit)... | davy39/eric | DebugClients/Python/coverage/results.py | Python | gpl-3.0 | 10,012 |
"""
prompt_toolkit
==============
Author: Jonathan Slenders
Description: prompt_toolkit is a Library for building powerful interactive
command lines in Python. It can be a replacement for GNU
Readline, but it can be much more than that.
See the examples directory to learn about the usage.
... | jonathanslenders/python-prompt-toolkit | prompt_toolkit/__init__.py | Python | bsd-3-clause | 927 |
#-*- coding: iso-8859-1 -*-
# pysqlite2/test/types.py: tests for type conversion and detection
#
# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any ... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/sqlite3/test/types.py | Python | gpl-3.0 | 14,217 |
import random,sys,math
"""Random graph generator
"""
from lab9_ls import *
# a random topology generator
class RandomGraph:
def __init__(self,numnodes=8):
self.numnodes = numnodes
if self.numnodes > 26:
print "Maximum number of nodes = 26"
self.numnodes = 26
elif se... | nonemaw/MATRIX_01 | COMP9335/random_graph.py | Python | gpl-2.0 | 2,915 |
"""CloseSpider is an extension that forces spiders to be closed after certain
conditions are met.
See documentation in docs/topics/extensions.rst
"""
from collections import defaultdict
from twisted.internet import reactor
from scrapy import signals
from scrapy.exceptions import NotConfigured
class CloseSpider(ob... | eLRuLL/scrapy | scrapy/extensions/closespider.py | Python | bsd-3-clause | 2,631 |
import wx
import time
import wx.lib.agw.pybusyinfo as PBI
# Display the dialog Box to enter the address of the video file whose sub you want to download
def ask(parent=None,message='',default_value =''):
dlg = wx.TextEntryDialog(parent,message,caption='SubX',defaultValue=default_value)
dlg.ShowModal()
result = dlg... | irresolute/subX | subX/dialog.py | Python | mit | 710 |
"""
Follow Me activity for Sugar
Copyright (C) 2010 Peter Hewitt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any late... | walterbender/followme | rc_skip_last.py | Python | gpl-3.0 | 1,984 |
import IDLEenvironment
import string
import win32ui
import win32api
import win32con
import keycodes
import sys
import traceback
HANDLER_ARGS_GUESS=0
HANDLER_ARGS_NATIVE=1
HANDLER_ARGS_IDLE=2
HANDLER_ARGS_EXTENSION=3
next_id = 5000
event_to_commands = {}# dict of integer IDs to event names.
command_t... | zhanqxun/cv_fish | pythonwin/pywin/scintilla/bindings.py | Python | apache-2.0 | 5,212 |
import json
import logging
import escher
import tempfile
import os
import uuid
from GEMEditor.base import Settings, restore_state, restore_geometry
from GEMEditor.map.base import MapWrapper, WrongEscherFormat, ESCHER_OPTIONS_LOCAL, replace_css_paths
from GEMEditor.map.ui import Ui_MapListDialog, Ui_TurnoverDialog
from ... | JuBra/GEMEditor | GEMEditor/map/dialog.py | Python | gpl-3.0 | 12,681 |
#!/bin/python3
#
# This Python3 modules declares variables and functions
# useful to postprocess DNS data obtained with dns-channel CPL
# program.
#
# ----------
import numpy as np
from scipy.linalg import solve,solve_banded
import matplotlib as mp
mp.use("Qt4Agg")
import scipy a... | davecats/dns-channel | python-interface/dnsdata.py | Python | gpl-3.0 | 7,176 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 OpenStack, LLC
# 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:... | jcsp/manila | manila/tests/db/fakes.py | Python | apache-2.0 | 1,387 |
from distutils.core import setup
setup(
name='Asa_Lib',
version='1.0.0',
packages=['asa_tests', 'asa_modules', 'asa_modules.users', 'asa_modules.users.tests', 'asa_modules.routing',
'asa_modules.routing.tests', 'asa_modules.access_lists', 'asa_modules.access_lists.tests'],
url='https://gi... | Flexin1981/AsaLib | setup.py | Python | mit | 555 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
class InfinityType:
def __repr__(self) -> str:
return "Infinity"
def __hash__(self) -> int:
return hash(repr(self... | paolodedios/pybuilder | src/main/python/pybuilder/_vendor/pkg_resources/_vendor/packaging/_structures.py | Python | apache-2.0 | 1,629 |
# Copyright (c) 2015-2016 Tigera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | quater/calico-containers | calicoctl/tests/unit/pool_test.py | Python | apache-2.0 | 5,741 |
# -*- coding: utf-8 -*-
from core.generictask import GenericTask
from lib.images import Images
__author__ = 'desmat'
class TensorMrtrix(GenericTask):
def __init__(self, subject):
GenericTask.__init__(self, subject, 'upsampling', 'registration', 'qa')
def implement(self):
dwi = self.getUps... | inej/toad | tasks/10-tensormrtrix.py | Python | gpl-2.0 | 4,399 |
from tensorflow.keras import Input
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer, Activation, BatchNormalization, Convolution2D, Dense, Flatten, MaxPooling2D, AveragePooling2D, \
add
from tensorflow.keras.models import Sequential
from tensorflow.keras.regularizers import l2
from tenso... | apacha/MusicSymbolClassifier | ModelTrainer/models/ResNet4Configuration.py | Python | mit | 4,193 |
"""
Intersects ... faster. Suports GenomicInterval datatype and multiple
chromosomes.
Copyright: James Taylor james@jamestaylor.org
This code is part of the bx-python package
license: bsd licensed
https://bitbucket.org/james_taylor/bx-python/src/ebf9a4b352d3267303657afd57bd184f379eaf28/lib/bx/intervals/operations/qui... | smartkiwi/interval_calculator | interval_calculator/bx/quicksect.py | Python | mit | 6,110 |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import sys, os.path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from dpark import DparkContext
from dpark.bagel import Vertex, Edge, Bagel
def parse_vertex(line, numV):
fields = l... | windreamer/dpark | examples/pagerank.py | Python | bsd-3-clause | 1,623 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from selenium import webdriver
import os
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutExcep... | OzzieIsaacs/calibre-web | test/test_logging.py | Python | gpl-3.0 | 7,347 |
import time
start = time.time()
def fib():
a, b = 0, 1
while True:
yield a
a, b = b, a + b
f = fib()
for i in range(10000):
d = next(f)
if len(str(d)) == 1000:
print(i)
break
print("t = {:.5f} seg".format(time.time() - start))
# 4782
# t = 0.03068 seg
10... | floppp/programming_challenges | project_euler/001-050/25.py | Python | mit | 344 |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 Licens... | nijel/weblate | weblate/formats/txt.py | Python | gpl-3.0 | 7,847 |
# Giles: game_handle.py
# Copyright 2014 Phil Bordelon
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This ... | sunfall/giles | giles/game_handle.py | Python | agpl-3.0 | 2,118 |
#!/usr/bin/env python
#
# (c) 2016 Paul Durivage <paul.durivage@gmail.com>
# Chris Houseknecht <house@redhat.com>
# James Tanner <jtanner@redhat.com>
#
# This file is part of Ansible.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lic... | GheRivero/ansible | contrib/inventory/docker.py | Python | gpl-3.0 | 34,387 |
#!/usr/bin/env python
# import modules
import os, re, time, sys
from optparse import OptionParser
from netCDF4 import Dataset as nc
from numpy import where, logical_not, logical_and, zeros, double
def create_blank(vars, units, longnames, time, timeunits):
s = 'netcdf blank {\n'
s += 'dimensions:\n\tlongitude ... | glotter/psims | data/tapps/disagg.py | Python | agpl-3.0 | 9,567 |
# (C) British Crown Copyright 2013 - 2014, Met Office
#
# This file is part of cartopy.
#
# cartopy 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)... | ajdawson/cartopy | lib/cartopy/tests/mpl/test_crs.py | Python | lgpl-3.0 | 1,672 |
import time
from django.shortcuts import render
from django.views.decorators.cache import never_cache, cache_control
@never_cache
@cache_control(max_age=0, no_cache=True, no_store=True, must_revalidate=True)
def home(request):
context = {
'initial_data': {'time': time.time()}
}
return render(requ... | iMerica/django-react-uncool | project/public/views.py | Python | mit | 347 |
'''
Build a neural machine translation model with soft attention
'''
import theano
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import cPickle as pkl
import ipdb
import numpy
import copy
import os
import warnings
import sys
import time
import logging
from colle... | vineetm/dl4mt-material | session2/nmt.py | Python | bsd-3-clause | 49,598 |
import sys, traceback
import mal_readline
import mal_types as types
import reader, printer
from env import Env
import core
# read
def READ(str):
return reader.read_str(str)
# eval
def is_pair(x):
return types._sequential_Q(x) and len(x) > 0
def quasiquote(ast):
if not is_pair(ast):
return types._... | hterkelsen/mal | python/stepA_mal.py | Python | mpl-2.0 | 5,838 |
import json
from django.core.cache import cache
from django import template
register = template.Library()
@register.inclusion_tag('football/inclusion_tags/live_scores.html')
def live_scores():
"""
Displays live scores, if there are any - cache-based.
Uses something like this:
[{"AWAYTEAMSCORE":... | praekelt/jmbo-football | football/templatetags/football_tags.py | Python | bsd-3-clause | 1,521 |
# -*- coding: utf-8 -*-
# Project : LM4paper
# Created by igor on 17-1-9 | IgorWang/LM4paper | mixlm/__init__.py | Python | gpl-3.0 | 72 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, OneLogin, Inc.
# All rights reserved.
from base64 import b64decode, b64encode
import json
from os.path import dirname, join, exists
import unittest
from teamcity import is_running_under_teamcity
from teamcity.unittestpy import TeamcityTestRunner
from urlparse import urlpa... | novafloss/python-saml | tests/src/OneLogin/saml2_tests/auth_test.py | Python | mit | 56,002 |
# -*- coding: utf-8 -*-
""" This is the pytest configuration file """
import colorama
import pytest
import sys
from seleniumbase import config as sb_config
from seleniumbase.core import log_helper
from seleniumbase.core import proxy_helper
from seleniumbase.fixtures import constants
def pytest_addoption(parser):
... | mdmintz/SeleniumBase | seleniumbase/plugins/pytest_plugin.py | Python | mit | 34,757 |
# Copyright (C) 2013, Red Hat, Inc.
# All rights reserved.
#
# 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, modif... | tiran/kdcproxy | kdcproxy/config/mit.py | Python | mit | 10,315 |
"""The tests for time_date sensor platform."""
import unittest
import homeassistant.components.time_date.sensor as time_date
import homeassistant.util.dt as dt_util
from tests.async_mock import patch
from tests.common import get_test_home_assistant
class TestTimeDateSensor(unittest.TestCase):
"""Tests the time_... | nkgilley/home-assistant | tests/components/time_date/test_sensor.py | Python | apache-2.0 | 6,733 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from sis_provisioner.models import UwAccount, get_now
from sis_provisioner.tests.dao import new_custom_field
def set_uw_account(uwnetid):
return UwAccount.objects.create(netid=uwnetid,
last_... | uw-it-aca/bridge-sis-provisioner | sis_provisioner/tests/account_managers/__init__.py | Python | apache-2.0 | 1,052 |
"""Doorsensor Support for the Nuki Lock."""
from pynuki import STATE_DOORSENSOR_OPENED
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from . import NukiEntity
from .const import ATTR_NUKI_ID, DATA_COORDINATOR, DATA_LOCKS, DOMAIN as NUKI_DOMAIN
async def ... | home-assistant/home-assistant | homeassistant/components/nuki/binary_sensor.py | Python | apache-2.0 | 1,995 |
from django.utils.functional import memoize
import codecs
import os
cached_nl = {}
nl_base = os.path.dirname(__file__)
def get_wordlist(lang, listname):
try:
wordfile = codecs.open("%s/%s/%s.txt" % (nl_base, lang, listname))
words = [line.strip() for line in wordfile.readlines() if line.strip()]
... | pbarton666/buzz_bot | djangoproj/djangoapp/csc/nl/__init__.py | Python | mit | 3,413 |
"""Base Unit Test Case"""
import unittest
from server.main.api import create_app_blueprint
from server.main import db
from server.tests import config_name
class BaseTestCase(unittest.TestCase):
"""A base class for test setup"""
def create_app(self):
# create a new instance of app
app = create... | mrsan22/Angular-Flask-Docker-Skeleton | server/tests/base.py | Python | mit | 938 |
from views.base_element import Button, Text, EditBox, SilentButton, CheckBox
from views.base_view import BaseView
class KeycardView(BaseView):
def __init__(self, driver):
super().__init__(driver)
self.begin_setup_button = Button(self.driver, translation_id="begin-set-up")
self.connect_card... | status-im/status-react | test/appium/views/keycard_view.py | Python | mpl-2.0 | 3,384 |
# Copyright (c) 2015-2016 Western Digital Corporation or its affiliates.
#
# 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 versio... | samiWaheed/nvme-cli | tests/nvme_compare_test.py | Python | gpl-2.0 | 3,106 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | shail2810/nova | nova/tests/functional/api_sample_tests/test_server_usage.py | Python | apache-2.0 | 2,546 |
#-----------------------------------------------------------------------
#
# Copyright (C) 2000, 2001 by Autonomous Zone Industries
# Copyright (C) 2002 Gregory P. Smith
#
# License: This is free software. You may use this software for any
# purpose including modification/redistribution, so long as
... | quentinlautischer/291MiniProject2 | lib/python3.5/site-packages/bsddb3/dbtables.py | Python | apache-2.0 | 30,208 |
"""Start Home Assistant."""
from __future__ import print_function
import argparse
import os
import platform
import subprocess
import sys
import threading
from typing import List, Dict, Any # noqa pylint: disable=unused-import
from homeassistant import monkey_patch
from homeassistant.const import (
__version__,
... | HydrelioxGitHub/home-assistant | homeassistant/__main__.py | Python | apache-2.0 | 12,576 |
##############
# Standard #
##############
import io
import logging
import tempfile
##############
# External #
##############
import pytest
##############
# Module #
##############
import powermate
#Enable the logging level to be set from the command line
def pytest_addoption(parser):
parser.addoption('... | teddyrendahl/powermate | tests/conftest.py | Python | apache-2.0 | 1,119 |
import retrieve_new
import pipeline
import numpy as np
from sklearn import cross_validation
class BasicClassifier:
''' Simple wrapper class for a sklearn pipeline, with
Multinomial Naive Bayes as the final estimator.
'''
def __init__(self, corpus=None, target=None):
''' Constructs pipeline, a... | yarbroughw/JMDE | JMDE/basicclassifier.py | Python | mit | 2,240 |
# -*- coding: utf-8 -*-
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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
#
# U... | schristakidis/p2ner | p2ner/components/pipeelement/blockheaderelement/setup.py | Python | apache-2.0 | 2,186 |
from __future__ import with_statement
import re
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config fil... | mazvv/travelcrm | alembic/env.py | Python | gpl-3.0 | 2,509 |
# Python - 2.7.6
def gen_test_case(inp, res):
test.assert_equals(generate_link(inp), res, inp)
test.describe('Basic Tests')
gen_test_case('matt c', 'http://www.codewars.com/users/matt%20c')
gen_test_case('g964', 'http://www.codewars.com/users/g964')
gen_test_case('GiacomoSorbi', 'http://www.codewars.com/users/Gi... | RevansChen/online-judge | Codewars/8kyu/generate-user-links/Python/test.py | Python | mit | 481 |
from __future__ import unicode_literals
from ..phone_number import Provider as PhoneNumberProvider
class Provider(PhoneNumberProvider):
formats = (
'040 ### ###',
'041 ### ###',
'031 ### ###',
'030 ### ###',
'070 ### ###',
'01 #### ###',
'02 #### ###',
... | DonHilborn/DataGenerator | faker/providers/sl_SI/phone_number.py | Python | mit | 413 |
import zlib
def main(request, response):
if b"content" in request.GET:
output = request.GET[b"content"]
else:
output = request.body
output = zlib.compress(output, 9)
headers = [(b"Content-type", b"text/plain"),
(b"Content-Encoding", b"deflate"),
(b"X-Requ... | chromium/chromium | third_party/blink/web_tests/external/wpt/xhr/resources/zlib.py | Python | bsd-3-clause | 709 |
from docutils.parsers.rst import directives
from sphinx.util.docutils import SphinxDirective
from docutils import nodes
import os
import importlib.util
class K3D_Plot(SphinxDirective):
""" Sphinx class for execute_code directive
"""
has_content = False
required_arguments = 0
optional_arguments = 2... | K3D-tools/K3D-jupyter | docs/source/k3d_directives/plot.py | Python | mit | 1,492 |
import argparse
from itertools import count
import gym
import scipy.optimize
import torch
from models import *
from replay_memory import Memory
from running_state import ZFilter
from torch.autograd import Variable
from trpo import trpo_step
from utils import *
torch.utils.backcompat.broadcast_warning.enabled = True
... | brain-research/mirage-rl-trpo | main.py | Python | mit | 6,305 |
"""
use this script if you want to manually (and synchronously) execute the sitemap task
~~Sitemap:Script->Sitemap:Feature~~
"""
from portality.tasks import sitemap
from portality.core import app
from portality.background import BackgroundApi
if __name__ == "__main__":
user = app.config.get("SYSTEM_USERNAME")
... | DOAJ/doaj | portality/scripts/sitemap.py | Python | apache-2.0 | 513 |
from __future__ import absolute_import
from .snapshot import save_snapshot, load_snapshot_files, load_snapshot, load_ICsnapshot
from .subfind import SubfindCatalogue
| Lowingbn/iccpy | gadget/__init__.py | Python | mit | 166 |
"""Provides device triggers for sensors."""
import voluptuous as vol
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
from homeassistant.components.device_automation.exceptions import (
InvalidDeviceAutomationConfig,
)
from homeassistant.components.homeassistant.triggers import (
... | rohitranjan1991/home-assistant | homeassistant/components/sensor/device_trigger.py | Python | mit | 7,736 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry.page.actions.all_page_actions import *
from telemetry.page import page as page_module
from telemetry.page import ... | boundarydevices/android_external_chromium_org | content/test/gpu/page_sets/memory_tests.py | Python | bsd-3-clause | 1,037 |
# -*- coding: utf-8 -*-
import hashlib
import sys
from binascii import hexlify, unhexlify
from graphenebase.account import Address as GPHAddress
from graphenebase.account import BrainKey as GPHBrainKey
from graphenebase.account import PasswordKey as GPHPasswordKey
from graphenebase.account import PrivateKey as GPHPri... | xeroc/python-bitshares | bitsharesbase/account.py | Python | mit | 3,307 |
#! /usr/bin/env python
# coding=utf-8
import unittest
from peyotl.amendments.amendments_umbrella import _TaxonomicAmendmentStore
from peyotl.test.support import pathmap
from peyotl.utility import get_logger
_LOG = get_logger(__name__)
test_repos = pathmap.get_test_repos(['mini_amendments'])
@unittest.skipIf(not te... | mtholder/peyotl | tests/local_repos_tests/test_amendments.py | Python | bsd-2-clause | 3,477 |
import sys
import math
import lib
#read inputs
file_csv = sys.argv[1]
file_out = sys.argv[2]
#read csv
FILE = open(sys.argv[1])
T = FILE.read().split('\n')
FILE.close()
<<<<<<< HEAD
M = [line.split(' ') for line in T if line!='']
K = M[0]
print('keys: ('+' '.join(K)+')')
=======
M = [line.split(', ') for line in T i... | JoanThibault/DAGaml | extra/script_dagaml_vs_abc_on_cnf_uf50.py | Python | mpl-2.0 | 2,381 |
#STANDARD LIB
from datetime import datetime
from decimal import Decimal
from itertools import chain
import warnings
#LIBRARIES
from django.apps import apps
from django.conf import settings
from django.db.backends.utils import format_number
from django.db import IntegrityError
from django.utils import timezone
from go... | jscissr/djangae | djangae/db/utils.py | Python | bsd-3-clause | 11,970 |
#!/usr/bin/env python
"""Centralized import point for server plugins.
This acts as a centralized point for modules that need to be loaded for
the server components so that the startup.Init() function will find and
register them.
This also acts as a sensible single place to add deployment specific plugin
modules that ... | wandec/grr | lib/server_plugins.py | Python | apache-2.0 | 1,073 |
##~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~##
## ##
## This file forms part of the Badlands surface processes modelling companion. ##
## ... | badlands-model/pyBadlands-Companion | badlands_companion/stratalMesh.py | Python | gpl-3.0 | 4,103 |
"""
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes
with keys less than the node's key.
The right subtree of a node contains only nodes
with keys greater than the node's key.
Both the left and right subtrees m... | amaozhao/algorithms | algorithms/tree/bst/is_bst.py | Python | mit | 894 |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.gis.maps.google.overlays import (
GMarker, GPolygon, GPolyline,
)
from django.template.loader import render_to_string
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.util... | bretlowery/snakr | lib/django/contrib/gis/maps/google/gmap.py | Python | bsd-3-clause | 9,219 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "writer.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| gnunixon/sport-news-writer | manage.py | Python | gpl-3.0 | 249 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.