code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
import urllib
import urllib2
import re
import os
import sys
import time
# upload('http://www.mywebsite.com:8080/upload.php', {}, 'file', os.path.join('/home/john/', 'a.txt'))
def upload(http_url, form_params, file_item_name, file_path):
boundary = '-----------------%s' % hex(int(time.time()... | johnlee175/LogcatFileReader | examples/simple_utils.py | Python | apache-2.0 | 6,336 |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2007 Søren Roug, European Environment Agency
#
# This 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 the Free Software Foundation; either
# version 2.1 of the License, or (at you... | pacoqueen/odfpy | odf/presentation.py | Python | gpl-2.0 | 2,752 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'openassessment.assessment.views',
url(
r'^(?P<student_id>[^/]+)/(?P<course_id>[^/]+)/(?P<item_id>[^/]+)$',
'get_evaluations_for_student_item'
),
)
| devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/openassessment/assessment/urls.py | Python | agpl-3.0 | 244 |
import random
import string
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.html import escape
from django.utils.safestring import SafeData, mark_safe
from selectable.base import ModelLookup
from selectable.tests import Thing
__all__ = ... | hzlf/openbroadcast | website/__old_versions/selectable/tests/base.py | Python | gpl-3.0 | 5,805 |
import pytest
import json
import os.path
import importlib
import jsonpickle
from fixture.application import Application
from fixture.db import DbFixture
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__fi... | senin24/python_trainig | conftest.py | Python | apache-2.0 | 2,432 |
## @package hfst.exceptions
## exceptions...
## Base class for HfstExceptions. Holds its own name and the file and line number where it was thrown.
class HfstException:
## A message describing the error in more detail.
def what():
pass
## Two or more HfstTransducers are not of the same type. Same as H... | wikimedia/operations-debs-contenttranslation-hfst | python/doc/hfst/exceptions/__init__.py | Python | gpl-3.0 | 7,967 |
from __future__ import unicode_literals
from .compat import text_type
class Node(object):
def __str__(self):
children = []
for k, v in self.__dict__.items():
if isinstance(v, (list, tuple)):
v = '[%s]' % ', '.join([text_type(v) for v in v if v])
children.ap... | ivelum/djangoql | djangoql/ast.py | Python | mit | 1,694 |
#
# 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... | mistercrunch/airflow | airflow/providers/amazon/aws/hooks/s3.py | Python | apache-2.0 | 34,493 |
#
# Copyright 2017 The E2C 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 applicable l... | elastic-event-components/e2c | source/python/e2c/actor.py | Python | apache-2.0 | 4,201 |
import re
from Message import *
from AnnotationParser import AnnotationParser
from TagsParser import TagsParser
from Name import *
##########################################
class TestCase:
########################################
def __init__(self, name, scope, file, line, annotations):
self.traditional... | aprovy/test-ng-pp | tests/3rdparty/testngppst/scripts/testngppstgen/TestCase.py | Python | lgpl-3.0 | 3,550 |
from django.contrib import admin
from . import models
# Register your models here.
admin.site.register(models.SharedItem)
admin.site.register(models.Album)
admin.site.register(models.Artist)
admin.site.register(models.AudioCodec)
admin.site.register(models.ItemAccessibility)
admin.site.register(models.ItemRating)
adm... | iiitv/legbook-backend | mediavault/web/admin.py | Python | mit | 432 |
import os
import os.path
from collections import Counter
import glob
#import threading
import time
'''
This file is running on server
Which is able to monitor new wifi data sent from individual app
user and then output location(coordinate, calculated by hallway_cod.txt)to the
locotioon folder on the server
'''
cla... | tikael1011/aiflee_python | Server/server_init.py | Python | gpl-3.0 | 1,867 |
"""
Fixer that adds ``from builtins import object`` if there is a line
like this:
class Foo(object):
"""
from lib2to3 import fixer_base
from libfuturize.fixer_util import touch_import_top
class FixObject(fixer_base.BaseFix):
PATTERN = u"classdef< 'class' NAME '(' name='object' ')' colon=':' any >"
def... | hughperkins/kgsgo-dataset-preprocessor | thirdparty/future/src/libfuturize/fixes/fix_object.py | Python | mpl-2.0 | 407 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""This file implements the Kodi xbmc module, either using stubs or alternative functionality"""
# pylint: disable=invalid-name,no-self-use... | pietje666/plugin.video.vrt.nu | tests/xbmc.py | Python | gpl-3.0 | 10,771 |
#!/usr/bin/env python
from __future__ import print_function
import sip
sip.setapi('QString', 1)
import sys
import copy
import configobj
import validate
from PyQt4 import QtGui
from PyQt4 import QtCore
class Option(object):
"""Description and value of an option"""
def __init__(self, name, section, type, args, kwa... | pafcu/ConfigObj-GUI | configobj_gui.py | Python | isc | 26,308 |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... | jasonehines/mycroft-core | mycroft/client/enclosure/__init__.py | Python | gpl-3.0 | 9,809 |
from graphite.thirdparty.pyparsing import *
ParserElement.enablePackrat()
grammar = Forward()
expression = Forward()
# Literals
intNumber = Combine(
Optional('-') + Word(nums)
)('integer')
floatNumber = Combine(
Optional('-') + Word(nums) + Literal('.') + Word(nums)
)('float')
aString = quotedString('string')
... | afilipovich/graphite-web | webapp/graphite/render/grammar.py | Python | apache-2.0 | 1,494 |
"""
NAME: prefixNodesNames_Script
ICON: icon.png
DROP_TYPES:
SCOPE:
Prefix Nodes Names
"""
# The following symbols are added when run as shelf buttons:
# exit(): Allows 'error-free' early exit from the script.
# dropEvent: If your script registers DROP_TYPES, this is a QDropEvent
# upon a valid d... | KelSolaar/Snippets | katana/snippets/resources/shelves/scripts/prefixNodesNames_Script.py | Python | gpl-3.0 | 1,225 |
# Copyright (c) 2014 ProphetStor, 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 req... | dims/cinder | cinder/volume/drivers/prophetstor/dpl_iscsi.py | Python | apache-2.0 | 7,014 |
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Utils exporting data from AFF4 to the rest of the world."""
import os
import Queue
import stat
import time
import logging
from grr.lib import aff4
from grr.lib import client_index
from grr.lib import rdfvalue
from grr.lib import serialize
fr... | statik/grr | lib/export_utils.py | Python | apache-2.0 | 12,651 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import mimetypes
import os
import random
import time
import unittest
from six import StringIO
from mock import patch
from mock import MagicMock as Mock
import pyrax
import pyrax.object_storage
from pyrax.object_storage import ACCOUNT_META_PREFIX
from pyra... | naemono/pyrax | tests/unit/test_object_storage.py | Python | apache-2.0 | 142,805 |
# 271. Encode and Decode String
# Design an algorithm to encode a list of strings to a string.
# The encoded string is then sent over the network
# and is decoded back to the original list of strings.
# Machine 1 (sender) has the function:
# string encode(vector strs) {
# // ... your code
# return encoded_stri... | gengwg/leetcode | 271_encode_decode_string.py | Python | apache-2.0 | 2,688 |
#!/usr/bin/env/python
import datetime
from subprocess import call
while (True):
time = str(datetime.datetime.now())
filename = time.replace(' ', '_') + '.jpg'
call(['raspistill', '-f', '-fp', '-vf', '-k', '-t', '99999', '-o', filename])
# call("raspistill -f -fp -ex auto -awb auto -vf -k -t 99999999 -o... | shingkai/asa_photobooth | tests/raspistillTest.py | Python | gpl-3.0 | 332 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.hash
~~~~~~~~~~~~~~~~~
Provides functions for hashing text.
Note: If the PYTHONHASHSEED environment variable is set to an integer value,
it is used as a fixed seed for generating the hash. Its purpose is to allow
repeatable hashing across python proce... | nerevu/riko | riko/modules/hash.py | Python | mit | 3,926 |
"""Test functionalities of model component pruning functions."""
from itertools import chain
from typing import List, Set, Union
from cobra.core import Gene, Metabolite, Model, Reaction
from cobra.manipulation import (
delete_model_genes,
find_gene_knockout_reactions,
get_compiled_gene_reaction_rules,
... | opencobra/cobrapy | src/cobra/test/test_manipulation/test_delete.py | Python | gpl-2.0 | 8,120 |
"""
CMSIS-DAP Interface Firmware
Copyright (c) 2009-2013 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 la... | flyhung/CMSIS-DAP | tools/get_binary.py | Python | apache-2.0 | 1,166 |
'''
if __name__ == '__main__':
import multiprocessing
multiprocessing.freeze_support()
from hsviz import draw_func2 as df2
np.random.seed(seed=0) # RANDOM SEED (for reproducibility)
is_whiten = helpers.get_flag('--whiten')
dim = helpers.get_arg('--dim', type_=int, default=3)
K = helpers.get... | SU-ECE-17-7/hotspotter | hstest/test_algos.py | Python | apache-2.0 | 1,296 |
import gtk
from dnd.drag import DragTarget
from dnd.drop import DropTarget
#TODO build a GenericDragProvider and a TreeDragProvider
class DragProvider(object):
"""
A DragProvider handles complicated Drag&Drop interactions with multiple sources
and targets.
"""
inspector = None
SOURCE_ACTIONS =... | carloscanova/python-odml | odml/gui/DragProvider.py | Python | bsd-3-clause | 11,021 |
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
"""
Very basic 2D abstract geometry package. It defines these geometrical
constructs:
* `GeometricObject` - abstract base class, not meant to be used
directly
* `Point`
* `Vector`
* `BoundingBox`
* `Line`
* `Ray`
* `Segment`
* `Polygon... | FGCSchool-Math-Club/fgcs-math-club-2014 | Geo2D-0.1.22/build/lib.linux-x86_64-2.7/geo2d/geometry.py | Python | bsd-2-clause | 62,543 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def delete_orphan_collaborations(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
Collaboration = apps.get_model('structuredcollaboration', 'Collaboration')
ContentType = apps.get_model('... | c0cky/mediathread | mediathread/projects/migrations/0014_auto_20151104_1513.py | Python | gpl-2.0 | 1,149 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
# Credits#######################################... | 3dfxsoftware/cbss-addons | account_move_nonzero/account_move_line.py | Python | gpl-2.0 | 1,858 |
import os
import boto3
from chalice import Chalice
from chalicelib import db
from chalicelib import rekognition
app = Chalice(app_name='media-query')
_MEDIA_DB = None
_REKOGNITION_CLIENT = None
_SUPPORTED_IMAGE_EXTENSIONS = (
'.jpg',
'.png',
)
def get_media_db():
global _MEDIA_DB
if _MEDIA_DB is No... | aws-samples/chalice-workshop | code/media-query/06-web-api/app.py | Python | apache-2.0 | 1,443 |
# -*- 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 = 'd F Y'
TIME_FORMAT = 'H:i:s'
DATE... | edisonlz/fruit | web_project/base/site-packages/django/conf/locale/mk/formats.py | Python | apache-2.0 | 1,758 |
#!/usr/bin/python
# vim: set fileencoding=utf-8:
###########################################
#
# 目录测试(探测敏感目录是否存在)
# 1) 容错测试
# 2) 服务器指纹识别
# 3) 404重定向识别
# 4) 获得响应头
#
###########################################
import hashlib
import random
from httplib2 import Http
class Directory_testing:
def __init__(self,ta... | 0xwindows/w3a_Scan_Console | module/directory-test_module.py | Python | gpl-2.0 | 1,776 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013, 2014, 2016, 2017, 2018 Guenter Bartsch
#
# 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/licens... | gooofy/py-nltools | nltools/pulserecorder.py | Python | apache-2.0 | 18,079 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from math import ceil
import unittest
from hwt.hdl.types.bits import Bits
from hwt.hdl.types.struct import HStruct
from hwt.simulator.simTestCase import SimTestCase
from hwtHls.platform.virtual import VirtualHlsPlatform
from hwtLib.amba.axis import axis_send_bytes
from p... | Nic30/hwtHls | tests/io/axiStream/axisParseIf_test.py | Python | mit | 3,663 |
import shutil
from pprint import pprint
import pandas as pd
import csv
import pickle
import inspect, os
import requests
from os import listdir
import numpy as np
import subprocess
from luigi import six
from sklearn.decomposition import NMF
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
fro... | felipegerard/arte_mexicano_antiguo | montactuaria/Analisis_access_log/luigi/ functions/functions.py | Python | agpl-3.0 | 362 |
# -*- coding: utf-8 -*-
"""
hog
~~~
Sending multiple HTTP requests ON GREEN thread.
:copyright: (c) 2014-2019 by Park Hyunwoo.
:license: MIT, see LICENSE for more details.
"""
from six import itervalues, iteritems
from six.moves import xrange
import eventlet
eventlet.monkey_patch()
import click
import re
import r... | lqez/hog | hog/hog.py | Python | mit | 6,591 |
try:
import facebook # noqa F401
except ImportError:
from PokeAlarm.Utils import pip_install
pip_install('facebook-sdk', '2.0.0')
from FacebookPageAlarm import FacebookPageAlarm # noqa 401
| neskk/PokeAlarm | PokeAlarm/Alarms/FacebookPage/__init__.py | Python | agpl-3.0 | 205 |
# -*- coding: utf-8 -*-
import json
import mimetypes
import os
from datetime import datetime
from django import forms
from django.conf import settings
from django.core.validators import URLValidator
from django.forms import widgets
from django.forms.extras.widgets import SelectDateWidget
from django.forms.models impor... | elysium001/zamboni | mkt/developers/forms.py | Python | bsd-3-clause | 51,617 |
#----------------------------------------------------------------------------#
# Imports
#----------------------------------------------------------------------------#
import json
import dateutil.parser
from datetime import *
import babel
from flask import Flask, render_template, request, Response, flash, redirect, ur... | manishbisht/Udacity | Full Stack Web Developer Nanodegree v2/P1 - Fyyur Artist Booking Site/app.py | Python | mit | 19,320 |
#-*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 One Click Software (http://oneclick.solutions)
# and Copyright (C) 2011,2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program is free software: y... | cartertech/odoo-hr-ng | hr_view_employee_by_department/__openerp__.py | Python | agpl-3.0 | 1,653 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-16 18:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('neighborhood', '0003_auto_20160916_1759'),
]
operations = [
migrations.AlterF... | josephkane/neighborhood | nh_rest/neighborhood/migrations/0004_auto_20160916_1800.py | Python | mit | 452 |
# 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, software
# distributed under t... | briancurtin/python-openstacksdk | openstack/tests/functional/telemetry/alarm/v2/test_alarm.py | Python | apache-2.0 | 1,941 |
# -*- coding: utf-8 -*-
# Derived work from Facebook's tornado server.
"""TCPServer using non-blocking evented polling loop."""
import os, socket, errno, stat
import ssl # Python 2.6+
from pluggdapps.evserver import process
from pluggdapps.evserver.httpioloop import HTTPIOLoop
from pluggdapps.evserver.httpio... | prataprc/pluggdapps | pluggdapps/.Attic/evserver/tcpserver.py | Python | gpl-3.0 | 9,575 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Sales Expense',
'version': '1.0',
'category': 'Sales/Sales',
'summary': 'Quotation, Sales Orders, Delivery & Invoicing Control',
'description': """
Reinvoice Employee Expense
==============... | ygol/odoo | addons/sale_expense/__manifest__.py | Python | agpl-3.0 | 814 |
import warnings
from rope.base import exceptions, pyobjects, pynames, taskhandle, evaluate, worder, codeanalyze
from rope.base.change import ChangeSet, ChangeContents, MoveResource
from rope.refactor import occurrences, sourceutils
class Rename(object):
"""A class for performing rename refactoring
It can re... | JetChars/vim | vim/bundle/python-mode/pymode/libs3/rope/refactor/rename.py | Python | apache-2.0 | 9,365 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | aldian/tensorflow | tensorflow/python/training/saving/functional_saver.py | Python | apache-2.0 | 13,910 |
#!/usr/bin/env python
# Copyright (c) 2011-2018, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
"""
Read RADOLAN and DX
^^^^^^^^^^^^^^^^^^^
Reading DX and RADOLAN data from German Weather Service
.. autosummary::
:nosignatures:
:toctree: generated/
read_dx
rea... | kmuehlbauer/wradlib | wradlib/io/radolan.py | Python | mit | 23,177 |
################################################################################
#
# This program is part of the DellMon Zenpack for Zenoss.
# Copyright (C) 2009, 2010 Egor Puzanov.
#
# This program can be used under the GNU General Public License version 2
# You can find full information here: http://www.zenoss.com/os... | zenoss/Community-Zenpacks | ZenPacks.community.DellMon/ZenPacks/community/DellMon/modeler/plugins/community/snmp/DellExpansionCardMap.py | Python | gpl-2.0 | 5,452 |
import media
import fresh_tomatoes
# Instantiate a media.Movie object for each movie
# Declare title, storyline, poster image, and trailer url for each movie
super_troopers = media.Movie("Super Troopers",
"Five Vermont state troopers, avid pranksters"
... | realomgitsdave/movietrailersite | entertainment_center.py | Python | mit | 4,165 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | ueshin/apache-spark | python/pyspark/pandas/tests/test_window.py | Python | apache-2.0 | 13,671 |
import wakefs.config
from tests.utils import rand_len_str
import os
import random
import unittest
class TestConfigFileCreate(unittest.TestCase):
def test_file_create(self):
testfile = "test.cfg"
with wakefs.config.Config(testfile) as config:
pass
self.assertTrue(os.path.exists(t... | authmillenon/wakefs | tests/config.py | Python | mit | 1,222 |
from setuptools import setup
from os import path
BASE_PATH = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(BASE_PATH, 'README.rst'), 'r') as f:
long_description = f.read()
setup(
name='python-jumprunpro',
version='0.0.2',
author='Nate Mara',
author_em... | natemara/jumprunpro-python | setup.py | Python | mit | 1,076 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Escrito por Daniel Fuentes B.
# Modificado por Kenny Meyer
# Licencia: X11/MIT license http://www.opensource.org/licenses/mit-license.php
# ---------------------------
# Importacion de los módulos
# ---------------------------
import pygame
from pygame.locals import *
... | kennym/fsa2011 | parte_1/ejemplo1.py | Python | mit | 849 |
import vtk
from vtk.util import vtkAlgorithm as vta
from vtk.test import Testing
class TestPythonAlgorithm(Testing.vtkTest):
def testSource(self):
class MyAlgorithm(vta.VTKAlgorithm):
def __init__(self):
vta.VTKAlgorithm.__init__(self, nInputPorts=0, outputType='vtkImageData')
... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Filters/Python/Testing/Python/TestPythonAlgorithm.py | Python | gpl-3.0 | 4,659 |
# -*- coding: utf-8 -*-
# © 2016 Comunitea - Kiko Sanchez <kiko@comunitea.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import account
from . import res_partner_bank
| Comunitea/CMNT_00098_2017_JIM_addons | jim_account/models/__init__.py | Python | agpl-3.0 | 198 |
# -*- coding: utf-8 -*-
"""
AONX Server - Pequeño servidor de Argentum Online.
Copyright (C) 2011 Alejandro Santos <alejolp@alejolp.com.ar>
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 Fo... | alejolp/argentum-py-server | argentumserver/corevars.py | Python | gpl-3.0 | 1,040 |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext_lazy as _
from facebook import display_album
from models import FacebookGallery
class FacebookGalleryPlugin(CMSPluginBase):
model = FacebookGallery
name = _("Facebook Album Gallery"... | justinasjaronis/cmsplugin-fbgallery | cmsplugin_fbgallery/cms_plugins.py | Python | mit | 652 |
# Copyright (c) 2014 OpenStack Foundation
#
# 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 ... | openstack/swift | test/unit/common/middleware/s3api/test_cfg.py | Python | apache-2.0 | 1,196 |
from .. import Provider as PersonProvider
class Provider(PersonProvider):
formats_male = (
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}... | joke2k/faker | faker/providers/person/de_AT/__init__.py | Python | mit | 29,783 |
from peewee import BooleanField
from wtforms import widgets
from wtfpeewee.fields import BooleanSelectField
from wtfpeewee.fields import ModelSelectField
from wtfpeewee.orm import ModelConverter
class BaseModelConverter(ModelConverter):
def __init__(self, *args, **kwargs):
super(BaseModelConverter, self)... | coleifer/flask-peewee | flask_peewee/forms.py | Python | mit | 1,407 |
#!/usr/bin/python
import numpy as np
import pandas as pd
from glob import glob
from cluster_analysis import cluster
import matplotlib.pyplot as plt
def cluster_traj(first_frame=-20):
# create a list of all the clusters filename
complete_traj = glob("cluster.*.out.gz")
# sort the list
complete_traj.sor... | EtiCui/Msc-UdeS | dataAnalysis/cluster_traj.py | Python | mit | 2,038 |
from js_process_ast import *
def type_logger(node, typespace):
def arg_log():
n = js_parse("""
var _args = "";
for (var i=0; i<arguments.length; i++) {
if (i > 0)
_args += ","
if (typeof arguments[i] == "object")
_args += arguments[i].constructor.name;
else... | joeedh/webblender | tools/extjs_cc/js_profile.py | Python | apache-2.0 | 1,338 |
import matplotlib
matplotlib.rc('text', usetex = True)
import pylab
import Numeric
## interface tracking profiles
N = 500
delta = 0.6
X = -1 + 2. * Numeric.arange(N) / (N - 1)
pylab.plot(X, (1 - Numeric.tanh(4. * X / delta)) / 2, ## phase field tanh profiles
X, (X + 1) / 2, ## ... | sniemi/SamPy | sandbox/src1/examples/dannys_example.py | Python | bsd-2-clause | 2,666 |
import copy
import os
from visitor import *
from stringstream import *
class Rewriter(NodeVisitor):
""" Class for rewriting of the original AST. Includes:
1. the initial small rewritings,
2. transformation into our representation,
3. transforming from our representation to C-executable code,
4. cre... | dikujepsen/OpenTran | v2.0/framework/old/rewriter.py | Python | mit | 39,575 |
#!/usr/bin/env python
#
# Author: Ying Xiong.
# Created: Mar 18, 2014.
import numpy as np
import unittest
from quaternion import *
from unittest_utils import *
class QuaternionTest(unittest.TestCase):
"""Unit test for Quaternion."""
def testQuadHProd(self):
o = np.array([1, 0, 0, 0])
i = np.a... | yxiong/xy_python_utils | xy_python_utils/quaternion_test.py | Python | mit | 2,857 |
import random
import docker
from docker.utils import create_ipam_config
from docker.utils import create_ipam_pool
import pytest
from ..helpers import requires_api_version
from .base import BaseIntegrationTest
class TestNetworks(BaseIntegrationTest):
def create_network(self, *args, **kwargs):
net_name = ... | shakamunyi/docker-py | tests/integration/network_test.py | Python | apache-2.0 | 16,098 |
# -*- coding: utf-8 -*-
"""The check functions."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import operator
from distutils.version import LooseVersion
import os.path as op
import numpy as np
from ._logging import warn, logger
def _ensure_int(x, name='unknown', must_b... | adykstra/mne-python | mne/utils/check.py | Python | bsd-3-clause | 18,200 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# NAT function test configration of NSX & vSphere environment.
# Static NAT: 仅用address来映射,不用port来映射
# NSX Edge ID, 可在web client-> NSX Edges界面找到
NSX_EDGE_ID = 'edge-9'
# 要删除的floatingIP所对应的nat ruleID
NSX_NAT_RULE_ID = '196613' | smartlinux/nsxapitest | nat/case48_nsx_static_nat_delete_input.py | Python | gpl-3.0 | 320 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urllib_parse_urlparse
from ..utils import (
ExtractorError,
parse_iso8601,
qualities,
)
class SRGSSRIE(InfoExtractor):
_VALID_URL = r'(?:https?://tp\.srgssr\.ch/p(?:/[^/]+)+\?urn=urn|s... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/srgssr.py | Python | gpl-3.0 | 6,280 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import time, posix, daily
data = daily.load("ottawa")
class FloatValue():
__slots__ = ()
def __init__(self, field):
self.fieldIndex = field.index
def __call__(self, fields):
r = fields[self.fieldIndex]
... | endlisnis/weather-records | maxtemp.py | Python | gpl-3.0 | 3,298 |
from Screens.Screen import Screen
from Components.GUIComponent import GUIComponent
from Components.VariableText import VariableText
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.Button import Button
from Components.FileList import FileList
from Components.ScrollLabel imp... | popazerty/enigma2 | lib/python/Screens/LogManager.py | Python | gpl-2.0 | 19,571 |
""" Testing arrays module
"""
from __future__ import absolute_import
import numpy as np
from ..arrays import strides_from
from nipy.externals.six import binary_type, text_type
from numpy.testing import (assert_array_almost_equal,
assert_array_equal)
from nose.tools import assert_true, as... | alexis-roche/nipy | nipy/utils/tests/test_arrays.py | Python | bsd-3-clause | 1,157 |
# -*- coding: utf-8 -*-
# @Author: Marco Benzi <marco.benzi@alumnos.usm.cl>
# @Date: 2015-06-07 19:44:12
# @Last Modified 2015-06-09
# @Last Modified time: 2015-06-09 16:07:05
# ==========================================================================
# This program is free software: you can redistribute it and/or... | Lisergishnu/LTXKit | uStripDesign.py | Python | gpl-2.0 | 5,581 |
###############################################################################
##
## Copyright (C) 2014-2015, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | hjanime/VisTrails | vistrails/packages/dialogs/__init__.py | Python | bsd-3-clause | 2,480 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-28 08:32
from __future__ import unicode_literals
from django.db import migrations, models
int_to_name = {1: 'digital',
2: 'children-cartoons',
3: 'children-novels',
10: 'children-poetry',
11: '... | ideascube/ideascube | ideascube/library/migrations/0010_section_type.py | Python | agpl-3.0 | 2,441 |
"""Utilities for with-statement contexts. See PEP 343."""
import sys
from collections import deque
from functools import wraps
__all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack"]
class ContextDecorator(object):
"A base class or mixin that enables context managers to work as decorators."
... | amrdraz/brython | www/src/Lib/contextlib.py | Python | bsd-3-clause | 8,788 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# from __future__ import unicode_literals
def concatenate(alignments, padding_length=0, partitions=None):
'''
Concatenate alignments based on the Seq ids; row order does not
matter. If one alignment contains a Seq id that another one does
... | karolisr/krpy | krpy/kralign.py | Python | gpl-3.0 | 27,802 |
# -*- coding: utf-8 -*-
# 商户的爬虫
import sys
import re
import scrapy
import itertools
import MySQLdb
from dianping.items import MerchantItem
from dianping.Util import getXpathFirst
from dianping.pipelines import DB_ADDR, DB_PORT, DB_PASSWORD
city = '3'
cate = '10'
BASE_URL = 'http://www.dianping.com/search/category/{ci... | myhearter/dianping | crawler/dianping/spiders/merchants.py | Python | mit | 3,531 |
# -*- coding: utf-8 -*-
import os
import settings
import json
from kivy.app import App
from kivy.properties import (StringProperty, BooleanProperty,
ObjectProperty, NumericProperty)
from kivy.uix.button import Button
from kivy.uix.togglebutton import ToggleButton
from kivy.uix.label import... | RedXBeard/gitwatcher-ui | buttons.py | Python | mit | 34,985 |
# Add the upper directory (where the nodebox module is) to the search path.
import os, sys; sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics import *
# This example demonstrates motion tweening and prototype-based inheritance on layers.
# Motion tweening is easy: set the Layer.duration parameter to ... | nodebox/nodebox-opengl | examples/09-layer/03-tween.py | Python | bsd-3-clause | 1,822 |
from rest_framework import viewsets
from rest_framework_extensions.mixins import DetailSerializerMixin
from .models import Comment
from .serializers import CommentSerializer, CommentDetailSerializer
class CommentViewSet(DetailSerializerMixin, viewsets.ReadOnlyModelViewSet):
serializer_class = CommentSerializer
... | chibisov/drf-extensions | tests_app/tests/functional/mixins/detail_serializer_mixin/views.py | Python | mit | 1,569 |
#!/usr/bin/env python
import os, sys, codecs
if __name__ == "__main__":
jamjar_env = os.environ.get('JAMJAR_ENV', None)
if jamjar_env in ['prod', 'dev', 'test']:
settings_module = "jamjar.settings.{}".format(jamjar_env)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module)
else:... | projectjamjar/masonjar | jamjar/manage.py | Python | mit | 523 |
"""Implementation of the encoder of the Transformer model.
Described in Vaswani et al. (2017), arxiv.org/abs/1706.03762
"""
# pylint: disable=unused-import
from typing import Set, Optional, List
# pylint: enable=unused-import
import math
import tensorflow as tf
from typeguard import check_argument_types
from neuralm... | juliakreutzer/bandit-neuralmonkey | neuralmonkey/encoders/transformer.py | Python | bsd-3-clause | 12,957 |
import datetime
import numbers
import string
from django.contrib.auth import models as django_models
from canvas.cache_patterns import CachedCall
from configuration import Config
from services import Services
class _BaseUserMixin(object):
MINIMUM_PASSWORD_LENGTH = 5
MAXIMUM_PASSWORD_LENGTH = 2000
def _... | drawquest/drawquest-web | website/apps/canvas_auth/models.py | Python | bsd-3-clause | 8,572 |
# -*- coding: UTF-8 -*-
"""
Functions to use for decorator construction
"""
from __future__ import absolute_import, unicode_literals
__all__ = ("intercept", "log_call")
from inspect import getmodule
from logging import getLogger
from six import raise_from
from sys import version_info
from .constants import LOG_C... | mplanchard/pydecor | src/pydecor/functions.py | Python | mit | 3,535 |
import time
import json
import random
from flask import Flask, request, current_app
from functools import wraps
from cloudbrain.utils.metadata_info import map_metric_name_to_num_channels, get_supported_devices
from cloudbrain.settings import WEBSERVER_PORT
_MOCK_ENABLED = True
app = Flask(__name__)
app.config['PROPA... | realitygaps/cloudbrain | cloudbrain/datastore/rest_api_server.py | Python | agpl-3.0 | 3,932 |
#-*- coding: utf-8 -*-
from models import *
from django.http import HttpResponse
from django.views.decorators.http import require_http_methods
from django.views.decorators.csrf import csrf_exempt
from decorators import jsonResp
import os.path
import json
from prettyprint import pp
from libs.resturl import uriProcessi... | qinggeng/ceShiGuanLiXiTong | site/ceShiGuanLiSite/apps/testManage/apiViews.py | Python | mit | 4,956 |
'''
Created on 23/02/2015
@author: Alex Montes Barrios
'''
import Tkinter as tk
import tkFont
import re
import Queue
import keyword
def rgbColor(red, green, blue):
return '#%02X%02X%02X'%(red, green, blue)
PYTHONSINTAX = [
['pythonNumber', dict(foreground = 'IndianRed'), r'(\d+[.]*)+',re.MULTI... | pybquillast/xkAddonIDE | SintaxEditor.py | Python | gpl-3.0 | 14,093 |
#!/usr/bin/python
# Import PySide classes
import sys
from PySide.QtGui import *
# Create a Qt application
app = QApplication(sys.argv)
# Create a Button and show it
button = QPushButton("Hello World")
button.show()
# Enter Qt application main loop
sys.exit(app.exec_())
| madoodia/codeLab | pyside/first_Pyside.py | Python | mit | 272 |
"""
raven.conf.defaults
~~~~~~~~~~~~~~~~~~~
Represents the default values for all Sentry settings.
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
import os.path
import socket
ROOT = os.path.normpath(os.path.join(os.path.dirname(__fil... | drayanaindra/inasafe | third_party/raven/conf/defaults.py | Python | gpl-3.0 | 1,778 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='gitplot',
version='0.1.0',
description='git repo graphical plotter',
long_description=readme,
author='Robert Cro... | rcronk/gitplot | setup.py | Python | gpl-3.0 | 485 |
import webapp2
from google.appengine.api import taskqueue
from util import (datetime_now, parse_timestamp, domain_from_url,
datetuple_to_string)
from cleaner import get_feeditem_model
from models import (FeedModel, FeedItemModel,
FeedModelKey, FeedItemKey)
from storage import (get... | taimur97/Feeder | server/appengine/tasks.py | Python | gpl-2.0 | 4,156 |
from location import build_location
def test_build_location_simple():
# test
Location = build_location()
location = Location("Canada", "Charlottetown")
assert location.country == "Canada"
assert location.city == "Charlottetown"
| codetojoy/gists | python/module_jun_2020/eg_2/tests/test_location.py | Python | apache-2.0 | 253 |
import os
import socket
import logging
import commands
from consts import CHUNKSIZE, CUTOCS_READ, CSTOCU_READ_DATA, CSTOCU_READ_STATUS
from utils import uint64, pack, unpack
logger = logging.getLogger(__name__)
mfsdirs = []
def _scan():
cmd = """ps -eo cmd| grep mfschunkserver | grep -v grep |
head -1 | cut ... | fe11x/dpark | dpark/moosefs/cs.py | Python | bsd-3-clause | 4,952 |
from os import environ as env
import json
import sys
sys.path.append('k5lib')
import k5lib
# Create a log file
k5lib.create_logfile('list_ports.log')
username = env['OS_USERNAME']
password = env['OS_PASSWORD']
domain = env['OS_USER_DOMAIN_NAME']
projectName = env['OS_PROJECT_NAME']
region = env['OS_REGION_NAME']
pr... | k5ninjacom/K5lib | examples/list_ports.py | Python | gpl-3.0 | 488 |
from django.contrib import admin
from django.contrib.admin import SimpleListFilter
from django.utils.translation import ugettext_lazy as _
from services.models import Service, ServiceType, Alias
# See
# <http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter>
# for documen... | joneskoo/sikteeri | services/admin.py | Python | mit | 1,213 |
import datetime
import sys
import subprocess
import argparse
import calc_time
months = ["Unknown",
"January",
"Febuary",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
... | intermediate-hacker/tprod | add_entry.py | Python | gpl-3.0 | 2,851 |
#
# 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... | nathanielvarona/airflow | tests/providers/google/cloud/transfers/test_gcs_to_bigquery.py | Python | apache-2.0 | 8,245 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.