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 xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
import xml.etree.ElementTree as etree
from xml.dom import minidom
import io
"""
using xml.etree.ElementTree
"""
def prettify(elem):
"""Return a pretty-printed XML string for the Element.
"""
rough_string = etree.tostr... | hoaibang07/Webscrap | sources/xmldemo/xmlcreate.py | Python | gpl-2.0 | 731 |
table = [None]*10000
def store( string):
"""Input a string that's stored in
the table."""
hash_index = calculate_hash_value(string)
if table[hash_index]:
table[hash_index].append(string)
else:
table[hash_index]= [string]
def lookup(string):
"""Re... | Akash1684/ScriptsPy | hash_map.py | Python | mit | 1,000 |
#
# 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... | brad-kaiser/spark | examples/src/main/python/streaming/stateful_network_wordcount.py | Python | apache-2.0 | 2,274 |
# Author: Alexandre Gramfort <[email protected]>
# Denis Engemann <[email protected]>
#
# License: BSD (3-clause)
import os.path as op
from copy import deepcopy
from nose.tools import (assert_true, assert_equal, assert_raises,
assert_not_equal)
from numpy.... | andyh616/mne-python | mne/tests/test_epochs.py | Python | bsd-3-clause | 71,695 |
from mathtools import list_product
def parse_file(file):
fin = open(file)
l = [[int(i) for i in line.strip().split()] for line in fin]
return l
def horizontal_max(l, adjacent):
largest = 0
for line in l:
for i in xrange(len(line) - adjacent + 1):
current = list_product(line[i... | pbjr23/project-euler-python | pr11.py | Python | gpl-2.0 | 1,704 |
# -*- coding: utf-8 -*-
"""
Tests for the path module.
This suite runs on Linux, OS X, and Windows right now. To extend the
platform support, just add appropriate pathnames for your
platform (os.name) in each place where the p() function is called.
Then report the result. If you can't get the test to run at all on
... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/test_path.py | Python | artistic-2.0 | 36,713 |
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
# Authors: Christoph Klein
# Contributors:
#
# MDTraj is free software: yo... | swails/mdtraj | mdtraj/tests/test_xyz.py | Python | lgpl-2.1 | 3,492 |
import StringIO
from binascii import unhexlify
def dejunk(pyew,doprint=True):
""" Remove junkcode like mov xx, call xx,jmp """
dis = pyew.disassemble(pyew.buf, pyew.processor, pyew.type, pyew.lines, pyew.bsize, baseoffset=pyew.offset)
print "Warning! The operation may change file, please backup before use this fun... | emptyiscolor/pyew-2.0-linux | plugins/dejunk.py | Python | gpl-2.0 | 1,796 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | daniel-hou0/horizon | openstack-dashboard/dashboard/settings.py | Python | apache-2.0 | 4,094 |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"%d min remaining to read": "",
"(active)": "",
"Also available in:": "",
"Archive": "",
"Categories": "",
"Comments": "",
"LANGUAGE": "Ingles",
"Languages:": "Mga Wika:",
"More posts about %s": "",
"N... | JohnTroony/nikola | nikola/data/themes/base/messages/messages_tl.py | Python | mit | 921 |
import _plotly_utils.basevalidators
class HoverlabelValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="hoverlabel", parent_name="sankey", **kwargs):
super(HoverlabelValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/sankey/_hoverlabel.py | Python | mit | 2,055 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016 <+YOU OR YOUR COMPANY+>.
#
# This 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, or (at your option)
# any later version.
#... | daniestevez/gr-aausat | python/qa_aausat_parser.py | Python | mit | 1,238 |
"""This module defines the class DesiData to load DESI data
"""
import multiprocessing
import logging
import fitsio
import healpy
import numpy as np
from picca.delta_extraction.data_catalogues.desi_healpix import DesiHealpix, defaults, accepted_options
from picca.delta_extraction.errors import DataError
class Desisi... | igmhub/picca | py/picca/delta_extraction/data_catalogues/desisim_mocks.py | Python | gpl-3.0 | 3,743 |
# ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
from __future__ import absolute_import, unicode_literals
from functools import reduce
import json
import logging
from django.contrib.admin.views import ... | mcmaxwell/idea_digital_agency | idea/feincms/admin/tree_editor.py | Python | mit | 20,243 |
import purestorage
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
from base64 import b64encode
import os
import sys
import json
import getpass
from optparse import OptionParser
from datetime import datetime, time... | PureStorage-OpenConnect/python-scripts | Pure_Create_Volume.py | Python | apache-2.0 | 4,551 |
from flask import render_template, flash, redirect, session, url_for, request, g
from flask_login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from .forms import LoginForm, EditForm, PostForm
from .models import User, Post
from datetime import datetime
from config import... | cclinet/flaskr | app/views.py | Python | gpl-3.0 | 5,446 |
modRoles = ["222359639575101442","225444761039798272"] #The id of the mod role(s). Can be found by typing "\@MOD-ROLE-MENTION"
backerRoles = ["225042074775322624", "225444761039798272"]
forbiddenChannels = ["220502476850200595","222739924313440257"] #Channel id(s) for channels the bot is wanted in. Ids can be found b... | SolarPolarMan/idiotech-gaming-bot | settings.py | Python | mit | 2,321 |
# Copyright (C) 2013-2015 Samuel Damashek, Peter Foley, James Forcier, Srijay Kasturi, Reed Koser, Christopher Reffett, and Fox Wilson
#
# 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 ve... | N6UDP/cslbot | cslbot/commands/paraphrase.py | Python | gpl-2.0 | 1,141 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2018 Florian Bruhin (The Compiler) <[email protected]>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | toofar/qutebrowser | qutebrowser/browser/webengine/webengineinspector.py | Python | gpl-3.0 | 1,816 |
"""This is a exmaple of conventional random walke simultion. There is
no resampling after the random walk dynamics.
"""
import sys
import os
import os.path as osp
from pathlib import Path
import numpy as np
from wepy.resampling.resamplers.resampler import NoResampler
from wepy.resampling.distances.randomwalk import ... | ADicksonLab/wepy | info/examples/RandomWalk/source/rw_conventional.py | Python | mit | 1,761 |
from bottle import Bottle, route, run, template, static_file, get, jinja2_template as template, post, request, response, redirect
import json
import requests
import runtime
import actions
"""
DisplayEvent
"""
defaultInputParams = {}
defaultOutputParams = {}
sim_parameters = dict()
# Register actions
def registerAct... | cloderic/SmartAlarmClock | src/actions/DisplayEvent.py | Python | bsd-3-clause | 1,317 |
__author__ = 'baranbartu'
import logging
import threading
from memory_profiler import LineProfiler
from memgraph.profile import determine_memory_info
logger = logging.getLogger(__name__)
def observe(func=None, precision=1):
if func is not None:
def wrapper(*args, **kwargs):
prof = LineProfil... | baranbartu/memgraph | memgraph/decorator.py | Python | bsd-2-clause | 810 |
# Copyright (c) 2015 Rackspace, 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 law or agreed to in wr... | openstack/barbican | functionaltests/api/v1/functional/test_containers_rbac.py | Python | apache-2.0 | 9,901 |
"""
Linkedin OAuth support
No extra configurations are needed to make this work.
"""
import urlparse
from xml.etree import ElementTree
from tendenci.apps.social_auth.backends import ConsumerBasedOAuth, OAuthBackend
LINKEDIN_SERVER = 'linkedin.com'
LINKEDIN_REQUEST_TOKEN_URL = 'https://api.%s/uas/oauth/requestToken'... | alirizakeles/tendenci | tendenci/apps/social_auth/backends/contrib/linkedin.py | Python | gpl-3.0 | 2,471 |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | stormi/tsunami | src/primaires/scripting/actions/donner_xp.py | Python | bsd-3-clause | 2,880 |
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | yasharmaster/scancode-toolkit | src/commoncode/fileutils.py | Python | apache-2.0 | 18,567 |
# Copyright 2020 The TensorFlow Quantum Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | tensorflow/quantum | tensorflow_quantum/core/ops/tfq_ps_util_ops_test.py | Python | apache-2.0 | 39,614 |
from eisoil.core.exception import CoreException
class OSliceAuthorityException(CoreException):
def __init__(self, desc):
self._desc = desc
def __str__(self):
return "OSliceAuthority: %s" % (self._desc,)
| EICT/C-BAS | src/plugins/osliceauthorityrm/osliceauthorityexceptions.py | Python | bsd-3-clause | 236 |
#!/usr/bin/env python
# Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 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.org/licenses/LICEN... | gx1997/chrome-loongson | third_party/webdriver/python/test/selenium/webdriver/remote/test_remote_visibility_tests.py | Python | bsd-3-clause | 2,535 |
'''
Created on Jan 3, 2015
@author: pixo
'''
from badass.plugin import PluginCmd
class PushCmd(PluginCmd):
author = "Rachid Chikh"
version = "0.0.1"
name = "PushCmd"
hook = "badass.core.push"
def preCmd(self, **kwargs):
print "pre cmd:", kwargs
def postCmd(self, **kwargs):
p... | pixo/badtools | plugins/PushCmd.py | Python | lgpl-3.0 | 422 |
import logging
from ..utilities.domain import parse_domain, get_domain_registry
import idna
from .entity import EppEntity
log = logging.getLogger(__name__)
class Domain(EppEntity):
"""
Query operations for domains.
"""
def __init__(self, queryset=None):
"""
Initialise Domain object.... | heytrav/drs-project | domain_api/epp/queries.py | Python | mit | 11,313 |
import json
from optparse import make_option
from django.core.exceptions import ValidationError
from django.core.management.base import BaseCommand, CommandError
from django.core.validators import URLValidator
from provider.constants import CONFIDENTIAL, PUBLIC
from provider.oauth2.models import Client
from ...models... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/edx_oauth2_provider/management/commands/create_oauth2_client.py | Python | agpl-3.0 | 6,029 |
import re
import simplejson
import datetime
import urllib2
from BeautifulSoup import BeautifulSoup
from goscale import models as goscale_models
from goscale import utils
from goscale import conf
from django.db import models
from django.db.models import signals
from django.utils.translation import ugettext as _
RATIO... | sternoru/goscalecms | goscale/plugins/presentations/models.py | Python | bsd-3-clause | 7,209 |
# Import data about canvas and it's objects as well as the frame
# for the program
from Display import *
from Server import *
# River and SM are the "model" of this
# design
from Tkinter import *
class riverController():
def __init__(self, master, canvasData, client):
self.master = master
se... | Mathih13/IS-105_2016_Gruppe-5 | Uke-15-ICA-9/ICA-8-Python/Controller/riverController.py | Python | mit | 6,305 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | allenlavoie/tensorflow | tensorflow/contrib/kfac/python/ops/fisher_blocks.py | Python | apache-2.0 | 63,050 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# tcpaccept Trace TCP accept()s.
# For Linux, uses BCC, eBPF. Embedded C.
#
# USAGE: tcpaccept [-h] [-t] [-p PID]
#
# This uses dynamic tracing of the kernel inet_csk_accept() socket function
# (from tcp_prot.accept), and will need to be modifie... | mcaleavya/bcc | tools/tcpaccept.py | Python | apache-2.0 | 8,042 |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution 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 condit... | chubbymaggie/barf-project | barf/core/reil/reil.py | Python | bsd-2-clause | 24,142 |
# =============================================================================
# plugin
#
# Copyright (c) 2016, Cisco Systems
# All rights reserved.
#
# # Author: Klaudiusz Staniek
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | anushreejangid/csmpe-main | csmpe/core_plugins/csm_check_config_filesystem/ios_xr/plugin.py | Python | bsd-2-clause | 2,764 |
import numpy as np
import copy
## extension of numpy.outer() to unlimited number of vectors,
## result[i,j,k] = v1[i] * v2[j] * v3[k] ##
def TensorOuter(vector_list):
L = len(vector_list)
dim = [vector_list[i].shape[0] for i in range(L)]
result = copy.deepcopy(vector_list[0])
previous_size = 1
for ... | JasonLC506/CollaborativeFiltering | matrixTool.py | Python | mit | 1,944 |
import re
from rdp.symbols import to_symbol
from rdp.tokenizer import Token
from rdp.symbols import Marker
INDENT = Marker('INDENT')
INDENT.num = +1
DEDENT = Marker('DEDENT')
DEDENT.num = -1
NEWLINE = Marker('NEWLINE')
_space_re = re.compile(r'^[ \t]*')
def get_indention(s, tabsize=4):
space = _space_re.match(... | emulbreh/rdp | rdp/indention.py | Python | mit | 1,966 |
# Copyright 2017, OpenCensus Authors
#
# 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 w... | census-instrumentation/opencensus-python | opencensus/trace/span_data.py | Python | apache-2.0 | 6,330 |
__author__ = 'OmerMahgoub'
#!/usr/bin/env python
import os
import yaml
class StackSettings:
def ServiceSettings(self,ServiceName):
basepath = os.path.dirname(__file__)
keypairs = os.path.abspath(os.path.join(basepath, "config.yml"))
with open(keypairs,'r') as f:
do... | omermahgoub/MigTool | settings/settings.py | Python | gpl-3.0 | 424 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2017 Alex Forencich
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 righ... | alexforencich/python-ivi | ivi/rigol/rigolDS2202A.py | Python | mit | 1,683 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class CBSIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cbs\.com/shows/[^/]+/(?:video|artist)/(?P<id>[^/]+)/.*'
_TESTS = [{
'url': 'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/... | kthordarson/youtube-dl-ruv | youtube_dl/extractor/cbs.py | Python | unlicense | 1,813 |
"""
GitNotify - Push/Commit notification script
Copyright (C) 2013 Manuel Peuster <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the Lice... | mpeuster/git-notify | src/repository.py | Python | gpl-3.0 | 6,343 |
"""
kombu.transport.zmq
===================
ZeroMQ transport.
"""
from __future__ import absolute_import, unicode_literals
import errno
import os
import socket
try:
import zmq
from zmq import ZMQError
except ImportError:
zmq = ZMQError = None # noqa
from kombu.five import Empty
from kombu.log import g... | Elastica/kombu | kombu/transport/zmq.py | Python | bsd-3-clause | 8,476 |
"""Gershwin 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')
Class-ba... | kaiyangjia/Gershwin | Gershwin/urls.py | Python | apache-2.0 | 1,076 |
from geopy import Photon
from geopy.extra.rate_limiter import RateLimiter
class GeoCodePipeline(object):
def open_spider(self, spider):
geolocator = Photon(timeout=5)
self.__geocodeFunc = RateLimiter(geolocator.geocode, min_delay_seconds=2)
def process_item(self, item, spider):
for ... | aberklotz/crimereport | parser/crimeparser/pipelinesEnricher.py | Python | mit | 825 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/identifier.py | Python | mit | 1,780 |
model = """
# Schlogl model (Schlogl 1972, Chemical reaction models for nonequilibrium phase transitions)
FIX: A B
# Reactions
R1:
A + {2} X > {3} X
1/2*c1*A*X*(X-1)
R2:
{3} X > A + {2} X
1/6*c2*X*(X-1)*(X-2)
R3:
B > X
c3 * B
R4:
X > B
c4*X
# Fixed species
A = 100000
B = 200000
... | SystemsBioinformatics/stochpy | stochpy/pscmodels/Schlogl.py | Python | gpl-3.0 | 399 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | MehdiSfr/tensor-flow | tensorflow/python/kernel_tests/transpose_op_test.py | Python | apache-2.0 | 7,217 |
# MIT License
# Copyright (c) 2017-9 Matthew Chen, Arc676/Alessandro Vinciguerra
# 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... | Arc676/ChatBot | bots/io.py | Python | mit | 4,166 |
r"""HTTP cookie handling for web clients.
This is a backport of the Py3.3 ``http.cookiejar`` module for
python-future.
This module has (now fairly distant) origins in Gisle Aas' Perl module
HTTP::Cookies, from the libwww-perl library.
Docstrings, comments and debug strings in this code refer to the
attributes of the... | hughperkins/kgsgo-dataset-preprocessor | thirdparty/future/src/future/backports/http/cookiejar.py | Python | mpl-2.0 | 76,542 |
'''OpenGL extension VERSION.GL_4_1
This module customises the behaviour of the
OpenGL.raw.GL.VERSION.GL_4_1 to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/VERSION/GL_4_1.txt
'''
from OpenGL import platform, constant, arrays
fro... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GL/VERSION/GL_4_1.py | Python | lgpl-3.0 | 8,574 |
import numpy
import math
def mkRamp(*args):
''' mkRamp(SIZE, DIRECTION, SLOPE, INTERCEPT, ORIGIN)
Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
containing samples of a ramp function, with given gradient DIRECTION
(radians, CW from X-axis, default = 0), SLOPE (per pixel... | tochikuji/pyPyrTools | pyrtools/mkRamp.py | Python | mit | 1,617 |
import pyjd # dummy in pyjs
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.TextArea import TextArea
from pyjamas.ui.Label import Label
from pyjamas.ui.Button import Button
from pyjamas.ui.HTML import HTML
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas.ui.HorizontalPanel import HorizontalPa... | minghuascode/pyj | examples/misc/flaskexamples/flaskcors/Flask_JSONRPC_CORS.py | Python | apache-2.0 | 6,253 |
# Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves <[email protected]>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# T... | goodwinos/sos | sos/plugins/ctdb.py | Python | gpl-2.0 | 1,642 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | dual_pixels/eval/script.py | Python | apache-2.0 | 2,861 |
"""Support the ISY-994 controllers."""
import asyncio
from functools import partial
from typing import Optional
from urllib.parse import urlparse
from pyisy import ISY
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeass... | tchellomello/home-assistant | homeassistant/components/isy994/__init__.py | Python | apache-2.0 | 8,442 |
#!/usr/bin/env python
from setuptools import setup, find_packages
import cleware
setup(
name='cleware',
version=cleware.__version__,
description='Python library to control Cleware products',
long_description='Python library to control Cleware products',
author='Roderick Baier',
author_email=... | rbaier/python-cleware | setup.py | Python | mit | 756 |
#!/usr/bin/env python
# Dan Blankenberg
"""
A wrapper script for converting SAM to BAM, with sorting.
%prog input_filename.sam output_filename.bam
"""
import os
import sys
import optparse
import tempfile
import subprocess
import shutil
CHUNK_SIZE = 2 ** 20 # 1mb
def cleanup_before_exit( tmp_dir ):
if tmp_dir a... | icaoberg/cellorganizer-galaxy-tools | datatypes/converters/sam_to_bam.py | Python | gpl-3.0 | 2,215 |
from allura.command.base import Command
class BlogCommand(Command):
group_name = 'ForgeBlog'
| pombredanne/SourceForge-Allura | ForgeBlog/forgeblog/command/base.py | Python | apache-2.0 | 98 |
"""Approximate nearest neighbor search"""
# Author: Maheshakya Wijewardena <[email protected]>
# Joel Nothman <[email protected]>
import numpy as np
import warnings
from scipy import sparse
from .base import KNeighborsMixin, RadiusNeighborsMixin
from ..base import BaseEstimator
from ..utils.va... | schets/scikit-learn | sklearn/neighbors/approximate.py | Python | bsd-3-clause | 22,278 |
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo ([email protected])
####################################... | 3dfxsoftware/cbss-addons | configure_account_partner/wizard/__init__.py | Python | gpl-2.0 | 1,281 |
from distutils.core import setup
import os
setup(
name = 'cheat',
version = '2.0.9',
author = 'Chris Lane',
author_email = '[email protected]',
license = 'GPL3',
description = 'cheat allows you to create and view interactive cheatsheets '
'on the command-li... | laomaiweng/cheat | setup.py | Python | gpl-3.0 | 890 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/replication.py | Python | mit | 2,473 |
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^api/', include('users.urls')),
url(r'^api/', include('reception_office.urls')),
url(r'^api/admin/', include(admin.site.urls)),
url(r'^api-token-auth/',
... | vechnoe/clinic | src/urls.py | Python | mit | 596 |
#!/usr/bin/python
import boto.ec2
import time
import argparse
import sys
def print_error(msg):
print >> sys.stderr , "[Error]" , msg
def is_running(instance):
return instance != None and instance.state == "running"
def wait_for_instance(instance, timeout = 900):
start = time.time()
counter = 0
polling_... | cvmfs-testing/cvmfs | test/cloud_testing/steering/instance_handler.py | Python | bsd-3-clause | 7,346 |
#! /usr/bin/env python
"""Mauna Loa Weekly Atmospheric CO2 Data"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = """Mauna Loa Weekly Atmospheric CO2 Data"""
SOURCE = """
Data obtained from http://cdiac.ornl.gov/trends/co2/sio-keel-flask/sio-keel-flaskmlo_c.html
Obt... | yl565/statsmodels | statsmodels/datasets/co2/data.py | Python | bsd-3-clause | 3,041 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-08-16 19:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('communication', '0016_mailcommunication_lob_id'),
]
operations = [
migrations.Cr... | MuckRock/muckrock | muckrock/communication/migrations/0017_mailevent.py | Python | agpl-3.0 | 795 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import time
import sys
import threading
from observedItem import *
from fileEventHandler import *
def getExt(filename):
# return extention of file
return os.path.splitext(filename)[-1].lower()
class FileObserver(threading.Thread):
def __init__ (self):
su... | DaikiShimada/patlabor-python | patlabor/fileObserver.py | Python | mit | 3,071 |
#!/usr/bin/env python
class BaseCodec(object):
"""
Base audio/video codec class.
"""
encoder_options = {}
codec_name = None
ffmpeg_codec_name = None
def parse_options(self, opt):
if 'codec' not in opt or opt['codec'] != self.codec_name:
raise ValueError('invalid codec... | Filechaser/sickbeard_mp4_automator | converter/avcodecs.py | Python | mit | 29,019 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | anilmuthineni/tensorflow | tensorflow/examples/tutorials/mnist/fully_connected_feed.py | Python | apache-2.0 | 9,515 |
import six
import html5lib
from nose.tools import eq_
import bleach
from bleach.tests.tools import in_
def test_empty():
eq_('', bleach.clean(''))
def test_nbsp():
if six.PY3:
expected = '\xa0test string\xa0'
else:
expected = six.u('\\xa0test string\\xa0')
eq_(expected, bleach.clea... | sunze/py_flask | venv/lib/python3.4/site-packages/bleach/tests/test_basics.py | Python | mit | 5,942 |
#!/usr/bin/env python
import os
import sys
import subprocess
import time
MAX_PROC_NUM = 20
JAIL_TIME = 92
GOODWORD = 'goodword'
BADWORD = 'ultrasurf'
OUTTER_WEBSITES = {
'yahoo.com': 'http://www.yahoo.com/',
'wikipedia.org': 'http://www.wikipedia.org/',
'amazon.com': 'http://www.amazon.com/',
'liv... | seclab-ucr/INTANG | src/test/test_succ_rate_cn.py | Python | gpl-3.0 | 7,248 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-23 13:25
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
class Migration(migrations.Migration):
initial = True
... | jfterpstra/bluebottle | bluebottle/votes/migrations/0001_initial.py | Python | bsd-3-clause | 1,352 |
#!/usr/bin/env python
import json
import os
import pytz
import requests
import threading
import time
from collections import OrderedDict
from datetime import datetime
class Error(Exception):
pass
class Auditor(object):
def __init__(self, hostname, port, secure=False, buffer_secs=None):
self.hostna... | gmjosack/pyauditor | pyauditor/__init__.py | Python | mit | 8,565 |
# -*- coding: utf-8 -*-
import subprocess # noqa: S404
import six
def launchctl(subcommand, *args):
"""
Call the launchctl binary and capture the output.
:param subcommand: string
"""
if not isinstance(subcommand, six.string_types):
raise ValueError("Argument is invalid: %r" % repr(sub... | infothrill/python-launchd | launchd/cmd.py | Python | mit | 860 |
from __future__ import unicode_literals
from datetime import datetime
from django.test import TestCase
from django_ajax.encoder import LazyJSONEncoder
import json
class LazyJSONEncoderMixinTestCase(TestCase):
def test_default_date(self):
data = {'datetime': datetime.today()}
self.assertEqual('{"da... | yceruto/django-ajax | tests/ajaxmiddleware/app/tests.py | Python | mit | 2,443 |
from django import forms
from api.models import Sighting
from api.models import Answer
from api.models import UserComment
from django.contrib.auth.models import User
class SightingForm(forms.ModelForm):
class Meta:
model = Sighting
fields = ('type', 'free_text', 'location', 'lat', 'lng')
cl... | CarlosTenorio/vespapp-web | web/forms.py | Python | gpl-3.0 | 5,273 |
import sys
import datetime
import time
from PIL import Image
import matplotlib.pyplot as plt
f = Image.open("1.jpg")
plt.figure("1")
plt.imshow(f)
plt.show() | liumeixia/xiaworkspace | pythonProject/punchcard/card.py | Python | gpl-2.0 | 157 |
import torch.nn.functional as F
import torch
from torch.autograd import Variable
import numpy as np
from src.data_ops.wrapping import wrap
from src.admin.utils import see_tensors_in_memory
def loss(y_pred, y, y_mask, bm):
l = nll
return l(y_pred, y, y_mask, bm)
def kl(y_pred, y, y_mask):
n = y_pred.shape... | isaachenrion/jets | src/proteins/loss.py | Python | bsd-3-clause | 3,024 |
import sys
from django.conf.urls import url
from django.http import HttpResponse
from django.views import View
from request_logging.decorators import no_logging
from rest_framework import viewsets, routers
# DRF 3.8.2 is used in python versions 3.4 and older, which needs special handling
IS_DRF_382 = sys.version_info... | Rhumbix/django-request-logging | test_urls.py | Python | mit | 2,009 |
from __future__ import absolute_import
from six import string_types
from twisted.internet.defer import inlineCallbacks
from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler, MyPreferenceDBHandler
from Tribler.Core.CacheDB.sqlitecachedb import str2bin
from Tribler.Test.Core.test_sqlitecachedbhandler i... | Captain-Coder/tribler | Tribler/Test/Core/test_sqlitecachedbhandler_preferences.py | Python | lgpl-3.0 | 3,907 |
# -*- coding: utf-8 -*-
try:
from setuptools import setup, find_packages
package_list = find_packages()
except ImportError:
from distutils.core import setup
package_list = ['pyabad', 'pyabad.data_creation']
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = ... | buck06191/ABROAD | setup.py | Python | mit | 913 |
from django.db.models import F, Q
from olympia.amo.management import ProcessObjectsCommand
from olympia.bandwagon.models import Collection
from olympia.translations.models import Translation
from olympia.translations.tasks import reclean_collection_descriptions
class Command(ProcessObjectsCommand):
def get_model... | bqbn/addons-server | src/olympia/translations/management/commands/process_translations.py | Python | bsd-3-clause | 1,251 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 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.
from __future__ import unicode_literals
from sqlalchemy.orm import defaultload, joinedload
from indico.c... | mic4ael/indico | indico/modules/events/timetable/clone.py | Python | mit | 3,639 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from curl2share.config import log_file, log_level
loglevel = {'CRITICAL': logging.CRITICAL,
'ERROR': logging.ERROR,
'WARNING': logging.WARN,
'INFO': logging.INFO,
'DEBUG... | cuongnv23/curl2share | curl2share/__init__.py | Python | mit | 691 |
# -*- coding: utf-8 -*-
# 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... | googleads/google-ads-python | google/ads/googleads/v9/common/types/ad_type_infos.py | Python | apache-2.0 | 51,120 |
import unittest
import numpy as np
np.random.seed(42)
import scipy
from scipy.stats import norm
import rampy as rp
class TestML(unittest.TestCase):
def test_mlregressor(self):
x = np.arange(0,600,1.0)
nb_samples = 100 # number of samples in our dataset
# true partial spectra
S... | charlesll/RamPy | rampy/tests/test_mlregressor.py | Python | gpl-2.0 | 1,520 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | cg31/tensorflow | tensorflow/python/kernel_tests/unpack_op_test.py | Python | apache-2.0 | 4,695 |
#!/usr/bin/env python
from pathlib import Path
import logging
import numpy as np
from scipy.interpolate import interp1d
import h5py
import xarray
# consider atmosphere
try:
import lowtran
except ImportError as e:
logging.error(f"failure to load LOWTRAN, proceeding without atmospheric absorption model. {e}")
... | scienceopen/gridaurora | gridaurora/filterload.py | Python | gpl-3.0 | 3,478 |
import re, urllib2, cookielib, time, xbmcgui, socket, xbmc, os
from urllib2 import Request, URLError, urlopen as urlopen2
from urlparse import parse_qs
from urllib import quote, urlencode
from urllib import quote, unquote_plus, unquote, urlencode
from httplib import HTTPConnection, CannotSendRequest, BadStatusLine, HTT... | Stevie-Bs/Stevie-Bs-Kodi | plugin.video.szenestreams/stream.py | Python | gpl-2.0 | 19,849 |
from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.http import HttpResponse
from funfactory.monkeypatches import patch
patch()
from base import views
#... | yvan-sraka/wprevents | wprevents/urls.py | Python | bsd-3-clause | 1,439 |
# -*- coding: utf-8 -*-
#
# cookiecutter documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 11 11:31:49 2013.
#
# 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.
... | hackebrot/cookiecutter | docs/conf.py | Python | bsd-3-clause | 11,072 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'Click>=6.0',
'attrs>=16.0',
'requests==2.11.1',
... | kouk/mgship | setup.py | Python | bsd-3-clause | 1,627 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
##
## S E R I A L B O X
##
## This file is distributed under terms of BSD license.
## See LICENSE.txt for more information.
##
##===----------... | thfabian/serialbox2 | test/serialbox-python/sdb/sdbcore/test_stencildata.py | Python | bsd-2-clause | 2,179 |
#!/usr/bin/python
import socket
import sys
verbose = False
if len(sys.argv) > 2 and sys.argv[2] == "-v":
verbose = True
def read():
return f.readline().strip()
def main():
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect("/tmp/mysocket.socket")
f = sock.makefile()
f.w... | wimtie/pdnsbe | testing/iterfromcli.py | Python | gpl-2.0 | 802 |
#
# PEDA - Python Exploit Development Assistance for GDB
#
# Copyright (C) 2012 Long Le Dinh <longld at vnsecurity.net>
#
# License: see LICENSE file for details
#
# change below settings to match your needs
## BEGIN OF SETTINGS ##
# external binaries, required for some commands
READELF = "/usr... | m42e/gdbinvim | peda/lib/config.py | Python | gpl-3.0 | 3,279 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from .index import SlicedIndex, TableIndices, TableLoc, TableILoc, TableLocIndices
import sys
from collections import OrderedDict, defaultdict
from collections.abc import Mapping
import warnings
from copy import deepcopy
import types
import itertools
impo... | pllim/astropy | astropy/table/table.py | Python | bsd-3-clause | 150,650 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.