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 |
|---|---|---|---|---|---|
MattsFleaMarket/python-for-android | python3-alpha/python3-src/Doc/includes/tzinfo-examples.py | 92 | 5060 | from datetime import tzinfo, timedelta, datetime
ZERO = timedelta(0)
HOUR = timedelta(hours=1)
# A UTC class.
class UTC(tzinfo):
"""UTC"""
def utcoffset(self, dt):
return ZERO
def tzname(self, dt):
return "UTC"
def dst(self, dt):
return ZERO
utc = UTC()
# A class building... | apache-2.0 |
honza/greek-new-testament | main.py | 1 | 2661 | #!/usr/bin/env python
#
# Greek New Testament
# Copyright (C) 2010 Honza Pokorny <honza@honzapokorny.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 3 of th... | gpl-3.0 |
lunafeng/django | django/contrib/gis/geos/coordseq.py | 129 | 5502 | """
This module houses the GEOSCoordSeq object, which is used internally
by GEOSGeometry to house the actual coordinates of the Point,
LineString, and LinearRing geometries.
"""
from ctypes import byref, c_double, c_uint
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.base import... | bsd-3-clause |
skg-net/ansible | lib/ansible/modules/cloud/amazon/aws_glue_job.py | 27 | 12871 | #!/usr/bin/python
# Copyright: (c) 2018, Rob White (@wimnat)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
... | gpl-3.0 |
mancoast/CPythonPyc_test | fail/341_test_traceback.py | 80 | 16912 | """Test cases for traceback module"""
from io import StringIO
import sys
import unittest
import re
from test.support import run_unittest, Error, captured_output
from test.support import TESTFN, unlink, cpython_only
import traceback
class SyntaxTracebackCases(unittest.TestCase):
# For now, a very minimal set of ... | gpl-3.0 |
transt/cloud-init-0.7.5 | tests/unittests/test_handler/test_handler_apt_configure.py | 7 | 4030 | from mocker import MockerTestCase
from cloudinit import util
from cloudinit.config import cc_apt_configure
import os
import re
class TestAptProxyConfig(MockerTestCase):
def setUp(self):
super(TestAptProxyConfig, self).setUp()
self.tmp = self.makeDir()
self.pfile = os.path.join(self.tmp,... | gpl-3.0 |
LionelDupuy/ARCHI_PHEN | MISC/test.py | 1 | 6503 | import pygame
import pygame.camera
from pygame.locals import *
#import wx
import time
from datetime import date
import numpy
import Image
import zbar
from pgu import gui
pygame.init()
pygame.camera.init()
automatic = False
pause = 0.1
size = ( 640 , 480 )
window_size = ( 640 , 480 )
shrunken = size
c... | mit |
JoshGud777/ChessWebApp | webapp/library.py | 2 | 7924 | '''This is the library files for all used code that needs to be
used multi times'''
import binascii
import cgi
import hashlib
import http.cookies
import os
import sqlite3
import time
import cgitb
cgitb.enable()
HTML_DIR = 'html\\'
REDIRECT_DIR = 'redirect\\'
DB_DIR = 'db\\'
COOKIE_MAX_AGE = 300
# COOKIE_DOMAIN = 'appl... | apache-2.0 |
wtbarnes/synthesizAR | synthesizAR/loop.py | 1 | 8956 | """
Loop object for holding field-aligned coordinates and quantities
"""
import numpy as np
from scipy.interpolate import splprep, splev, interp1d
import astropy.units as u
from astropy.coordinates import SkyCoord
from sunpy.coordinates import HeliographicStonyhurst
import sunpy.sun.constants as sun_const
import zarr
... | gpl-3.0 |
irvingprog/pilas | pilas/ejemplos/syntax.py | 6 | 6202 | # Ejemplo tomado desde la siguiente web:
# http://diotavelli.net/PyQtWiki/Python%20syntax%20highlighting
import sys
from PyQt4.QtCore import QRegExp
from PyQt4.QtGui import QColor, QTextCharFormat, QFont, QSyntaxHighlighter
def format(color, style=''):
"""Return a QTextCharFormat with the given attributes.
... | lgpl-3.0 |
yfried/ansible | lib/ansible/modules/remote_management/manageiq/manageiq_policies.py | 64 | 11828 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Daniel Korn <korndaniel1@gmail.com>
# (c) 2017, Yaacov Zamir <yzamir@redhat.com>
# 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
ANS... | gpl-3.0 |
baroquebobcat/pants | src/python/pants/reporting/reporting_utils.py | 23 | 1118 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.util.stru... | apache-2.0 |
virt-manager/virt-manager | tests/uitests/test_host.py | 2 | 6230 | # This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
from . import lib
#################################################
# UI tests for virt-manager's VM details window #
#################################################
def testHostNetworkSmokeTest(app):
"""
... | gpl-2.0 |
junhuac/MQUIC | depot_tools/external_bin/gsutil/gsutil_4.15/gsutil/third_party/rsa/rsa/util.py | 79 | 2938 | # -*- coding: utf-8 -*-
#
# Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu>
#
# 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
#
# Unl... | mit |
dekadev/Deka-kernel-CM9-3.0 | scripts/tracing/draw_functrace.py | 14676 | 3560 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | gpl-2.0 |
akloster/bokeh | examples/plotting/server/tap.py | 42 | 1346 | # The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
from __future__ import division
import itertools
import numpy as np
from six.moves import zip
from bokeh.plotting import ColumnDataSource, figure, show, output_server
from bokeh.models import TapTool
xx, yy = np.meshgrid(range(0... | bsd-3-clause |
Endika/server-tools | base_field_serialized/__openerp__.py | 7 | 1371 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
Lekensteyn/buildbot | master/buildbot/test/unit/test_scripts_checkconfig.py | 8 | 7682 | # This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | gpl-2.0 |
silviocsg/ns-3-pcp | src/uan/bindings/callbacks_list.py | 150 | 1150 | callback_classes = [
['void', 'int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3... | gpl-2.0 |
paulmueller/PyCorrFit | pycorrfit/readfiles/read_CSV_PyCorrFit.py | 2 | 6997 | """CSV files"""
import csv
import pathlib
import warnings
import numpy as np
def openCSV(path, filename=None):
"""
Read relevant data from a file looking like this:
[...]
# Comment
# Data type: Autocorrelation
[...]
1.000000e-006 3.052373e-001
1.020961e-006 ... | gpl-2.0 |
quuxlabs/goodiff-core | includes/html2text.py | 1 | 11628 | """html2text: Turn HTML into equivalent Markdown-structured text."""
__version__ = "2.25"
__author__ = "Aaron Swartz (me@aaronsw.com)"
__copyright__ = "(C) 2004 Aaron Swartz. GNU GPL 2."
__contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes"]
# TODO:
# Support decoded entities with unifiable.
# Relative URL re... | agpl-3.0 |
takahashiminoru/ryu | ryu/lib/packet/slow.py | 51 | 26925 | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 |
ContinuumIO/ashiba | enaml/enaml/qt/qt_status_bar.py | 1 | 4543 | #------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------------------------------... | bsd-3-clause |
david30907d/feedback_django | spirit/comment/like/forms.py | 12 | 1071 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import CommentLike
class LikeForm(forms.ModelForm):
class Meta:
model = CommentLike
fields = []
def __init__(self, user=None, comme... | mit |
eneldoserrata/marcos_openerp | addons/procurement/wizard/schedulers_all.py | 33 | 2948 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
SerpentCS/odoo | addons/google_spreadsheet/__openerp__.py | 312 | 1710 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
pcecconi/mapground | api/serializers.py | 1 | 4248 | from rest_framework import serializers
from django.contrib.auth.models import User
from fileupload.models import Archivo
from layers.models import Capa, Categoria, Metadatos, VectorDataSource, RasterDataSource, CONST_RASTER
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
... | mit |
way2heavy/youtube-dl-1 | youtube_dl/extractor/radiobremen.py | 128 | 2471 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import parse_duration
class RadioBremenIE(InfoExtractor):
_VALID_URL = r'http?://(?:www\.)?radiobremen\.de/mediathek/(?:index\.html)?\?id=(?P<id>[0-9]+)'
IE_NAME = 'radiobremen'
_TE... | unlicense |
sekikn/incubator-airflow | airflow/smart_sensor_dags/smart_sensor_group.py | 6 | 2086 | #
# 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... | apache-2.0 |
ashang/calibre | src/calibre/ebooks/metadata/sources/ozon.py | 14 | 25750 | # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
__license__ = 'GPL 3'
__copyright__ = '2011-2013 Roman Mukhin <ramses_ru at hotmail.com>'
__docformat__ = 'restructuredtext en'
# To ensure bugfix and development please donate bitcoins to 1E6CRSLY1uNstcZjLYZB... | gpl-3.0 |
zzzombat/lucid-python-django | django/contrib/localflavor/tr/forms.py | 159 | 3430 | """
TR-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_... | bsd-3-clause |
yingerj/rdflib | rdflib/plugins/parsers/pyRdfa/__init__.py | 8 | 47186 | # -*- coding: utf-8 -*-
"""
RDFa 1.1 parser, also referred to as a “RDFa Distiller”. It is
deployed, via a CGI front-end, on the U{W3C RDFa 1.1 Distiller page<http://www.w3.org/2012/pyRdfa/>}.
For details on RDFa, the reader should consult the U{RDFa Core 1.1<http://www.w3.org/TR/rdfa-core/>}, U{XHTML+RDFa1.1<http://w... | bsd-3-clause |
libscie/liberator | liberator/lib/python3.6/site-packages/django/conf/locale/zh_Hans/formats.py | 1008 | 1810 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y年n月j日' # 2016年9月5... | cc0-1.0 |
MiroK/emi-cylinders | grid-iso.py | 1 | 1995 | from driver import geo_from_template, generate_mesh, as_pvd
from dolfin import Mesh, HDF5File
specs = {'x_cylinders': 3,
'y_cylinders': 4,
# The height of each cylinder is H with char mesh size size_R
'R': 0.8,
'H': 1.5,
'size_R': 0.2,
# The length of the joint reg... | mit |
hexpl0it/plugin.video.genesi-ita | resources/lib/indexers/navigator.py | 1 | 13135 | # -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 opt... | gpl-3.0 |
yoghadj/or-tools | examples/python/labeled_dice.py | 34 | 4106 | # Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# 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 ... | apache-2.0 |
SamiHiltunen/invenio-upgrader | invenio_upgrader/commands.py | 4 | 12769 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2013, 2014, 2015 CERN.
#
# Invenio 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... | gpl-2.0 |
phalcon/readthedocs.org | readthedocs/projects/migrations/0012_remove_status_field.py | 16 | 9389 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Project.status'
db.delete_column('projects_project', 'status')
def backwards(self,... | mit |
robbiet480/home-assistant | tests/components/command_line/test_cover.py | 5 | 2634 | """The tests the cover command line platform."""
import os
import tempfile
from unittest import mock
import pytest
import homeassistant.components.command_line.cover as cmd_rs
from homeassistant.components.cover import DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_CLOSE_COVER,
SERVICE_O... | apache-2.0 |
dpiers/coderang-meteor | public/jsrepl/extern/python/unclosured/lib/python2.7/SocketServer.py | 76 | 23342 | """Generic socket server classes.
This module tries to capture the various aspects of defining a server:
For socket-based servers:
- address family:
- AF_INET{,6}: IP (Internet Protocol) sockets (default)
- AF_UNIX: Unix domain sockets
- others, e.g. AF_DECNET are conceivable (see <socket.h>
... | mit |
asalkeld/review-bugs | review-bugs.py | 1 | 4477 | #!/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 writing, softwa... | apache-2.0 |
MaxTyutyunnikov/lino | lino/sandbox/tx25/xsd2py1.py | 1 | 2401 | import os
from xml.dom import minidom
def elements(node):
e = node.firstChild
while e is not None:
if e.nodeType == minidom.Node.ELEMENT_NODE:
yield e
e = e.nextSibling
def xsd2xg(fn,nsname):
dom = minidom.parse(fn)
yield "from lino.utils import xmlgen as xg"
yield "c... | gpl-3.0 |
tectronics/ns-3-dev-def-routing | bindings/python/apidefs/gcc-LP64/ns3_module_core.py | 2 | 203953 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
## log.h: ns3::LogLevel [enumeration]
module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_L... | gpl-2.0 |
technicalpickles/zulip | zilencer/management/commands/create_deployment.py | 114 | 2130 | from __future__ import absolute_import
from optparse import make_option
import sys
from django.core.management.base import BaseCommand
from zerver.models import get_realm
from zerver.lib.create_user import random_api_key
from zerver.management.commands.create_realm import Command as CreateRealm
from zilencer.models ... | apache-2.0 |
flwh/KK_mt6589_iq451 | prebuilts/python/darwin-x86/2.7.5/lib/python2.7/email/generator.py | 85 | 14228 | # Copyright (C) 2001-2010 Python Software Foundation
# Contact: email-sig@python.org
"""Classes to generate plain text from a message object tree."""
__all__ = ['Generator', 'DecodedGenerator']
import re
import sys
import time
import random
import warnings
from cStringIO import StringIO
from email.header import Hea... | gpl-2.0 |
gaddman/ansible | lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py | 9 | 22346 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | gpl-3.0 |
ChanderG/scipy | scipy/sparse/base.py | 51 | 28724 | """Base class for sparse matrices"""
from __future__ import division, print_function, absolute_import
__all__ = ['spmatrix', 'isspmatrix', 'issparse',
'SparseWarning','SparseEfficiencyWarning']
import sys
import numpy as np
from scipy._lib.six import xrange
from .sputils import isdense, isscalarlike, isintl... | bsd-3-clause |
FrodeSolheim/fs-uae-launcher | fsui/qt/textarea.py | 1 | 3589 | from typing import Any, List, Optional, cast
from fscore.deprecated import deprecated
from fsui.qt.color import Color
from fsui.qt.qparent import QParent
from fsui.qt.qt import QColor, QFont, QFrame, QTextCursor, QTextEdit
from fsui.qt.signal import Signal
from fswidgets.widget import Widget
class TextArea(Widget):
... | gpl-2.0 |
lugia/Python-MyWalk | console/app/pygments/formatters/html.py | 19 | 23823 | # -*- coding: utf-8 -*-
"""
pygments.formatters.html
~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for HTML output.
:copyright: 2006-2008 by Georg Brandl, Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys, os
import StringIO
try:
set
except NameError:
from sets import Set a... | apache-2.0 |
sparkslabs/kamaelia | Code/Python/Kamaelia/Kamaelia/Protocol/HTTP/Handlers/SessionExample.py | 3 | 2532 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | apache-2.0 |
CenturylinkTechnology/ansible-modules-extras | cloud/cloudstack/cs_vmsnapshot.py | 44 | 8582 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# 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 Lice... | gpl-3.0 |
BigBrother1984/android_external_chromium_org | third_party/simplejson/scanner.py | 674 | 2560 | """JSON token scanner
"""
import re
def _import_c_make_scanner():
try:
from simplejson._speedups import make_scanner
return make_scanner
except ImportError:
return None
c_make_scanner = _import_c_make_scanner()
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))... | bsd-3-clause |
birocorneliu/youtube-dl | youtube_dl/extractor/bandcamp.py | 94 | 6774 | from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
ExtractorError,
)
class BandcampIE(InfoExtractor):
_VALID_URL = r'https?://.*?\.bandcamp\.com/track/(?P<title>.*)'
_TESTS = ... | unlicense |
cloudbase/qemu | scripts/dump-guest-memory.py | 97 | 14306 | # This python script adds a new gdb command, "dump-guest-memory". It
# should be loaded with "source dump-guest-memory.py" at the (gdb)
# prompt.
#
# Copyright (C) 2013, Red Hat, Inc.
#
# Authors:
# Laszlo Ersek <lersek@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2 or later. See
# th... | gpl-2.0 |
okfish/django-oscar | tests/unit/core/autoslugfield_tests.py | 4 | 8059 | # coding=utf-8
"""
AutoSlugField taken from django-extensions at
15d3eb305957cee4768dd86e44df1bdad341a10e
Uses Oscar's slugify function instead of Django's
Copyright (c) 2007 Michael Trier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files ... | bsd-3-clause |
atsolakid/edx-platform | common/lib/xmodule/xmodule/modulestore/edit_info.py | 201 | 2843 | """
Access methods to get EditInfo for xblocks
"""
from xblock.fields import XBlockMixin
from abc import ABCMeta, abstractmethod
class EditInfoMixin(XBlockMixin):
"""
Provides the interfaces for getting the edit info from XBlocks
"""
@property
def edited_by(self):
"""
The user id o... | agpl-3.0 |
ebukoz/thrive | erpnext/erpnext_integrations/connectors/woocommerce_connection.py | 2 | 6488 |
from __future__ import unicode_literals
import frappe, base64, hashlib, hmac, json
from frappe import _
def verify_request():
woocommerce_settings = frappe.get_doc("Woocommerce Settings")
sig = base64.b64encode(
hmac.new(
woocommerce_settings.secret.encode('utf8'),
frappe.request.data,
hashlib.sha256
)... | gpl-3.0 |
andrei-karalionak/ggrc-core | src/ggrc_basic_permissions/migrations/versions/20131005140722_3be0d9d2c9f8_add_admin_role.py | 7 | 2107 | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Add Admin role.
Revision ID: 3be0d9d2c9f8
Revises: 3148b80be376
Create Date: 2013-10-05 14:07:22.359908
"""
# revision identifiers, used by Alembic.
revision = '3be0d9d2c9f8'
down_revision = '3148b80be... | apache-2.0 |
gdeOo/toggl-utils | toggl.py | 1 | 2526 | import os
import json
import urllib
import requests
import pytz
from datetime import datetime, time
from ConfigParser import ConfigParser
def config():
"""Get parameters from the configuration file.
Returns:
A dictionary with the following items:
api_token: The token used for authentication with the to... | mit |
bright-sparks/chromium-spacewalk | build/gyp_helper.py | 61 | 1624 | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file helps gyp_chromium and landmines correctly set up the gyp
# environment from chromium.gyp_env on disk
import os
SCRIPT_DIR = os.path.dirnam... | bsd-3-clause |
tgraf/net-next | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py | 4653 | 3596 | # EventClass.py
#
# This is a library defining some events types classes, which could
# be used by other scripts to analyzing the perf samples.
#
# Currently there are just a few classes defined for examples,
# PerfEvent is the base class for all perf event sample, PebsEvent
# is a HW base Intel x86 PEBS event, and use... | gpl-2.0 |
tawsifkhan/scikit-learn | sklearn/ensemble/voting_classifier.py | 178 | 8006 | """
Soft Voting/Majority Rule classifier.
This module contains a Soft Voting/Majority Rule classifier for
classification estimators.
"""
# Authors: Sebastian Raschka <se.raschka@gmail.com>,
# Gilles Louppe <g.louppe@gmail.com>
#
# Licence: BSD 3 clause
import numpy as np
from ..base import BaseEstimator
f... | bsd-3-clause |
atty303/pyfilesystem | fs/osfs/watch_win32.py | 10 | 16983 | """
fs.osfs.watch_win32
===================
Change watcher support for OSFS, using ReadDirectoryChangesW on win32.
"""
import os
import sys
import errno
import threading
import Queue
import stat
import struct
import ctypes
import ctypes.wintypes
import traceback
import weakref
try:
LPVOID = ctypes.wintypes.LPVO... | bsd-3-clause |
mattsch/Sickbeard | sickbeard/search.py | 1 | 4269 | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... | gpl-3.0 |
marrcandre/eagle-py | tests/table-format.py | 2 | 1600 | #!/usr/bin/env python2
from eagle import *
def cell_format_func(app, table, row, col, value):
if row == 4:
if col == 1:
return Table.CellFormat(contents=True)
elif col == 2:
return Table.CellFormat(contents=lambda x: x * 5)
elif col == 3:
return Table.Ce... | lgpl-2.1 |
kennethreitz/pipenv | pipenv/patched/notpip/_vendor/html5lib/treeadapters/sax.py | 156 | 1776 | from __future__ import absolute_import, division, unicode_literals
from xml.sax.xmlreader import AttributesNSImpl
from ..constants import adjustForeignAttributes, unadjustForeignAttributes
prefix_mapping = {}
for prefix, localName, namespace in adjustForeignAttributes.values():
if prefix is not None:
pre... | mit |
ProjectSWGCore/NGECore2 | scripts/mobiles/generic/static/tatooine/jasha.py | 2 | 1112 | import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | lgpl-3.0 |
EUDAT-B2SHARE/invenio-old | modules/oairepository/lib/oai_repository_unit_tests.py | 1 | 5762 | # -*- coding: utf-8 -*-
## Invenio OAI repository unit tests.
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Fre... | gpl-2.0 |
ctcusc/django-react-boilerplate | server/social_network/serializers.py | 1 | 1741 | """Serializers are our way to interact with Django REST framework.
They allow us to write code that runs to convert our custom models to/from JSON
For more information, see http://www.django-rest-framework.org/tutorial/1-serialization/
"""
from rest_framework import serializers
from .models import Post, Profile
cl... | apache-2.0 |
willcode/gnuradio | gr-filter/python/filter/qa_fft_filter.py | 5 | 17467 | #!/usr/bin/env python
#
# Copyright 2004,2005,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest, filter, blocks
import sys
import random
def make_random_complex_tuple(L):
result = []
f... | gpl-3.0 |
wnt-zhp/hufce | django/utils/tree.py | 103 | 5755 | """
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
import copy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
Node instances.
"""
# S... | gpl-3.0 |
MakMukhi/grpc | src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py | 21 | 21991 | # Copyright 2016, 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... | bsd-3-clause |
OliverEvans96/rte_matrix | factorizations/QR.py | 1 | 1740 | # this script will take an input matrix and solution vector, then solve the system Ax = b
# first, it will compute A = QR for Q unitary and R upper triangular
# next, it will compute inverse(Q)*b which equals R
# finally, R = inv(Q)*B can be solved by back substitution because R is upper triangular
import sys
import t... | gpl-3.0 |
ericdill/bokeh | bokeh/server/websocket/handler.py | 13 | 1712 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2015, Continuum Analytics, 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 |
lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/polys/tests/test_distributedmodules.py | 3 | 7665 | """Tests for sparse distributed modules. """
from sympy.polys.distributedmodules import (
sdm_monomial_mul, sdm_monomial_deg, sdm_monomial_divides,
sdm_add, sdm_LM, sdm_LT, sdm_mul_term, sdm_zero, sdm_deg,
sdm_LC, sdm_from_dict, sdm_to_dict,
sdm_spoly, sdm_ecart, sdm_nf_mora, sdm_groebner,
sdm_from... | gpl-3.0 |
Jorge-Rodriguez/ansible-modules-core | cloud/docker/docker_image_facts.py | 12 | 6894 | #!/usr/bin/python
#
# Copyright 2016 Red Hat | Ansible
#
# 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 la... | gpl-3.0 |
ruguevara/neon | neon/backends/__init__.py | 4 | 7572 | # ----------------------------------------------------------------------------
# Copyright 2014 Nervana Systems 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.o... | apache-2.0 |
miscaandrei/django-testapp | django/contrib/admin/views/main.py | 60 | 16286 | import operator
from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured
from django.core.paginator import InvalidPage
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.utils.datastructures import SortedDict
from django.utils.encoding import force_unicod... | bsd-3-clause |
travisfcollins/gnuradio | gr-atsc/lib/gen_encoder.py | 68 | 1554 | #!/usr/bin/python
#
# Copyright 2002 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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 ... | gpl-3.0 |
axinging/chromium-crosswalk | testing/legion/examples/http_example/http_server.py | 34 | 1060 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import SimpleHTTPServer
import SocketServer
import sys
import threading
import time
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler... | bsd-3-clause |
OpenWIS/openwis | openwis-securityservice/openwis-securityservice-utils/GenerateSPConfFiles/apache-ant-1.8.1/bin/runant.py | 3 | 3294 | #!/usr/bin/python
# 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 "Licen... | gpl-3.0 |
ic-labs/django-icekit | glamkit_collections/contrib/work_creator/plugins/artwork/models.py | 2 | 1766 | from glamkit_collections.contrib.work_creator.models import WorkBase
from django.db import models
class Artwork(WorkBase):
medium_display = models.CharField(
blank=True,
max_length=255,
help_text='A display field for information concerning the '
'material/media & support o... | mit |
pdasigi/neural-semantic-encoders | test_nse.py | 1 | 1058 | from keras.models import Model
from keras.layers import Input, Embedding, LSTM, Lambda
from keras import backend as K
import numpy
from nse import NSE, MultipleMemoryAccessNSE, InputMemoryMerger
input_val1 = numpy.random.randint(low=0, high=10, size=(1000, 10))
input_val2 = numpy.random.randint(low=0, high=10, size=(1... | apache-2.0 |
QijunPan/ansible | lib/ansible/modules/cloud/cloudscale/cloudscale_server.py | 19 | 15304 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2017, Gaudenz Steinlin <gaudenz.steinlin@cloudscale.ch>
#
# 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 ver... | gpl-3.0 |
centwave/jg82ksgvqkuan | django/contrib/auth/views.py | 95 | 10312 | import urlparse
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, QueryDict
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.http import urlsafe_base64_decode
from django.utils.translat... | bsd-3-clause |
blaggacao/odoo | addons/portal_sale/res_config.py | 445 | 1479 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
bensonhsu2013/android_kernel_samsung_lt02wifi | tools/perf/util/setup.py | 4998 | 1330 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... | gpl-2.0 |
saurav111/keras | keras/layers/core.py | 9 | 23338 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division
import theano
import theano.tensor as T
import numpy as np
from .. import activations, initializations, regularizers, constraints
from ..utils.theano_utils import shared_zeros, floatX
from ..utils.generic_utils import make_tuple
from ..regulariz... | mit |
mpw1337/RocketMap | pogom/app.py | 1 | 24596 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import calendar
import logging
from flask import Flask, abort, jsonify, render_template, request,\
make_response
from flask.json import JSONEncoder
from flask_compress import Compress
from datetime import datetime
from s2sphere import LatLng
from pogom.utils import get_ar... | agpl-3.0 |
JingqingZ/ucore_lab | related_info/lab5/process-cpuio-homework.py | 49 | 9708 | #! /usr/bin/env python
import sys
from optparse import OptionParser
import random
# process switch behavior
SCHED_SWITCH_ON_IO = 'SWITCH_ON_IO'
# io finished behavior
IO_RUN_LATER = 'IO_RUN_LATER'
# process states
STATE_RUNNING = 'RUNNING'
STATE_READY = 'READY'
STATE_DONE = 'DONE'
STATE_WAIT = 'WAITING'
# members ... | gpl-2.0 |
brksnn/pyopenweathermap | pyopenweathermap_5days_def.py | 1 | 2671 | #!/usr/bin/env python3
import pyowm
def Multi_Days_Forecasts(LOCATION, LIMIT):
"""Multi-Days Forecasts"""
if isinstance(LOCATION, str) == True and LOCATION.isdigit() == False:
fc = owm.daily_forecast(LOCATION,limit=LIMIT)
elif LOCATION.isdigit() == True:
LOCATION = int(LOCATION)
fc... | gpl-3.0 |
lmazuel/azure-sdk-for-python | azure-mgmt-billing/tests/test_mgmt_billing.py | 1 | 3978 | # 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 |
tensorflow/lucid | lucid/optvis/objectives_util.py | 1 | 1571 |
from __future__ import absolute_import, division, print_function
from decorator import decorator
import numpy as np
import tensorflow as tf
import lucid.misc.graph_analysis.property_inference as property_inference
def _dot(x, y):
return tf.reduce_sum(x * y, -1)
def _dot_cossim(x, y, cossim_pow=0):
eps = 1e-4... | apache-2.0 |
hfp/tensorflow-xsmm | tensorflow/python/saved_model/nested_structure_coder_test.py | 5 | 7679 | # Copyright 2018 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 |
zooba/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/unittest/test/test_case.py | 6 | 72999 | import contextlib
import difflib
import pprint
import pickle
import re
import sys
import logging
import warnings
import weakref
import inspect
from copy import deepcopy
from test import support
import unittest
from unittest.test.support import (
TestEquality, TestHashing, LoggingResult, LegacyLoggingResult,
... | apache-2.0 |
bluecmd/or1k-qemu | tests/qemu-iotests/qed.py | 248 | 7194 | #!/usr/bin/env python
#
# Tool to manipulate QED image files
#
# Copyright (C) 2010 IBM, Corp.
#
# Authors:
# Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
#
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
import sys
import struct
import r... | gpl-2.0 |
patrys/opbeat_python | opbeat/contrib/flask/__init__.py | 2 | 7892 | """
opbeat.contrib.flask
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011-2012 Opbeat
Large portions are
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
import os
import warnings
import flask
from ... | bsd-3-clause |
eino-makitalo/mezzanine | mezzanine/generic/admin.py | 44 | 1450 | from __future__ import unicode_literals
from django.conf import settings
from django.contrib import admin
from django_comments.admin import CommentsAdmin
from django.utils.translation import ugettext_lazy as _
from mezzanine.generic.models import ThreadedComment
__all__ = ('ThreadedCommentAdmin',)
class ThreadedC... | bsd-2-clause |
JukeboxPipeline/jukebox-core | src/jukeboxcore/gui/main.py | 1 | 7746 | """Bundles common gui functions and classes
When creating a standalone app, you can use :func:`jukeboxcore.gui.main.init_gui` to
make sure there is a running QApplication. Usually the launcher will do that for you.
Then use set_main_style to apply the main_stylesheet to your app.
That way all the plugins have a consis... | bsd-3-clause |
manon-cortial/pypot | pypot/kinematics.py | 4 | 6923 | import numpy
from collections import namedtuple
"""
This module can be used to compute the forward and inverse kinematics for a chain of revolute joints.
It has been largerly inspired by the Matlab Robotics Toolbox.
"""
class Link(namedtuple('Link', ('theta', 'd', 'a', 'alpha'))):
""" Link object as defined by... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.