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 |
|---|---|---|---|---|---|
# 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 req... | openstack/tacker | tacker/tests/unit/__init__.py | Python | apache-2.0 | 887 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks 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
import os
import json
import sys
from nose.plugins.skip import SkipTest
i... | skg-net/ansible | test/units/modules/network/f5/test_bigip_device_facts.py | Python | gpl-3.0 | 4,099 |
"""
Copyright (c) 2013 Timon Wong
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sub... | Lyleo/OmniMarkupPreviewer | OmniMarkupLib/LibraryPathManager.py | Python | mit | 1,732 |
from invoke import task
@task
def expect_conf_value(c):
assert c.it_came_from == "yml"
@task
def expect_conf_key_filename(c):
expected = ["private.key", "other.key"]
got = c.connect_kwargs.key_filename
assert got == expected, "{!r} != {!r}".format(got, expected)
@task
def expect_cli_key_filename(c... | fabric/fabric | tests/_support/yml_conf/fabfile.py | Python | bsd-2-clause | 455 |
# -*- coding: utf-8 -*-
""" Friendly Dates and Times """
# Disable pylint's invalid name warning. 'tz' is used in a few places and it
# should be the only thing causing pylint to include the warning.
# pylint: disable-msg=C0103
import calendar
import datetime
import locale
import os
import pytz
import random
# Some... | MVReddy/WhenPy | when.py | Python | bsd-3-clause | 22,733 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2020 OSMC (KodeKarnage)
This file is part of script.module.osmcsetting.services
SPDX-License-Identifier: GPL-2.0-or-later
See LICENSES/GPL-2.0-or-later for more information.
"""
__all__ = ['services_gui', 'osmc']
| French77/osmc | package/mediacenter-addon-osmc/src/script.module.osmcsetting.services/resources/lib/osmcservices/__init__.py | Python | gpl-2.0 | 279 |
from __future__ import absolute_import, unicode_literals
from celery.utils.log import get_task_logger
from dash.orgs.models import Org
from dash.utils import datetime_to_ms
from dash.utils.sync import sync_pull_contacts, sync_push_contact
from django.utils import timezone
from djcelery_transactions import task
logger... | rapidpro/chatpro | chatpro/profiles/tasks.py | Python | bsd-3-clause | 2,148 |
###########################################################
#
# Copyright (c) 2012, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | Southpaw-TACTIC/TACTIC | src/tactic/ui/report/stype_report_wdg.py | Python | epl-1.0 | 6,424 |
# -*- coding: utf-8 -*-
""" Deployment Settings
@requires: U{B{I{gluon}} <http://web2py.com>}
@copyright: 2009-2014 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (t... | gnarula/eden_deployment | modules/s3cfg.py | Python | mit | 102,307 |
import six
if six.PY3:
from unittest import mock, TestCase
else:
from unittest import TestCase
import mock
from generic_request_signer.response import Response
class ResponseTests(TestCase):
sut_class = Response
def setUp(self):
self.raw_response = mock.Mock()
self.raw_response... | imtapps/generic-request-signer | generic_request_signer/tests/response_tests.py | Python | bsd-2-clause | 3,206 |
from django import template
register = template.Library()
@register.inclusion_tag('socialregistration/openid/form.html', takes_context=True)
def openid_form(context, provider=None, button=None):
return {
'provider': provider,
'button': button,
'request': context['request']
}
| vinco/django-socialregistration | socialregistration/contrib/openid/templatetags/openid.py | Python | mit | 316 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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, eit... | Alignak-monitoring/alignak | alignak/log.py | Python | agpl-3.0 | 14,506 |
# Copyright (c) 2016 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | viktorTarasov/PyKMIP | kmip/services/server/crypto/api.py | Python | apache-2.0 | 2,580 |
# Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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... | ezequielpereira/Time-Line | specs/NumTimeType.py | Python | gpl-3.0 | 1,532 |
#
# Copyright (C) 2000 Stefan Seefeld
# Copyright (C) 2000 Stephen Davies
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
"""Utility functions for IDL compilers
escapifyString() -- return a string with non-printing characters escaped.
slash... | stefanseefeld/synopsis | Synopsis/Util.py | Python | lgpl-2.1 | 14,681 |
# The name of the dashboard to be added to HORIZON['dashboards']. Required.
DASHBOARD = 'help_about'
DISABLED = False
# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = [
'openstack_dashboard.dashboards.help_about',
]
| ging/horizon | openstack_dashboard/enabled/_35_help_about.py | Python | apache-2.0 | 250 |
# gozerbot/periodical.py
#
#
""" provide a periodic structure. """
__author__ = "Wijnand 'tehmaze' Modderman - http://tehmaze.com"
__license__ = "BSD License"
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.trace import calledfrom, whichmodule
from jsb.utils.locking import lockdec
fro... | Petraea/jsonbot | jsb/lib/periodical.py | Python | mit | 8,994 |
import sys
import Image
im = Image.open("guitars.bmp")
rgb_im = im.convert('RGB')
for y in xrange(0,im.size[1]):
for x in xrange(0,im.size[0]):
r, g, b = rgb_im.getpixel((x, y))
pixel = (32*int(round(r/32))) + (4*int(round(g/32))) + int(round(b/64));
print pixel , ","
| dqydj/VGAtonic | Hardware_Rev_A/Galileo as Arduino/videocard.py | Python | mit | 280 |
# -*- coding: utf-8 -*-
#
# createrepo_c documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 8 13:45:14 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.
#
... | janncker/createrepo_c | doc/python/conf.py | Python | gpl-2.0 | 8,128 |
import logging
from smtplib import SMTPException
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.http.response import HttpResponseForbidden
from django.core.urlresolvers import rev... | njl/pycon | pycon/tutorials/views.py | Python | bsd-3-clause | 4,833 |
import math
import requests
import json
import os
# Author: Michael Woods
# Home Page: https://github.com/vgm64/gmplot
# Keywords: python wrapper google maps
# License: MIT
# Package Index Owner: Michael.Woods
class GoogleMapPlotter(object):
def __init__(self, center_lat, center_lng, zoom):
self.center = (float... | Kronuz/Xapiand | oldtests/examples/geospatial/google_map_plotter.py | Python | mit | 11,437 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | tanglei528/horizon | openstack_dashboard/dashboards/project/access_and_security/api_access/tables.py | Python | apache-2.0 | 1,998 |
#!/usr/bin/env python
#
import os
import sys
from datetime import datetime
from datetime import timedelta
import yaml
import click
import clients
class CommandException(click.ClickException):
pass
def load_config_file():
config_file = os.path.expanduser('~/.evoc')
if not os.path.isfile(config_file):
... | kbhaines/evocli | evocli/__main__.py | Python | mit | 5,036 |
from scipy.optimize import fmin_ncg, anneal, fmin_cg, fmin_bfgs, fmin_tnc, fmin_l_bfgs_b
import __main__
import numpy
import pylab
import sys
sys.path.append('/exports/home/s0570140/go/Theano/')
import theano
theano.config.floatX='float32'
#theano.config.warn.sum_sum_bug=False
from theano import tensor as T
from thean... | jesuscript/topo-mpi | contrib/JanA/LSCSMOLD.py | Python | bsd-3-clause | 37,661 |
import sys
import time
import raster_utils as rutils
from osgeo import gdal
stime = time.time()
raster = rutils.Raster(sys.argv[1], True, True)
raster.assert_datatype(gdal.GDT_Byte, "Unable to reclassify near NoData value")
black = 0
near_black = None
if black in raster.nodata:
print "NoDa... | kubaszostak/gdal-dragndrop | dndpy/raster_reclassify_near_nodata.py | Python | mit | 1,323 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import msgprint
from webnotes.utils import cstr, cint
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doc... | Yellowen/Owrang | utilities/doctype/address/address.py | Python | agpl-3.0 | 2,030 |
import numpy as np
import pandas as pd
from lazy_property import LazyProperty
from . import _describe_template
from .plot import Plotter
from .. import bin_counts
from .. import numeric_datatypes, _pretty_print
from ..util import seaborn_required
class Column(object):
"""
In Pandas, a column of a DataFrame i... | jackmaney/pg-utils | pg_utils/column/base.py | Python | mit | 10,187 |
# Copyright 2018 Red Hat, Inc. and others. 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 appli... | opendaylight/netvirt | resources/tools/odltools/odltools/monitor/cli.py | Python | epl-1.0 | 1,831 |
# -*- coding: utf-8 -*-
""" GIS Module
@requires: U{B{I{gluon}} <http://web2py.com>}
@requires: U{B{I{shapely}} <http://trac.gispython.org/lab/wiki/Shapely>}
@copyright: (c) 2010-2015 Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaini... | bobrock/eden | modules/s3/s3gis.py | Python | mit | 397,066 |
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'opportunity',
'transactions': [
{
'items': ['Quotation', 'Supplier Quotation']
},
]
} | saurabh6790/erpnext | erpnext/crm/doctype/opportunity/opportunity_dashboard.py | Python | gpl-3.0 | 204 |
import array
import mmap
import numpy as np
import pytest
from numcodecs.compat import ensure_text, ensure_bytes, ensure_contiguous_ndarray
def test_ensure_text():
bufs = [
b'adsdasdas',
'adsdasdas',
np.asarray(memoryview(b'adsdasdas')),
array.array('B', b'qwertyuiqwertyui')
... | zarr-developers/numcodecs | numcodecs/tests/test_compat.py | Python | mit | 3,634 |
# Copyright (c) 2018 Charles University, Faculty of Arts,
# Institute of the Czech National Corpus
# Copyright (c) 2018 Tomas Machalek <tomas.machalek@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as publis... | tomachalek/kontext | lib/bgcalc/konserver.py | Python | gpl-2.0 | 13,275 |
__author__ = 'Simon'
from os import getcwd
from os.path import join, exists
import configparser
class configuration:
def __init__(self, file_name, location=getcwd()):
self.file_name = file_name
self.location = location
self.path = join(location, file_name)
if not exists(self.path):... | Winter259/start-arma-dedi | evergreen.py | Python | mit | 4,375 |
"""
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 use this ... | zouzhberk/ambaridemo | demo-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py | Python | apache-2.0 | 12,819 |
"""Test kytos.core.websocket module."""
import logging
from copy import copy
from unittest import TestCase
from unittest.mock import Mock
from kytos.core.logs import LogManager
class TestWebSocketLog(TestCase):
"""Test special requirements for web socket logging."""
def test_no_requests_logging(self):
... | kytos/kytos | tests/unit/test_core/test_websocket.py | Python | mit | 1,046 |
#!/usr/bin/env python
"""
Copyright 2016 Benjamin Elder (BenTheElder)
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 l... | BenTheElder/MrCoffeeBot | build.py | Python | apache-2.0 | 883 |
# Copyright (c) 2017 DataCore Software Corp. 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... | phenoxim/cinder | cinder/volume/drivers/datacore/fc.py | Python | apache-2.0 | 7,265 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author: Exp
Date: 2015-04-19
Code: POJ 1002
Problem: 487-3276
URL:
"""
import sys
numDict = dict([('A', '2'), ('B', '2'), ('C', '2'),
('D', '3'), ('E', '3'), ('F', '3'),
('G', '4'), ('H', ... | lyy289065406/expcodes | python/02-algorithm/ACM/POJ/POJ1002/POJ1002.py | Python | gpl-3.0 | 1,680 |
__author__ = 'SolarLune'
from bge import logic
import mathutils
from . import window
ML_LOCK_NONE = 0 # Constants for mouse-look axis locking
ML_LOCK_X = 1
ML_LOCK_Y = 2
# TODO: Add axis setting to allow for joystick analog controlled mouse-look
def mouse_look(obj=None, accel_speed=1.0, max_speed=45.0, frictio... | SolarLune/SolHelp | BGE/bghelper/game.py | Python | mit | 1,538 |
# encoding: utf-8
# module gtk.gdk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/_gtk.so
# by generator 1.135
# no doc
# imports
from exceptions import Warning
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
import pango as __pango
import pangocairo as __pangocairo
... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/gtk/gdk/EventMask.py | Python | gpl-2.0 | 1,175 |
# coding: utf-8
import os.path
import sys
import time
sys.path.append(os.path.pardir)
import setuputils
extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'astor'
copyright = u'2013-%s, Berker Peksag' % time.strftime('%Y')
version = release = setuputils.find_... | zackmdavis/astor | docs/conf.py | Python | bsd-3-clause | 625 |
import pika, os, urlparse, random, pytz, glob
from time import sleep
from datetime import datetime
def read_temp_raw():
f = open(device_file, 'r')
lines = f.readlines()
f.close()
return lines
def read_temp():
lines = read_temp_raw()
while lines[0].strip()[-3:] != 'YES':
time.sleep(0.2... | wadewegner/iot-monitortemps | src/iot/app.py | Python | bsd-3-clause | 2,097 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import ui
import sys
import sqlite3
import threading
import os
import math
import random
import functools
import platform
from PyQt5 import QtCore, QtGui, QtWidgets
from ITUSIS_Parser import ITUSIS_Parser
class ITU_Programci():
def __init__(self):
self.app = Q... | omerfirmak/ITU-Programci-PY | qt_main.py | Python | gpl-3.0 | 14,021 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/cii/v20201210/models.py | Python | mit | 10,500 |
# -*- coding: utf-8 -*-
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#########################################################################
... | relsi/saria | web_app/models/db.py | Python | mit | 3,899 |
# Copyright 2013 Red Hat 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 ag... | Metaswitch/calico-nova | nova/tests/unit/objects/test_block_device.py | Python | apache-2.0 | 13,734 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015 sinfonier-project
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 restricti... | sinfonier-project/sinfonier-dev-tool | multilang/python/testpyspout.py | Python | apache-2.0 | 2,298 |
import copy
import sys
import subprocess
from subprocess import PIPE
from pprint import pprint
class FrameworkTestType:
'''Interface between a test type (json, query, plaintext, etc) and
the rest of TFB. A test type defines a number of keys it expects
to find in the benchmark_config.json, and this base class h... | denkab/FrameworkBenchmarks | toolset/benchmark/test_types/framework_test_type.py | Python | bsd-3-clause | 4,730 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013-2014, Epic Games, Inc.
#
# 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
# (... | tjanez/ansible | lib/ansible/modules/monitoring/zabbix_screen.py | Python | gpl-3.0 | 17,341 |
# Copyright 2014 Knowledge Economy Developments Ltd
#
# Henry Gomersall
# heng@kedevelopments.co.uk
#
# 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 ret... | drwells/pyFFTW | test/test_pyfftw_wisdom.py | Python | bsd-3-clause | 2,909 |
"""
A suffix tree implementation in Python
Algorithm:
Ukkonen E. On-line construction of suffix trees[J]. Algorithmica, 1995, 14(3): 249-260.
https://www.cs.helsinki.fi/u/ukkonen/SuffixT1withFigs.pdf
Author:
Luyu (taoistly@gmail.com)
"""
import collections
class SuffixTree(object):... | taoistly/dec | suffixtree_v2.py | Python | mit | 5,509 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
''' Rasta RST Editor
2010 - Gökmen Göksel <gokmeng:gmail.com> '''
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as Published by the Free
# Software Foundation; either version 2 of the License,... | gokmen/Rasta | rasta_lib/rasta.py | Python | gpl-2.0 | 16,437 |
"""doit CLI (command line interface)"""
import os
import sys
import traceback
from collections import defaultdict
from configparser import ConfigParser
import importlib
from .version import VERSION
from .plugin import PluginDict
from .exceptions import InvalidDodoFile, InvalidCommand, InvalidTask
from .cmdparse impor... | pydoit/doit | doit/doit_cmd.py | Python | mit | 10,770 |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2017 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import functools
from gevent import lock
from bliss.config.conductor.client import Lock
from bliss.config.channels import Cache
from bli... | tiagocoutinho/bliss | bliss/common/shutter.py | Python | lgpl-3.0 | 10,215 |
import datetime
from django.db.models import Q
from django.http import HttpResponse, HttpResponseServerError, Http404, HttpResponseNotFound, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
f... | django-rea/nrp | django_rea/board/views.py | Python | agpl-3.0 | 46,450 |
import os
import sys
import warnings
from setuptools import setup
version_contents = {}
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "shippo", "version.py"), encoding="utf-8") as f:
exec(f.read(), version_contents)
setup(
name='shippo',
version=version_contents['VERSION... | goshippo/shippo-python-client | setup.py | Python | mit | 1,408 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLayoutManager.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
... | SrNetoChan/QGIS | tests/src/python/test_qgslayoutmanager.py | Python | gpl-2.0 | 10,513 |
# coding=utf-8
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | google-research/football | gfootball/scenarios/tests/keeper_test.py | Python | apache-2.0 | 1,184 |
from os import path
from types import *
import alp
# Check for input
if len(alp.args()) > 0:
adds = alp.args()[0].split('\t')
else:
print 'Nothing to add to Favorites.'
raise SystemExit
# SCRIPT EXITS
# Sync & load favorites
favs = alp.jsonLoad('favorites.json', default=[])
# Correct existing favorites
if type(fa... | TylerEich/Alfred-Extras | Source/Favorites/add.py | Python | mit | 864 |
import json, gzip, codecs, os, os.path
def open_text_file (filename, encoding = 'latin1'):
"""open a binary file and return a readable handle.
check for compressed files and open with decompression.
"""
first_bytes = open (filename, 'rb').read (2)
if first_bytes == b'\x1f\x8b':
# looks like a gzipped ... | millighost/dsf-utils | dsf_io.py | Python | gpl-3.0 | 1,797 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | adaitche/luigi | test/contrib/pig_test.py | Python | apache-2.0 | 7,135 |
from landscape.client.patch import SQLiteUpgradeManager
upgrade_manager = SQLiteUpgradeManager()
| CanonicalLtd/landscape-client | landscape/client/upgraders/package.py | Python | gpl-2.0 | 98 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('resources', '0001_initial'),
]
o... | andela-ooshodi/codango-debug | codango/comments/migrations/0001_initial.py | Python | mit | 857 |
#!/usr/bin/env python
"""Compare FIFF files.
You can do for example:
$ mne compare_fiff test_raw.fif test_raw_sss.fif
"""
# Authors : Eric Larson, PhD
import sys
import mne
def run():
"""Run command."""
parser = mne.commands.utils.get_optparser(
__file__, usage='mne compare_fiff <file_a> <file_b>'... | teonlamont/mne-python | mne/commands/mne_compare_fiff.py | Python | bsd-3-clause | 535 |
import json
from django.test import TestCase
from django.test import override_settings
from django.core.exceptions import ObjectDoesNotExist
from mock import patch
from mock import Mock
from mock import MagicMock
from phone_numbers.models import PhoneNumber
from sims.models import Sim
from sms.models import SmsMessa... | RobSpectre/garfield | garfield/contacts/tests/test_tasks.py | Python | mit | 22,585 |
# 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 use ... | cryptickp/libcloud | libcloud/dns/drivers/softlayer.py | Python | apache-2.0 | 7,438 |
"""
WSGI config for simple_django_rest_api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "simple_django_rest_api.... | frnkn/django-simple-rest-api | simple_django_rest_api/wsgi.py | Python | apache-2.0 | 419 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016 Jonathan Schultz
#
# 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 lat... | BarraQDA/twitterScrape | twitterScrape/twitterMatrix.py | Python | gpl-3.0 | 8,225 |
import os
import requests
import shutil
def get_cat(folder, name):
url = 'http://consuming-python-services-api.azurewebsites.net/cats/random'
data = get_data_from_url(url)
save_image(folder, name, data)
def get_data_from_url(url):
response = requests.get(url, stream=True)
return response.raw
... | derrickyoo/python-jumpstart | apps/06_cat_factory/cat_service.py | Python | mit | 487 |
from __future__ import unicode_literals
import re
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _, ungettext_lazy
from django.utils.encoding import force_text
from django.utils.ipv6 import is_valid_ipv6_add... | TimBuckley/effective_django | django/core/validators.py | Python | bsd-3-clause | 9,315 |
#!/usr/bin/env python
from setuptools import setup, find_packages
entry_points = [
]
setup(
name='luna.sso',
version='0.0.1',
description='Luna Project',
url='http://github.com/luna/luna',
include_package_data=True,
packages=find_packages(),
entry_points={"console_scripts": entry_points},... | docloud/sso | setup.py | Python | mit | 419 |
# -*- coding: UTF-8 -*-
from tests.base import ApiDBTestCase
from zou.app.models.custom_action import CustomAction
from zou.app.utils import fields
class CustomActionTestCase(ApiDBTestCase):
def setUp(self):
super(CustomActionTestCase, self).setUp()
self.generate_data(CustomAction, 3)
def te... | cgwire/zou | tests/models/test_custom_actions.py | Python | agpl-3.0 | 2,577 |
# -*- coding: utf-8 -*-
from django.forms import ModelForm
from django import forms
from cmsplugin_rst.models import ReSTField
class ReSTForm(ModelForm):
class Meta:
model = ReSTField
exclude = ('rst_html',)
| indexofire/cmsplugin_rst | cmsplugin_rst/forms.py | Python | bsd-3-clause | 229 |
# sql/operators.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# This module is part of SQLAlchemy and is released under
# the MIT License: https... | sqlalchemy/sqlalchemy | lib/sqlalchemy/sql/operators.py | Python | mit | 54,578 |
#!/usr/bin/env python
import os
import sys
def main():
skip = set([
'test/sanity/code-smell/%s' % os.path.basename(__file__),
# facts is grandfathered in but will break namespacing
# the only way to fix it is to deprecate and eventually remove it
# six will break namespacing but b... | trondhindenes/ansible | test/sanity/code-smell/empty-init.py | Python | gpl-3.0 | 733 |
import vec
import math
rotation = False
# State class
# !!!ALL state class values are in Frame 0!!!
class State:
p = [0,0,0]
v = [0,0,0]
th= [0,0,0]
w = [0,0,0]
def __init__(self, p=[0,0,0], v = [0,0,0], th = [0,0,0], w = [0,0,0]):
self.p = p
self.v = v
self.th = th
... | omnisciendus/AE-352 | hw4/State.py | Python | gpl-2.0 | 2,147 |
#!/usr/bin/python3
"""jira_descr.py queries JIRA for issue description info
The information includes, values for:
- issue type
- status
- resolution
- priority
The information is retrieved and formatted for nice printing. This is a
utility for configuring the JIRA access for a new project.
Source documentation: http... | GripQA/client-tools | jira-access/jira_descr.py | Python | apache-2.0 | 2,675 |
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
class AccountTax(models.Model):
_inherit = 'account.tax'
def _compute_totals_tax(self, data):
res = super(AccountTax, self)._compute_totals_tax(data)
if self.is_split_payment:
... | linkitspa/l10n-italy | l10n_it_vat_registries_split_payment/models/account_tax.py | Python | agpl-3.0 | 532 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'wizard\ui_column_depend.ui'
#
# Created: Sun Aug 29 12:01:09 2021
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QS... | gltn/stdm | stdm/ui/wizard/ui_column_depend.py | Python | gpl-2.0 | 4,631 |
import tensorflow as tf
_downsample = tf.load_op_library(
tf.resource_loader.get_path_to_datafile("./ops/build/downsample.so"))
def downsample(tensor, size):
return _downsample.downsample(tensor, size)
| sampepose/flownet2-tf | src/downsample.py | Python | mit | 213 |
########################
# Problem Set 04
#########################
def getWordScore(word, n):
"""
Returns the score for a word. Assumes the word is a valid word.
The score for a word is the sum of the points for letters in the
word, multiplied by the length of the word, PLUS 50 points if all n
... | pshlos46/edX-MITx-6.00.1x---Fall-2015 | Problem Set 04.py | Python | mit | 15,708 |
"""
Student Views
"""
import datetime
import logging
import uuid
import time
import json
import warnings
from collections import defaultdict
from pytz import UTC
from ipware.ip import get_ip
from django.conf import settings
from django.contrib.auth import logout, authenticate, login
from django.contrib.auth.models imp... | vismartltd/edx-platform | common/djangoapps/student/views.py | Python | agpl-3.0 | 90,921 |
# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
# Copyright 2016 John Eskew <jeskew@edx.org> ... | pymedusa/Medusa | ext/github/CommitCombinedStatus.py | Python | gpl-3.0 | 4,932 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 17 14:52:36 2017
@author: mattjohnson
"""
import os
import numpy as np
from rmgpy.molecule.molecule import Molecule
from adjacency import Adjacency
from line import *
from line import get_hough_lines
from lines_to_graph import lines_to_graph
from sk... | Molecular-Image-Recognition/Molecular-Image-Recognition | code/loss.py | Python | mit | 1,323 |
# 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-network/azure/mgmt/network/v2016_09_01/models/topology_association.py | Python | mit | 1,586 |
__author__ = 'Victoria'
class myDog(object):
def __init__(self, dog_current_room, dog_leashed):
self.dog_current_room = dog_current_room
self.dog_leashed = dog_leashed | ashpath/walk-the-dog | dog_class.py | Python | agpl-3.0 | 193 |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import os
DEBUG = True
TESTING = True
PRODUCTION = False
FLASK_DEBUGTOOLBAR = False
HOST = '0.0.0.0'
SQLALCHEMY_DATABASE_URI = os.environ.get(
'GGRC_DATABASE_URI',
'mysql+mysqldb://root:root@127.0.0... | AleksNeStu/ggrc-core | src/ggrc/settings/development.py | Python | apache-2.0 | 809 |
#!/usr/bin/python
# This file is part of P4wnP1.
#
# Copyright (c) 2017, Marcus Mengs.
#
# P4wnP1 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 ... | Swiftb0y/P4wnP1 | ledtool/ledtool.py | Python | gpl-3.0 | 2,296 |
#!/usr/bin/python
'''
SPIM Auto-grader
Owen Stenson
Grades every file in the 'submissions' folder using every test in the 'samples' folder.
Writes to 'results' folder.
'''
import os, time, re
from subprocess import Popen, PIPE, STDOUT
def run(fn, sample_input='\n'):
#start process and write input
p... | stuarthoye/travisPython | spimgrader.py | Python | gpl-2.0 | 3,195 |
from .pyhit import Node, load, write, parse
| nuclear-wizard/moose | python/pyhit/__init__.py | Python | lgpl-2.1 | 44 |
# Copyright 2017 AT&T Intellectual Property. All other 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... | att-comdev/drydock | drydock_provisioner/drivers/oob/pyghmi_driver/__init__.py | Python | apache-2.0 | 619 |
#!/usr/bin/env python3
# Copyright (C) 2013 Jai Luthra <me@jailuthra.in>
def main():
str1 = input()
print (atbash(str1))
def atbash(str1):
str2 = ''
for char in str1:
x = ord(char)
if x<=122 and x>=97:
x = ( 27 - (x-96) ) + 96
elif x<=90 and x>=65:
x... | jailuthra/misc | python/atbash.py | Python | mit | 442 |
from django.db.models import Manager
from django.db.models.query import QuerySet, EmptyQuerySet
from django.contrib.contenttypes.fields import GenericForeignKey
from actstream import settings
class GFKManager(Manager):
"""
A manager that returns a GFKQuerySet instead of a regular QuerySet.
"""
def ... | justquick/django-activity-stream | actstream/gfk.py | Python | bsd-3-clause | 1,554 |
#!/usr/bin/env python
#
# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT lice... | barosl/rust | src/etc/extract_grammar.py | Python | apache-2.0 | 3,881 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright IBENS/Dyogen : Joseph LUCAS and Hugues ROEST CROLLIUS
# mail : jlucas@ens.fr or hrc@ens.fr
# Licences GLP v3 and CeCILL v2
import os
import sys
import phylDiag
import argparse
import utils.myDiags as myDiags
import utils.myTools as myTools
import utils.myLightGeno... | DyogenIBENS/PhylDiag | src/phylDiagViewer.py | Python | gpl-3.0 | 9,895 |
"""Python linkfire.com API"""
__version__ = "0.2"
__author__ = "Lorenzo Setale ( http://who.is.lorenzo.setale.me/? )"
__author_email__ = "koalalorenzo@gmail.com"
__copyright__ = "Copyright (c) 2013, 2014 Lorenzo Setale"
from .Base import ApiMethod
from .Link import Link | koalalorenzo/python-linkfire | linkfire/__init__.py | Python | gpl-2.0 | 273 |
#!/usr/bin/python3
import os
import sys
import datetime
import traceback
import logging
global logger
logger = logging.getLogger('scope.name')
logger.setLevel('INFO')
global log_file_name
log_file_name = ''
def set_file_handler(module, platform_type, verdict_path):
tokens = verdict_path.split(os.sep)
globa... | iotivity/iotivity | test/test_manager/ite/multi_logger.py | Python | apache-2.0 | 1,147 |
from . import exceptions, utils
| gogoair/lavatory | src/lavatory/__init__.py | Python | apache-2.0 | 32 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2019 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, eith... | dontnod/weblate | weblate/checks/qt.py | Python | gpl-3.0 | 1,975 |
import numpy as np
__author__ = "Nathan I. Budd"
__email__ = "nibudd@gmail.com"
__copyright__ = "Copyright 2017, LASR Lab"
__license__ = "MIT"
__version__ = "0.1"
__status__ = "Production"
__date__ = "16 Mar 2017"
def secant_method(f, x0, x1, tol=1e-14, Nmax=50, output=True):
"""Uses approximation of Newton's me... | lasr/orbital_elements | utilities/secant_method.py | Python | mit | 1,974 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.