repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
alsrgv/tensorflow | tensorflow/contrib/learn/python/learn/utils/export.py | 28 | 13975 | # Copyright 2016 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... | apache-2.0 |
hauxir/OpenBazaar-Server | daemon.py | 4 | 3692 | __author__ = 'chris'
import sys, os, time, atexit
from signal import SIGTERM
class Daemon(object):
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
"""
# pylint: disable=file-builtin
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', st... | mit |
kernsuite-debian/lofar | LCU/StationTest/test/hbatest/determinepeak.py | 1 | 4055 | """ script for determing the peak in the spectrum
Andre 10 July 2009
Usage python3 ./determinepeak.py [# of RCUs]
"""
# INIT
import array
import operator
import os
import time
import sys
import math
import numpy
# Read directory with the files to processs
def open_dir(dirname) :
files = list(filter(os.path.isfil... | gpl-3.0 |
lixiangning888/whole_project | modules/signatures_merge_tmp/rat_pcclient.py | 3 | 1675 | # -*- coding: utf-8 -*-
# Copyright (C) 2014 @threatlead
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This prog... | lgpl-3.0 |
40223145c2g18/c2g18 | wsgi/static/Brython2.1.0-20140419-113919/Lib/xml/dom/expatbuilder.py | 733 | 35733 | """Facility to use the Expat parser to load a minidom instance
from a string or file.
This avoids all the overhead of SAX and pulldom to gain performance.
"""
# Warning!
#
# This module is tightly bound to the implementation details of the
# minidom DOM and can't be used with other DOM implementations. This
# is due... | gpl-2.0 |
kwrobert/heat-templates | hot/software-config/elements/heat-config-ansible/install.d/hook-ansible.py | 6 | 3615 | #!/usr/bin/env python
#
# 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 ... | apache-2.0 |
palashahuja/myhdl | myhdl/test/core/test_misc.py | 3 | 1922 | # This file is part of the myhdl library, a Python package for using
# Python as a Hardware Description Language.
#
# Copyright (C) 2003-2008 Jan Decaluwe
#
# The myhdl library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# published by t... | lgpl-2.1 |
Azenwrath/codeguild-labs | lab_distance_converstion.py | 1 | 1643 | #Lab: Distance Converter
#Student: Dana Stubkjaer
def convert(distance, unit1, unit2):
if unit1 == "mi":
if unit2 == "mi":
print (distance + " " + unit2)
if unit2 == "km":
print ((float(distance) * 1.60934))
if unit2 == "ft":
print ((float... | gpl-3.0 |
spahan/unixdmoain | admin/janitor.py | 1 | 3452 | #!/usr/bin/env python2
# coding: utf-8
# THIS SOFTWARE IS LICENSED UNDER THE BSD LICENSE CONDITIONS.
# FOR LICENCE DETAILS SEE share/LICENSE.TXT
#
# (c) 2005-2009, Marco Hoehle <marco.hoehle@unibas.ch>
# (c) 2010, Hanspeter Spalinger <h.spalinger@stud.unibas.ch>
"""
housekeeping jobs, run this script as cronjob.
Do no... | bsd-3-clause |
DANA-Laboratory/CoolProp | Web/scripts/fluid_properties.Incompressibles.py | 3 | 6445 | from __future__ import print_function, division
import os.path
import CoolProp
import CoolProp.CoolProp
import subprocess
import sys
import numpy as np
import matplotlib
matplotlib.use('Agg') #Force mpl to use a non-GUI backend
import matplotlib.pyplot as plt
web_dir = os.path.abspath(os.path.join(os.path.dirname(__... | mit |
Azure/azure-sdk-for-python | sdk/storage/azure-storage-blob/samples/blob_samples_copy_blob.py | 1 | 1906 | # 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.
# --------------------------------------------------------------------... | mit |
davenovak/mtasa-blue | vendor/google-breakpad/src/tools/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py | 350 | 1226 | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verify that a hard_dependency that is not exported is not pulled in as a
dependency for a target if the target does not explicitly speci... | gpl-3.0 |
danakj/chromium | third_party/logilab/logilab/common/interface.py | 137 | 2593 | # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | bsd-3-clause |
kingvuplus/BH-SH4 | lib/python/Components/Sources/List.py | 39 | 2840 | from Source import Source
from Components.Element import cached
class List(Source, object):
"""The datasource of a listbox. Currently, the format depends on the used converter. So
if you put a simple string list in here, you need to use a StringList converter, if you are
using a "multi content list styled"-list, you ... | gpl-2.0 |
SzTk/Get-Mid-Point | get_mid_point/geocoding.py | 1 | 1561 | #coding: UTF-8
import sys
import traceback
from pygmapslib import PyGMaps, PyGMapsError
__all__ = ['GeocodingError', 'Geocoding', 'request']
class GeocodingError(Exception):
def __init__(self, error_status, params):
self.error_status = error_status
self.params = params
def __str__(self):
... | lgpl-3.0 |
MakeHer/edx-platform | cms/djangoapps/contentstore/management/commands/tests/test_git_export.py | 66 | 7362 | """
Unittests for exporting to git via management command.
"""
import copy
import os
import shutil
import StringIO
import subprocess
import unittest
from uuid import uuid4
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import CommandError
from django.... | agpl-3.0 |
Endika/c2c-rd-addons | c2c_account_payment_extension/wizard/__init__.py | 4 | 1478 | # -*- coding: utf-8 -*-
##############################################
#
# Swing Entwicklung betrieblicher Informationssysteme GmbH
# (<http://www.swing-system.com>)
# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
# all rights reserved
# 08-JUN-2012 (GK) created
#
# WARNING: This program as such is intende... | agpl-3.0 |
trishnaguha/ansible | lib/ansible/modules/network/checkpoint/checkpoint_run_script.py | 30 | 3057 | #!/usr/bin/python
#
# 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 License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | gpl-3.0 |
hpcugent/vsc-ldap | lib/vsc/ldap/filters.py | 1 | 9999 | # -*- coding: latin-1 -*-
#
# Copyright 2009-2021 Ghent University
#
# This file is part of vsc-ldap,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# the Fl... | gpl-2.0 |
drawks/ansible | lib/ansible/modules/storage/netapp/netapp_e_iscsi_target.py | 13 | 10627 | #!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
PaulWay/spacewalk | backend/satellite_tools/xmlDiskSource.py | 2 | 9003 | #
# Abstraction for an XML importer with a disk base
#
# Copyright (c) 2008--2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# F... | gpl-2.0 |
Onager/plaso | tests/parsers/esedb_plugins/msie_webcache.py | 1 | 3763 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Microsoft Internet Explorer WebCache database."""
import unittest
from plaso.lib import definitions
from plaso.parsers.esedb_plugins import msie_webcache
from tests.parsers.esedb_plugins import test_lib
class MsieWebCacheESEDBPluginTest(test_lib.ESEDB... | apache-2.0 |
jeffreylu9/django-cms | cms/test_utils/project/sampleapp/migrations/0002_auto_20141015_1057.py | 60 | 1264 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sampleapp', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='category',
name='l... | bsd-3-clause |
vrsys/avango | examples/stereo_example/main.py | 1 | 3087 | import avango
import avango.script
from avango.script import field_has_changed
import avango.gua
from examples_common.GuaVE import GuaVE
STEREO_MODE = avango.gua.StereoMode.ANAGLYPH_RED_CYAN
# STEREO_MODE = avango.gua.StereoMode.ANAGLYPH_RED_GREEN
# STEREO_MODE = avango.gua.StereoMode.SIDE_BY_SIDE
# STEREO_MODE = avan... | lgpl-3.0 |
yencarnacion/jaikuengine | .google_appengine/lib/django-1.4/django/contrib/gis/db/backends/oracle/operations.py | 52 | 12903 | """
This module contains the spatial lookup types, and the `get_geo_where_clause`
routine for Oracle Spatial.
Please note that WKT support is broken on the XE version, and thus
this backend will not work on such platforms. Specifically, XE lacks
support for an internal JVM, and Java libraries are required to use... | apache-2.0 |
gromacs/copernicus | cpc/server/message/state.py | 2 | 4443 | # This file is part of Copernicus
# http://www.copernicus-computing.org/
#
# Copyright (C) 2011, Sander Pronk, Iman Pouya, Erik Lindahl, and others.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published
# by the Free Soft... | gpl-2.0 |
elancom/storm | storm-core/src/dev/resources/tester_bolt.py | 16 | 1272 | # -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# ... | apache-2.0 |
dneg/gaffer | python/GafferImageTest/SelectTest.py | 5 | 3240 | ##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Red... | bsd-3-clause |
kphillisjr/burg | util/import_gcry.py | 6 | 17863 | #*
#* GRUB -- GRand Unified Bootloader
#* Copyright (C) 2009 Free Software Foundation, Inc.
#*
#* GRUB 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... | gpl-3.0 |
ptisserand/ansible | lib/ansible/utils/module_docs_fragments/vyos.py | 58 | 3118 | #
# (c) 2015, Peter Sprygada <psprygada@ansible.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 License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | gpl-3.0 |
zhinaonet/sqlmap-z | lib/controller/handler.py | 1 | 4543 | #!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.common import Backend
from lib.core.data import conf
from lib.core.data import kb
from lib.core.dicts import DBMS_DICT
from lib.core.enums import DBMS
from lib.c... | gpl-3.0 |
robotlinker/robotlinker_core | src/rosbridge_suite/rosbridge_server/src/tornado/test/simple_httpclient_test.py | 19 | 22731 | from __future__ import absolute_import, division, print_function, with_statement
import collections
from contextlib import closing
import errno
import gzip
import logging
import os
import re
import socket
import sys
from tornado import gen
from tornado.httpclient import AsyncHTTPClient
from tornado.httputil import HT... | apache-2.0 |
abhiQmar/servo | tests/wpt/css-tests/tools/pytest/testing/test_capture.py | 171 | 32410 | # note: py.io capture tests where copied from
# pylib 1.4.20.dev2 (rev 13d9af95547e)
from __future__ import with_statement
import pickle
import os
import sys
import _pytest._code
import py
import pytest
import contextlib
from _pytest import capture
from _pytest.capture import CaptureManager
from _pytest.main import E... | mpl-2.0 |
NumberZeroSoftware/PDFINVEST | pdfapp/migrations/0010_auto_20170225_0034.py | 1 | 2473 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-25 00:34
from __future__ import unicode_literals
from django.db import migrations, models
import pdfapp.validators
class Migration(migrations.Migration):
dependencies = [
('pdfapp', '0009_auto_20170223_2247'),
]
operations = [
... | mit |
alfredhq/djlint | djlint/analyzers/base.py | 3 | 8412 | import ast
import os
from .context import Context
class BaseAnalyzer(object):
"""
Base code analyzer class. Takes dict `file path => ast node` as first
param and path to repository as second.
Subclass this class and implement `analyze_file` method if you want to
create new code analyzer.
"""
... | isc |
eriwoon/ShellScriptCollect | Python/replaceAVP.py | 1 | 3204 | #! /usr/bin/python
#coding: utf-8
import sys
import os
import re
def findAllFile(dir):
folder = [dir]
file = []
while len(folder) > 0:
curDir = folder[0]
folder.pop(0)
lst = os.listdir(curDir)
for i in lst:
name = curDir + '\\' + i
if os.path.isfile(name) == True:
file.append(name)
else... | mit |
lochiiconnectivity/boto | boto/connection.py | 1 | 44959 | # Copyright (c) 2006-2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# Copyright (c) 2010 Google
# Copyright (c) 2008 rPath, Inc.
# Copyright (c) 2009 The Echo Nest Corporation
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# Copyright (c) 2011, Nexenta Systems Inc.
# All... | mit |
psavery/avogadro | libavogadro/src/python/unittest/camera.py | 9 | 2353 | from PyQt4.Qt import *
from numpy import *
import Avogadro
import sys
import unittest
from util import *
class TestCamera(unittest.TestCase):
def setUp(self):
# create the GLWidget and load the default engines
self.glwidget = Avogadro.GLWidget()
self.glwidget.loadDefaultEngines()
self.molecule ... | gpl-2.0 |
google/grr | grr/server/grr_response_server/flows/general/registry.py | 1 | 6530 | #!/usr/bin/env python
"""Gather information from the registry on windows."""
from grr_response_core import config
from grr_response_core.lib import artifact_utils
from grr_response_core.lib.rdfvalues import file_finder as rdf_file_finder
from grr_response_core.lib.rdfvalues import paths as rdf_paths
from grr_response_... | apache-2.0 |
Galexrt/zulip | zerver/views/pointer.py | 5 | 1267 |
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from typing import Text
from zerver.decorator import to_non_negative_int
from zerver.lib.actions import do_update_pointer
from zerver.lib.request import has_request_variables, JsonableError, REQ
from zerver.lib.respon... | apache-2.0 |
arrabito/DIRAC | Core/Utilities/DErrno.py | 1 | 11716 | """ :mod: DErrno
==========================
.. module: DErrno
:synopsis: Error list and utilities for handling errors in DIRAC
This module contains list of errors that can be encountered in DIRAC.
It complements the errno module of python.
It also contains utilities to manipulate these err... | gpl-3.0 |
JaviMerino/trappy | trappy/thermal.py | 2 | 9812 | # Copyright 2015-2016 ARM Limited
#
# 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... | apache-2.0 |
Godiyos/python-for-android | python-modules/twisted/twisted/internet/pollreactor.py | 56 | 6856 | # Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
A poll() based implementation of the twisted main loop.
To install the event loop (and you should do this before any connections,
listeners or connectors are added)::
from twisted.internet import pollreactor
pollreactor.in... | apache-2.0 |
shengqh/ngsperl | lib/Visualization/plotGene.py | 1 | 7060 | import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
cqsdir = os.path.abspath(os.path.dirname(currentdir) + "/CQS")
sys.path.insert(0,cqsdir)
import logging
import argparse
import string
import subprocess
from LocusItem import LocusItem, readBedFile
from FileLis... | apache-2.0 |
faircloth-lab/uce-probe-design | run_lastz.py | 1 | 6837 | #!/usr/bin/env python
# encoding: utf-8
"""
run_lastz.py
Created by Brant Faircloth on 2010-02-24.
Copyright (c) 2010 Brant Faircloth. All rights reserved.
# Description
A helper script to run lastz.
"""
import pdb
import sys
import os
import time
import optparse
import tempfile
import subprocess
import bx.seq.two... | bsd-3-clause |
CingHu/neutron-ustack | neutron/plugins/cisco/cfg_agent/device_drivers/devicedriver_api.py | 5 | 5750 | # Copyright 2014 Cisco Systems, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | apache-2.0 |
wavesoft/CCLib | Python/cc_write_flash.py | 1 | 2943 | #!/usr/bin/python
#
# CCLib_proxy Utilities
# Copyright (c) 2014 Ioannis Charalampidis
#
# 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) an... | gpl-3.0 |
orioncoin-dev/orioncoin | contrib/testgen/gen_base58_test_vectors.py | 1064 | 4344 | #!/usr/bin/env python
'''
Generate valid and invalid base58 address and private key test vectors.
Usage:
gen_base58_test_vectors.py valid 50 > ../../src/test/data/base58_keys_valid.json
gen_base58_test_vectors.py invalid 50 > ../../src/test/data/base58_keys_invalid.json
'''
# 2012 Wladimir J. van der Laan
# R... | mit |
DepthDeluxe/ansible | lib/ansible/plugins/action/copy.py | 18 | 15161 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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 License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | gpl-3.0 |
lowitty/server | libsDarwin/twisted/trial/_dist/test/test_disttrial.py | 10 | 13156 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.trial._dist.disttrial}.
"""
import os
import sys
from cStringIO import StringIO
from twisted.internet.protocol import ProcessProtocol
from twisted.internet.defer import fail, succeed
from twisted.internet.task import Coop... | mit |
rxuriguera/bibtexIndexMaker | src/bibim/references/format/formatter.py | 1 | 1717 |
# Copyright 2010 Ramon Xuriguera
#
# This file is part of BibtexIndexMaker.
#
# BibtexIndexMaker 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... | gpl-3.0 |
bgilbert/scanvark | scanvark/config.py | 1 | 1818 | #
# Scanvark -- a Gtk-based batch scanning program
#
# Copyright (c) 2012 Benjamin Gilbert
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | gpl-2.0 |
LingJiJian/LangTransUtil | lk.py | 1 | 4280 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author B-y 342854406@qq.com
import os
import re
import json
import sys
class Singleton(type):
"""docstring for Singleton"""
def __init__(self, name,bases,dic):
super(Singleton, self).__init__(name,bases,dic)
self.instance = None
def __call__(self,*args,**kwargs... | mit |
leethargo/geonet | geonet/network.py | 1 | 3958 | '''
Data structures for (Steiner) tree networks
'''
import networkx as nx
class Net(object):
'''Network'''
def __init__(self, nodes, arcs):
'''
nodes: node IDs
arcs: tuples of node IDs (tail, head)
'''
self.dg = nx.DiGraph()
self.dg.add_nodes_from(nodes)
... | mit |
chiviak/headphones | lib/unidecode/x021.py | 62 | 3964 | data = (
'', # 0x00
'', # 0x01
'C', # 0x02
'', # 0x03
'', # 0x04
'', # 0x05
'', # 0x06
'', # 0x07
'', # 0x08
'', # 0x09
'', # 0x0a
'', # 0x0b
'', # 0x0c
'H', # 0x0d
'', # 0x0e
'', # 0x0f
'', # 0x10
'', # 0x11
'', # 0x12
'', # 0x13
'', # 0x14
'N', # 0x15
... | gpl-3.0 |
dav94/plastex | plasTeX/Packages/float.py | 8 | 1426 | #!/usr/bin/env python
import new
from plasTeX import Command, Environment
from plasTeX.Base.LaTeX.Floats import Float, Caption
class newfloat(Command):
args = 'name:str pos:str capfile:str [ reset:str ]'
def invoke(self, tex):
Command.invoke(self, tex)
name = str(self.attributes['name'])
... | mit |
fengzhyuan/scikit-learn | examples/semi_supervised/plot_label_propagation_versus_svm_iris.py | 286 | 2378 | """
=====================================================================
Decision boundary of label propagation versus SVM on the Iris dataset
=====================================================================
Comparison for decision boundary generated on iris dataset
between Label Propagation and SVM.
This demon... | bsd-3-clause |
tuomas777/parkkihubi | parkings/tests/api/utils.py | 1 | 3212 | import json
import uuid
from rest_framework.authtoken.models import Token
ALL_METHODS = ('get', 'post', 'put', 'patch', 'delete')
def token_authenticate(api_client, user):
token, _ = Token.objects.get_or_create(user=user)
api_client.credentials(HTTP_AUTHORIZATION='ApiKey ' + token.key)
return api_client... | mit |
michaelhush/M-LOOP | docs/conf.py | 1 | 10253 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# M-LOOP documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 24 11:34:47 2016.
#
# 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
# aut... | mit |
rouxcode/django-admin-sort | admin_sort/tests/testapp/models.py | 1 | 5140 | # -*- coding: utf-8 -*-
from django.db import models
from admin_sort.models import SortableModelMixin
class Author(SortableModelMixin, models.Model):
"""
SortableModelMixin: on save, intercept and first update needed other
instances, then save
"""
name = models.CharField('Name', null=True, blank=... | mit |
ngoix/OCRF | sklearn/linear_model/ransac.py | 14 | 17163 | # coding: utf-8
# Author: Johannes Schönberger
#
# License: BSD 3 clause
import numpy as np
import warnings
from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone
from ..utils import check_random_state, check_array, check_consistent_length
from ..utils.random import sample_without_replacement
fr... | bsd-3-clause |
openhatch/new-mini-tasks | vendor/packages/Django/django/core/management/sql.py | 104 | 7942 | from __future__ import unicode_literals
import codecs
import os
import re
from django.conf import settings
from django.core.management.base import CommandError
from django.db import models
from django.db.models import get_models
from django.utils._os import upath
def sql_create(app, style, connection):
"Returns... | apache-2.0 |
datamade/pyhacrf | pyhacrf/pyhacrf.py | 1 | 13946 | # Authors: Dirko Coetsee
# License: 3-clause BSD
""" Implements a Hidden Alignment Conditional Random Field (HACRF). """
from __future__ import absolute_import
import numpy as np
import lbfgs
from .algorithms import forward, backward
from .algorithms import forward_predict, forward_max_predict
from .algorithms import... | bsd-3-clause |
BWeatherMaine/WXGIF | libs/images2gif.py | 2 | 28499 | # -*- coding: utf-8 -*-
# Copyright (c) 2010, Almar Klein, Ant1, Marius van Voorden
#
# This code is subject to the (new) BSD license:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of s... | apache-2.0 |
Pegase745/gitlab-freak | gitlab_freak/helpers.py | 2 | 2832 | from __future__ import absolute_import, unicode_literals
from distutils.version import LooseVersion
from sqlalchemy.sql.expression import ClauseElement
from flask import Flask
import json
import requests
from gitlab_freak.models import db, ProjectDependency
import gitlab
app = Flask(__name__)
app.config.from_envvar... | mit |
fabiand/anaconda | pyanaconda/constants_text.py | 2 | 1811 | #
# constants_text.py: text mode constants
#
# Copyright (C) 2000, 2001, 2002 Red Hat, Inc. All rights reserved.
#
# 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 Licen... | gpl-2.0 |
sonata-nfv/son-cli | setup.py | 5 | 3428 | # Copyright (c) 2015 SONATA-NFV, UBIWHERE
# 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 app... | apache-2.0 |
fnaum/rez | src/rez/vendor/lockfile/sqlitelockfile.py | 487 | 5540 | from __future__ import absolute_import, division
import time
import os
try:
unicode
except NameError:
unicode = str
from . import LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked
class SQLiteLockFile(LockBase):
"Demonstrate SQL-based locking."
testdb = None
def __init__(self, path, t... | lgpl-3.0 |
Vagab0nd/SiCKRAGE | lib3/dogpile/cache/proxy.py | 2 | 2601 | """
Proxy Backends
------------------
Provides a utility and a decorator class that allow for modifying the behavior
of different backends without altering the class itself or having to extend the
base backend.
.. versionadded:: 0.5.0 Added support for the :class:`.ProxyBackend` class.
"""
from .api import CacheBa... | gpl-3.0 |
benekastah/rock-paper-scissors | rps.py | 1 | 11894 | # pylint: disable=missing-docstring
from collections import OrderedDict, defaultdict
import select
import socket
import sys
class Style(object):
RESET = 0
BOLD = 1
UNDERSCORE = 4
BLINK = 5
INVERT = 7
CONCEAL = 8
FG_BLACK = 30
FG_RED = 31
FG_GREEN = 32
FG_YELLOW = 33
FG_BLU... | bsd-3-clause |
sol/aeson | tests/JSONTestSuite/parsers/test_json-jq.py | 5 | 1169 | #!/usr/bin/env python
import os
import subprocess
import sys
jq_paths = ["/usr/local/bin/jq", "/Users/nst/bin/jq"]
dir_path = "/Users/nst/Projects/dropbox/JSON/test_cases/"
existing_jq_paths = [p for p in jq_paths if os.path.exists(p)]
if len(existing_jq_paths) == 0:
print "-- cannot find jq"
sys.exit(1)
jq... | bsd-3-clause |
cxxgtxy/tensorflow | tensorflow/contrib/data/python/kernel_tests/sequence_dataset_op_test.py | 6 | 8032 | # 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... | apache-2.0 |
wavelets/zipline | zipline/utils/test_utils.py | 5 | 3103 | from contextlib import contextmanager
from logbook import FileHandler
from zipline.finance.blotter import ORDER_STATUS
from six import itervalues
import pandas as pd
def to_utc(time_str):
return pd.Timestamp(time_str, tz='US/Eastern').tz_convert('UTC')
def setup_logger(test, path='test.log'):
test.log_han... | apache-2.0 |
steebchen/youtube-dl | youtube_dl/extractor/sohu.py | 50 | 6911 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_urlencode,
)
from ..utils import (
ExtractorError,
int_or_none,
try_get,
)
class SohuIE(InfoExtractor):
_VALID_URL = r'https?://(?P<mytv>... | unlicense |
brettgoldstein3/brettgoldstein-site | lib/flask/app.py | 345 | 76786 | # -*- coding: utf-8 -*-
"""
flask.app
~~~~~~~~~
This module implements the central WSGI application object.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from threading import Lock
from datetime import timedelta
from itertools import... | apache-2.0 |
Rubisk/mcedit2 | src/mcedit2/plugins.py | 1 | 10201 | """
plugins
"""
from __future__ import absolute_import, division, print_function
from collections import defaultdict
import logging
import itertools
import os
import imp
import traceback
from mcedit2 import editortools
from mcedit2.editortools import generate
from mcedit2.util import load_ui
from mcedit2.util.setti... | bsd-3-clause |
leopittelli/Django-on-App-Engine-Example | django/utils/http.py | 29 | 9645 | from __future__ import unicode_literals
import base64
import calendar
import datetime
import re
import sys
from binascii import Error as BinasciiError
from email.utils import formatdate
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import force_str, force_text
from django.utils.fu... | mit |
sheepray/volatility | volatility/win32/modules.py | 58 | 1117 | # Volatility
# Copyright (C) 2007-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility 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 o... | gpl-2.0 |
mozilla-metrics/fhr-toolbox | mrjob/churn-analysis.py | 2 | 5297 | """
Analyze a historical week to understand Firefox churn.
"""
import healthreportutils
from datetime import date, datetime, timedelta
import os, shutil, csv
import sys, codecs
import traceback
import mrjob
from mrjob.job import MRJob
import tempfile
try:
import simplejson as json
except ImportError:
import ... | apache-2.0 |
mark-ignacio/phantomjs | src/breakpad/src/tools/gyp/tools/pretty_sln.py | 137 | 4977 | #!/usr/bin/python2.5
# Copyright 2009 Google Inc.
# All Rights Reserved.
"""Prints the information in a sln file in a diffable way.
It first outputs each projects in alphabetical order with their
dependencies.
Then it outputs a possible build order.
"""
__author__ = 'nsylvain (Nicolas Sylvain)'
import os
... | bsd-3-clause |
maxrothman/aws-alfred-workflow | venv/lib/python2.7/site-packages/jmespath/functions.py | 21 | 13008 | import math
import json
import weakref
from jmespath import exceptions
from jmespath.compat import string_type as STRING_TYPE
from jmespath.compat import get_methods
# python types -> jmespath types
TYPES_MAP = {
'bool': 'boolean',
'list': 'array',
'dict': 'object',
'NoneType': 'null',
'unicode':... | mit |
davidwaroquiers/pymatgen | pymatgen/analysis/tests/test_structure_matcher.py | 5 | 47994 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import itertools
import json
import os
import unittest
import numpy as np
from monty.json import MontyDecoder
from pymatgen.core.periodic_table import Element
from pymatgen.core.lattice import Lattice
from p... | mit |
undoware/neutron-drive | google_appengine/google/appengine/api/files/gs.py | 3 | 11379 | #!/usr/bin/env python
#
# Copyright 2007 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/LICENSE-2.0
#
# Unless required by applicable law o... | bsd-3-clause |
whitehorse-io/encarnia | pyenv/lib/python2.7/site-packages/django/contrib/gis/geos/collections.py | 292 | 4986 | """
This module houses the Geometry Collection objects:
GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
"""
import json
from ctypes import byref, c_int, c_uint
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.geometry import (
GEOSGeometry, ProjectInterpolateM... | mit |
sukiand/idapython | examples/ex_cli.py | 16 | 3448 | # -----------------------------------------------------------------------
# This is an example illustrating how to implement a CLI
# (c) Hex-Rays
#
from idaapi import NW_OPENIDB, NW_CLOSEIDB, NW_TERMIDA, NW_REMOVE, COLSTR, cli_t
#<pycode(ex_cli_ex1)>
class mycli_t(cli_t):
flags = 0
sname = "pycli"
... | bsd-3-clause |
disruptek/boto | boto/sdb/db/__init__.py | 189 | 1108 | # Copyright (c) 2006,2007,2008 Mitch Garnaat http://garnaat.org/
#
# 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,... | mit |
papouso/odoo | addons/hr_payroll_account/hr_payroll_account.py | 240 | 10840 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it ... | agpl-3.0 |
cristianquaglio/odoo | addons/hr_payroll_account/hr_payroll_account.py | 52 | 10905 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it ... | apache-2.0 |
pilou-/ansible | lib/ansible/modules/cloud/xenserver/xenserver_guest.py | 7 | 97662 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, Bojan Vitnik <bvitnik@mainstream.rs>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_versi... | gpl-3.0 |
clarkperkins/stackdio | stackdio/api/cloud/utils.py | 2 | 2418 | # -*- coding: utf-8 -*-
# Copyright 2017, Digital Reasoning
#
# 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... | apache-2.0 |
CiscoSystems/nova | nova/tests/api/openstack/compute/contrib/test_extended_server_attributes.py | 31 | 4912 | # Copyright 2011 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... | apache-2.0 |
ngageoint/geoq | geoq/proxy/tests.py | 1 | 6015 | from django.test import TestCase,Client
from httmock import urlmatch, response, HTTMock
import os
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from .models import *
def register_valid_proxy(name,url,refresh=100):
p = SourceDocument.objects.create(Name=name,Source... | mit |
bokeh/bokeh | tests/integration/widgets/test_toggle.py | 1 | 4531 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | bsd-3-clause |
CapOM/ChromiumGStreamerBackend | tools/telemetry/third_party/gsutilz/third_party/boto/tests/integration/s3/test_bucket.py | 88 | 12516 | # -*- coding: utf-8 -*-
# Copyright (c) 2011 Mitch Garnaat http://garnaat.org/
# 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
# witho... | bsd-3-clause |
Ballz0fSteel/Umeko | lib/youtube_dl/extractor/ted.py | 16 | 11976 | from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
try_get,
)
class TEDIE(InfoExtractor):
IE_NAME = 'ted'
_VALID_URL = r'''(?x)
(?P<proto>https?://)
(?P<type>www|embed(?:-... | gpl-3.0 |
cbrewster/servo | tests/wpt/web-platform-tests/tools/pywebsocket/mod_pywebsocket/util.py | 23 | 14116 | # Copyright 2011, Google Inc.
# 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 list of conditions and the f... | mpl-2.0 |
sachdevs/rmc | models/rating.py | 8 | 3818 | import json
import logging
import mongoengine as me
import rmc.shared.util as util
class AggregateRating(me.EmbeddedDocument):
rating = me.FloatField(min_value=0.0, max_value=1.0, default=0.0)
count = me.IntField(min_value=0, default=0)
sorting_score_positive = me.FloatField(
min_value=0.0, max_... | mit |
stevenmizuno/QGIS | python/plugins/processing/tests/GdalAlgorithmsTest.py | 9 | 5256 | # -*- coding: utf-8 -*-
"""
***************************************************************************
GdalAlgorithmTests.py
---------------------
Date : January 2016
Copyright : (C) 2016 by Matthias Kuhn
Email : matthias@opengis.ch
***********************... | gpl-2.0 |
axilleas/ansible | lib/ansible/plugins/callback/mail.py | 114 | 4572 | # -*- coding: utf-8 -*-
# Copyright 2012 Dag Wieers <dag@wieers.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 License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your ... | gpl-3.0 |
racitup/django-currencies | example/settings.py | 2 | 2709 | """
Django settings for example project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.