code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
(r'^kipa/', include('tupa.urls')),
(r'^admin/', include(admin.site.urls)),
)
if settings.DEBUG :
urlpatterns += patterns('',
... | siimeon/Kipa | web/urls.py | Python | gpl-3.0 | 485 |
# 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.
#
# This program is distributed in the hope that it will be useful,
# bu... | glastopf/conpot | conpot/protocols/kamstrup/management_protocol/kamstrup_management_server.py | Python | gpl-2.0 | 3,690 |
from typing import Optional
from enums import Color, Value
class Hint:
def __init__(self, *,
fitness: int=0,
to: int=-1,
color: Optional[Color]=None,
value: Optional[Value]=None) -> None:
self.fitness: int = fitness
self.to: int ... | MeGotsThis/Hanabi-AI | dev/hint.py | Python | gpl-3.0 | 1,706 |
from multilingual.languages import get_language_code_list, get_default_language_code
def multilingual(request):
"""
Returns context variables containing information about available languages.
"""
return {'LANGUAGE_CODES': get_language_code_list(),
'DEFAULT_LANGUAGE_CODE': get_default_langua... | fabiocorneti/django-multilingual | multilingual/context_processors.py | Python | mit | 331 |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Module for testing constant regex expressions."""
import re
from lib.constants import regex
def test_url_to_widget_info_regex():
"""Test regex for parsing the source object name, source object id,
... | AleksNeStu/ggrc-core | test/unit/test_selenium/test_constants_regex.py | Python | apache-2.0 | 2,618 |
from accelerator.managers.member_profile_manager import MemberProfileManager
from accelerator.models import CoreProfile
class MemberProfile(CoreProfile):
user_type = 'member'
default_page = "member_homepage"
objects = MemberProfileManager()
class Meta:
db_table = 'accelerator_memberprofile'
| masschallenge/django-accelerator | accelerator/models/member_profile.py | Python | mit | 320 |
#pylint: disable=C0111
from time import sleep
from lettuce import world, step
from lettuce.django import django_url
from common import i_am_registered_for_the_course, section_location
@step('I view the word cloud and it has rendered')
def word_cloud_is_rendered(_step):
assert world.is_css_present('.word_cloud')... | TsinghuaX/edx-platform | lms/djangoapps/courseware/features/word_cloud.py | Python | agpl-3.0 | 1,926 |
# -*- coding: utf-8 -*-
"""
The class hierachy for exceptions is::
Error
+-- VersionMismatch
+-- EncoderError
| +-- EncoderMissingError
| +-- EncodingError
| +-- DecodingError
+-- CommunicationError
+-- ProtocolError
+-- StatusError
+-- ErrorResp... | ipfs/python-ipfs-api | ipfsapi/exceptions.py | Python | mit | 3,360 |
#!/usr/bin/env python
#
# pyFlow - a lightweight parallel task engine
#
# Copyright (c) 2012-2015 Illumina, 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:
#
# 1. Redistributions of source ... | Illumina/HapMix | pyflow/demo/runOptionsDemo/runOptionsDemo.py | Python | gpl-3.0 | 3,587 |
__author__ = 'Alby Chaj and Alex Frank'
import numpy as np
import datetime as dt
import time
def calc_cma(filename, size):
"""
This function calculates the centered moving average (CMA) of the norm values
for the image data set's top and bottom amplifiers
Parameters
filename (str) -- name of ... | acic2015/findr | deprecated/calc_cma.py | Python | mit | 6,071 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, print_function
import frappe
import unittest, json, sys, os
import xmlrunner
import importlib
from frappe.modules import load_doctype_module, get_module_name
from frappe.utils i... | paurosello/frappe | frappe/test_runner.py | Python | mit | 10,807 |
# Copyright (C) 2007-2015 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 you... | khushboo9293/mailman | src/mailman/model/pending.py | Python | gpl-3.0 | 6,349 |
#
# $Id$
#
# Log file handling
#
import time, wleconfig
_first = 1
def logfile ():
return wleconfig.config.get ('DEFAULT', 'logfile')
def loglevel ():
return wleconfig.config.getint ('DEFAULT', 'loglevel')
def log (n, str):
global _first
if n <= loglevel():
fd = open (logfile(), 'a')
... | samueltardieu/wle | wlelog.py | Python | gpl-2.0 | 463 |
# -*- coding: utf-8 -*-
#
# gensim documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 17 13:42:21 2010.
#
# 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.
#
# All ... | RaRe-Technologies/gensim | docs/src/conf.py | Python | lgpl-2.1 | 9,336 |
import os
import re
from setuptools import setup, find_packages
THIS_DIR = os.path.dirname(os.path.realpath(__name__))
def read(*parts):
with open(os.path.join(THIS_DIR, *parts)) as f:
return f.read()
def get_version():
return re.findall("__version__ = '([\d\.]+)'",
read('mar... | cstipkovic/spidermonkey-research | testing/marionette/harness/setup.py | Python | mpl-2.0 | 1,214 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-07 08:20
from __future__ import unicode_literals
import ckeditor.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('goods', '0011_order_uuid'),
]
... | Beomi/irkshop | goods/migrations/0012_auto_20170907_1720.py | Python | apache-2.0 | 2,556 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
FilterData.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
****************************... | slarosa/QGIS | python/plugins/sextante/lidar/fusion/FilterData.py | Python | gpl-2.0 | 3,077 |
import sys
filename = sys.argv[1]
file = open(filename, 'r')
content = file.read()
h = []
for i in range(0, 10):
h.append(0)
for i in range(0, len(content)):
try:
h[int(content[i])] += 1
except Exception:
continue
for i in range(0, 10):
print("h_" + str(i) + ": " + str(h[i]))
res = ... | mathiasquintero/RandomStuff | Python/DWT/CountPi.py | Python | mit | 458 |
'''
Copyright (c) 2011-2014, Agora Games, LLC All rights reserved.
https://github.com/agoragames/haigha/blob/master/LICENSE.txt
'''
from haigha.channel import Channel
from haigha.frames.frame import Frame
from haigha.frames.heartbeat_frame import HeartbeatFrame
from haigha.frames.method_frame import MethodFrame
from ... | TeamODrKnow/doctor-know | haigha/connection.py | Python | mit | 24,914 |
#
# 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... | openstack/heat | heat/tests/openstack/sahara/test_image.py | Python | apache-2.0 | 4,374 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free ... | ylatuya/Flumotion | flumotion/component/converters/overlay/overlay.py | Python | gpl-2.0 | 6,140 |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""Service architecture for Twisted
Services are arranged in a hierarchy. At the leafs of the hierarchy,
the services which actually interact with the outside world are started.
Services can be named or anonymous -- usually, they will... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/twisted/application/service.py | Python | bsd-3-clause | 10,041 |
# -*- coding: utf-8 -*-
#------------------------------------------------
# @brief Tests for report_dumper class
# @author Andrew Simine
# @copyright Copyrighted by Andrew Simine
#
#------------------------------------------------
import unittest
import datetime
import json
import os
from common.excepti... | dukvolen/cstat | components/data_receiver/tests/report_dumper_tests.py | Python | gpl-3.0 | 5,698 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2014 deanishe@deanishe.net
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-10-18
#
"""Update cache of all apps on system that can handle mailto: URIs."""
from __future__ import print_function, unicode_literals, absolute_import
imp... | deanishe/alfred-mailto | src/update_apps.py | Python | mit | 2,193 |
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=255, default='Robot')
age = models.IntegerField()
class Meta:
app_label = 'test_djangoitem'
class IdentifiedPerson(models.Model):
identifier = models.PositiveIntegerField(primary_key=True)
name = ... | elkingtowa/pyrake | tests/test_djangoitem/models.py | Python | mit | 440 |
import numpy as np
import matplotlib.pyplot as plot
import time
import instrument
""" Capture data from a DSO1002A oscilloscope and plot it"""
def performMeasurement():
# start running
scope.write(":SINGLE")
while(True):
scope.write("*OPC?")
ans = scope.read(100).strip()
# print "\n\n *OPC? :" ,... | dboonz/DSO1002A | src/acquireDataFromOscilloscope.py | Python | mit | 3,454 |
"""
Mixins classes being used by all test classes within this folder
"""
from datetime import datetime
from pytz import UTC
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory
from lms.djangoapps.program_... | eduNEXT/edunext-platform | lms/djangoapps/grades/rest_api/v1/tests/mixins.py | Python | agpl-3.0 | 6,035 |
"""Two different implementations of merge sort. First one is the standard sort
that creates the result to new list on each level. Second one is an in-place
sort that uses two alternating buffers and offsets to limit memory usage
to O(2n).
"""
def sort(lst):
"""Standard merge sort.
Args:
lst: List to ... | niemmi/algolib | algolib/sort/merge_sort.py | Python | bsd-3-clause | 2,137 |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | foursquare/commons-old | tests/python/twitter/common/metrics/test_metrics.py | Python | apache-2.0 | 2,672 |
import re
def to_camel_case(text):
words = re.split(r'[-_]', text)
return words[0] + ''.join(s.capitalize() for s in words[1:])
| VladKha/CodeWars | 5 kyu/Convert string to camel case/solve.py | Python | gpl-3.0 | 138 |
# -*- coding: utf-8 -*-
from distutils.core import setup
import os
import shutil
# collect the client files
static_files = []
for root, dirs, files in os.walk('backend/stromxweb/static', ):
relative_root = os.path.relpath(root, 'backend/stromxweb')
paths = [os.path.join(relative_root, f) for f in files]
s... | uboot/stromx-web | setup.py | Python | apache-2.0 | 1,302 |
class Solution:
# @param matrix, a list of lists of integers
# @return a list of lists of integers
def rotate(self, matrix):
n = len(matrix)
if n == 1:
return matrix
for i in xrange(n):
for j in xrange(n-i):
matrix[i][j], matrix[n-j-1]... | linyaoli/acm | others/intermediate/rotate_image.py | Python | gpl-2.0 | 662 |
from setuptools import setup, find_packages
setup(
name = "whtmacro",
version = "0.3.1",
keywords = "documention",
description = "help create document use HTML template",
license = "GPLv2",
author = "Fiathux Su",
author_email = "fiathux@gmail.com",
url = ... | fiathux/whtmacro | setup.py | Python | gpl-2.0 | 561 |
"""
tensorflow里面给出了一个函数用来读取图像,不过得到的结果是最原始的图像,
是没有经过解码的图像,这个函数为tf.gfile.FastGFile(‘path’, ‘r’).read()。
如果要显示读入的图像,那就需要经过解码过程,tensorflow里面提供解码的函数有两个,
tf.image.decode_jepg和tf.image.decode_png分别用于解码jpg格式和png格式的图像进行解码,得到图像的像素值,这个像素值可以用于显示图像。
如果没有解码,读取的图像是一个字符串,没法显示。
"""
# read方法
import matplotlib.pyplot as plt
import tensor... | Asurada2015/TFAPI_translation | Images_ops/Gfile/tf_gfile_FastGFile.py | Python | apache-2.0 | 2,013 |
synapse_number = 0
neuron_number = 0
startsimulate = 0 # begin of simulation
endsimulate = 0 # end of simulation
startbuild = 0
endbuild = 0
| research-team/robot-dream | somatosensory_columns/globals.py | Python | mit | 165 |
"""
Classes to cache and read specific items from github issues in a uniform way
"""
from functools import partial as Partial
import datetime, time, shelve
# Requires PyGithub version >= 1.13 for access to raw_data attribute
import github
# Needed to not confuse cached 'None' objects
class Nothing(object):
raw_d... | sathnaga/virt-test | tools/github/github_issues.py | Python | gpl-2.0 | 29,365 |
import cPickle as pickle
import numpy as np
#variables_list=['sphum', 'geopotential', 'u_wind', 'v_wind', 'cloud_cover', 'temperature']
#variables_list=['temperature']
variables_list=['vort', 'div', 'ptvort']
###############################
## Need to check time interval - TRMM data in 3 hourly intervals, given in ... | peterwilletts24/Python-Scripts | era_interim/ERA_I_sum_or_mean_vort_div.py | Python | mit | 1,756 |
#! /usr/bin/env python
# -*- coding: utf-8
"""
Python implementation of Non-Stationary Gabor Transform (NSGT)
derived from MATLAB code by NUHAG, University of Vienna, Austria
Thomas Grill, 2011-2017
http://grrrr.org/nsgt
Austrian Research Institute for Artificial Intelligence (OFAI)
AudioMiner project, supported by ... | grrrr/nsgt | setup.py | Python | artistic-2.0 | 2,421 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from molo.core.models import ArticlePage, ArticlePageRecommendedSections
from wagtail.wagtailcore.blocks import StreamValue
def create_recomended_articles(main_article, article_list):
'''
Creates recommended arti... | praekelt/molo-iogt | iogt/migrations/0003_convert_recomended_articles.py | Python | bsd-2-clause | 2,316 |
from urlparse import urljoin
import requests
from django.conf import settings
from edxmako.shortcuts import marketing_link
import logging
from django.core.cache import cache
import json
log = logging.getLogger(__name__)
def is_marketing_api_enabled():
"""
Checks if the feature is enabled, while making some sa... | Edraak/edraak-platform | lms/djangoapps/course_api/helpers.py | Python | agpl-3.0 | 2,431 |
# this code is a version of the mersenne twister random number generator which
# is supposed to be used from RPython without the Python interpreter wrapping
# machinery etc.
# this is stolen from CPython's _randommodule.c
from rpython.rlib.rarithmetic import r_uint, intmask
N = 624
M = 397
MATRIX_A = r_uint(0x9908b0... | oblique-labs/pyVM | rpython/rlib/rrandom.py | Python | mit | 4,329 |
from math import sin, cos, radians
from pyx import *
angle = 10
factor = 1.0 / (cos(radians(angle)) + sin(radians(angle)))
cc = canvas.canvas()
cc.stroke(path.rect(-2, -2, 4, 4))
c = canvas.canvas()
for i in range(10):
c.insert(cc, [trafo.rotate(i*angle), trafo.scale(factor**i)])
c.writeEPSfile("insert")
c.write... | mjg/PyX-svn | examples/drawing2/insert.py | Python | gpl-2.0 | 363 |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2009, 2014 Toms Bauģis <toms.baugis at gmail.com>
# This file is part of Project Hamster.
# Project Hamster 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, eithe... | jean/hamster | src/hamster/widgets/facttree.py | Python | gpl-3.0 | 17,350 |
# 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 unittest
from telemetry.internal.results import story_run
from telemetry.story import shared_state
from telemetry.story import story_set
from telemet... | XiaosongWei/chromium-crosswalk | tools/telemetry/telemetry/internal/results/story_run_unittest.py | Python | bsd-3-clause | 2,653 |
class PDDLProgramType(object):
"""Represent an enumeration class that contains two constant, represents types of PDDL program"""
PROBLEM = 0
DOMAIN = 1
| SimoneLucia/EmbASP-Python | languages/pddl/pddl_program_type.py | Python | mit | 164 |
# -*- coding: utf-8 -*-
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Chrome OS Image file signing."""
from __future__ import print_function
import collections
from chromite.lib import commandli... | endlessm/chromium-browser | third_party/chromite/signing/bin/sign_image.py | Python | bsd-3-clause | 2,857 |
from . import vw_Base
import Tkinter as Tk
class vw_Trigger(vw_Base):
def __init__(self, master, cb_func, **kwargs):
"""
:param cb_func: Callback function
:type cb_func: method
:param label: Widget label
:type label: str
:param button_label: Button Label
:ty... | protonyx/labtronyx-gui | labtronyxgui/widgets/vw_state.py | Python | mit | 6,074 |
from yowsup.structs import ProtocolEntity, ProtocolTreeNode
from .notification import NotificationProtocolEntity
class StatusNotificationProtocolEntity(NotificationProtocolEntity):
'''
<notification offline="0" id="{{NOTIFICATION_ID}}" notify="{{NOTIFY_NAME}}" type="status"
t="{{TIMESTAMP}}" from="... | felix-dumit/campusbot | yowsup2/yowsup/layers/protocol_notifications/protocolentities/notification_status.py | Python | mit | 1,219 |
from queue import Queue
from microrpc import Server
queues = {}
server = Server()
@server.rpc
def create(name):
if name not in queues:
queues[name] = Queue()
return True
return False
@server.rpc
def delete(name):
if not queues.pop(name, False):
return False
return True
@serve... | jasonjohnson/microq | microq/server.py | Python | mit | 453 |
#!/usr/bin/python
#
#
# Python solution
#
import os
import logging
import time
import datetime
DEBUG = 0
if DEBUG == 1:
logging.basicConfig(filename='/Users/skippern/log/linklogger.log',level=logging.DEBUG,format='%(asctime)s %(message)s',datefmt='%Y/%m/%d %H:%M:%S:')
logging.debug('monitor.py started in DEBUG... | Skippern/uptime_monitor | src/monitor.py | Python | gpl-3.0 | 2,148 |
# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | hamish/SmeltCMS | packages/botocore/docs/bcdoc/style.py | Python | gpl-3.0 | 11,115 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-12 10:29
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('foobar', '0021_auto_20170330_0916'),
('foobar', '0021_auto_20170313_2018'),
]
opera... | uppsaladatavetare/foobar-api | src/foobar/migrations/0022_merge_20170412_1029.py | Python | mit | 336 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
import sys
if len(sys.argv) != 4:
raise E... | escapewindow/signingscript | src/signingscript/vendored/mozbuild/mozpack/test/support/minify_js_verify.py | Python | mpl-2.0 | 489 |
# coding: utf-8
def load_plugin(params):
pass
| alt-core/sheetbot | plugin/render_text/__init__.py | Python | mit | 51 |
from _common import *
_truths = ['nPartons', 'nBPartons', 'nCPartons']
truths = {_truths[x]:x for x in xrange(len(_truths))}
def make_coll(fpath):
coll = obj.PFSVCollection()
coll.add_categories(['singletons','pf'], fpath)
return coll
def generate(collections, partition='train', batch=32,
... | sidnarayanan/BAdNet | python/subtlenet/generators/pf.py | Python | mit | 4,684 |
__doc__ = """
Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
OpenCV Companion 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... | atzengin/OCC | occ/python/Platform.py | Python | gpl-3.0 | 2,394 |
"""Unit tests for the module for interacting with Octave."""
import os
from unittest import mock
from matl_online.octave import OctaveSession
class TestOctaveSession:
"""Series of tests for the OctaveSession class."""
def test_no_inputs(self, mocker):
"""Ensure the proper default parameters."""
... | suever/MATL-Online | tests/test_octave.py | Python | mit | 2,759 |
import dateutil
import pytest
from pystarling.api_objects.transactions.BaseTransaction import SimpleTransaction, TransactionSource, \
TransactionDirection
class TestSimpleTransaction(object):
test_data = {
'id': 'ee8152d7-6ff2-4f79-b9de-39861bdec427',
'currency': 'GBP',
'amount': 12.3... | rdcrt/pystarling | test/api_objects/transactions/test_SimpleTransaction.py | Python | mit | 1,290 |
import os, sys
from types import ListType
from pyo import *
build_format = "html"
build_folder = "./build_html"
if "--latex" in sys.argv:
build_format = "latex"
build_folder = "./build_latex"
f = open(os.getcwd() + '/source/api/alphabetical.rst', 'w')
# Header
f.write("Alphabetical class reference\n")
f.writ... | wang1986one/pyo | doc-sphinx/build.py | Python | gpl-3.0 | 2,053 |
from guizero import App
app = App()
app.info("Info", "This is a guizero app")
app.error("Error", "Try and keep these out your code...")
app.warn("Warning", "These are helpful to alert users")
app.display() | lawsie/guizero | examples/alert.py | Python | bsd-3-clause | 205 |
import _plotly_utils.basevalidators
class TickvalssrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="tickvalssrc", parent_name="layout.scene.zaxis", **kwargs
):
super(TickvalssrcValidator, self).__init__(
plotly_name=plotly_name,
p... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/scene/zaxis/_tickvalssrc.py | Python | mit | 430 |
import json
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import Client, MULTIPART_CONTENT
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.core import mail
from django.test.utils import override_settings
from django.con... | eugena/django-rest-auth | rest_auth/tests.py | Python | mit | 19,385 |
import os
import sys
from ._fmap import fmap
#-------------------------------------------------------------------------------
DESCRIPTION = '''Recusively apply a command to a filesystem tree.
'''
def process_args(args):
import argparse
parser = argparse.ArgumentParser(prog='fmap', description=DESCRIPTION)
... | mbodenhamer/fmap | fmap/main.py | Python | mit | 3,329 |
from os import listdir
from os.path import isfile, join
import numpy as np
import sys, getopt
import csv
from imfractal import *
test_usage_str = sys.argv[0] + " -p <path_mats>"
meta_pos_filename = 2
meta_pos_start_data = 2
meta_pos_end_data = 20
argv = sys.argv[1:]
path_mats = ''
TRANSFORMED_INPUT_STR = ''
if MF... | rbaravalle/imfractal | test_generates_data_correlations_BioAsset.py | Python | bsd-3-clause | 2,395 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2016,小忆机器人
All rights reserved.
摘 要:
创 建 者:余菲
创建日期:16/6/4
"""
from collections import defaultdict
def attach_name(case, name):
"""
对某个case附加一个名字属性(这种属性只有1个对象如type或name等)
:param case: case的string 如(虫|鸟)
:param name: type或name... | JK-River/RobotAIEngine | query_analysis/utils/utils.py | Python | apache-2.0 | 4,173 |
import socket
import struct
addr_long = int("0200A8C0", 16)
hex(addr_long)
struct.pack("<L", addr_long)
socket.inet_ntoa(struct.pack("<L", addr_long))
'192.168.0.2'
pnSeed = [
0x34bb2958, 0x34b22272, 0x284c48d2, 0x010a8878,
0x010a8854, 0x68ed0421, 0x6e5001fa, 0x704a39c2,
0x714efdbe, 0x72d72ed0, 0x73ca9f1c... | hexxcointakeover/hexxcoin | contrib/seeds/convert_ipv4hex.py | Python | mit | 2,007 |
# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
from cStringIO import StringIO
import sys
from time import sleep
from lazr.jobrunner.bin.clear_queues import clear_queues
from testtools.content import Content
from testtools.cont... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/services/job/tests/test_celeryjob.py | Python | agpl-3.0 | 7,246 |
# -*- coding: utf-8 -*-
from collections import defaultdict
class KeyDefaultDict(defaultdict):
def __missing__(self, key):
if not self.default_factory:
raise KeyError(key)
else:
self[key] = self.default_factory(key)
return self[key]
| isubuz/zahlen | util.py | Python | mit | 292 |
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U.
from datetime import datetime, timedelta
from pytz import timezone
from openerp import _, api, fields, models
from openerp.exceptions import ValidationError
class Generator... | Endika/event | event_track_generate/wizards/wizard_generator.py | Python | agpl-3.0 | 7,485 |
URL = {
3304557: {
"production": "https://notacarioca.rio.gov.br/WSNacional/nfse.asmx?wsdl",
"sandbox": "https://homologacao.notacarioca.rio.gov.br/WSNacional/nfse.asmx?wsdl"
}
}
TEMPLATES = {
'send_rps': "GerarNfseEnvio.xml",
'status': "ConsultarNfseEnvio.xml",
'get_nfse': "Consult... | adrianomargarin/py-notacarioca | notacarioca/settings.py | Python | apache-2.0 | 377 |
# Config
NODE_ID = 1
# hour,set 0 to disable
SPEEDTEST = 6
CLOUDSAFE = 1
ANTISSATTACK = 0
AUTOEXEC = 0
MU_SUFFIX = 'zhaoj.in'
MU_REGEX = '%5m%id.%suffix'
SERVER_PUB_ADDR = '127.0.0.1' # mujson_mgr need this to generate ssr link
API_INTERFACE = 'modwebapi' # glzjinmod, modwebapi
WEBAPI_URL = 'https://zhaoj.in'
W... | caorun0728/shadowsocks | apiconfig.py | Python | apache-2.0 | 884 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/secondaires/familier/prompt.py | Python | bsd-3-clause | 3,781 |
####
#### Setup gross testing environment.
#### This includes server target and browser type.
####
import os
from selenium import webdriver
## Run this before anything else.
def before_all(context):
## Determine the server target. Default: http://amigo.geneontology.org.
context.target = 'http://amigo.geneonto... | raymond91125/amigo | test-app/behave/environment.py | Python | bsd-3-clause | 738 |
"""Test functions that require special treatment in amici.sbml_import.
In particular, some of the functions tested here require an installation of
boost.
"""
import os
import shutil
import amici
import numpy as np
from scipy.special import loggamma
import pytest
from amici.gradient_check import check_derivatives
d... | AMICI-developer/AMICI | python/tests/test_sbml_import_special_functions.py | Python | bsd-2-clause | 4,466 |
# Code chunks borrowed from Django Comments Framework.
# Rather than using three tier inheritance, Contactme uses two, one for
# security fields and the form data on. No check for duplicates.
import time
import datetime
import django
from django import forms
if django.VERSION[:2] < (1, 7):
from django.forms.util ... | petekalo/django-contactme | django_contactme/forms.py | Python | mit | 4,009 |
import asyncio
from typing import TYPE_CHECKING, Optional, Union
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.uix.popup import Popup
from electrum_mona.util import bh2u
from electrum_mona.logging import Logger
from electrum_mona.lnutil import LOCAL, REMOTE, format_short_channel_id
from ele... | wakiyamap/electrum-mona | electrum_mona/gui/kivy/uix/dialogs/lightning_channels.py | Python | mit | 33,582 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis_louvain | attribution/views/tutor_application.py | Python | agpl-3.0 | 2,065 |
import sys
import logging
from django.conf import settings
# Create a dummy handler to use for now.
class NullHandler(logging.Handler):
def emit(self, record):
pass
def get_logger():
"Attach a file handler to the logger if there isn't one already."
debug_on = getattr(settings, "SOUTH_LOGGING_ON", ... | esplinr/foodcheck | wsgi/foodcheck_proj/south/logger.py | Python | agpl-3.0 | 1,175 |
__author__ = 'Microdog <dlangu0393@gmail.com>'
| microdog/hello-gfw | tests/__init__.py | Python | mit | 47 |
import sys
import c2p
import traceback
from antlr4 import * # type: ignore
from antlr4.error.ErrorListener import ErrorListener # type: ignore
from c2p.grammar.antlr.SmallCLexer import SmallCLexer
from c2p.grammar.antlr.SmallCParser import SmallCParser
from c2p.grammar.ast.visitor import ASTVisitor
from c2p.grammar.as... | Sibert-Aerts/c2p | src/main.py | Python | mit | 2,477 |
from tornado import ioloop,gen,escape
from datetime import datetime
import tornado_mysql
import hashlib
import urllib.parse
import conf
def log(s):
print(str(datetime.now())+' - '+str(s))
def escape(s):
return escape.xhtml_escape(s)
def gen_pw(user,pw):
m = hashlib.md5()
m.update((user+'XOJ233333333... | zrt/XOJ | judger/tools.py | Python | gpl-3.0 | 740 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from chainer import cuda, optimizers, serializers
from chainer.optimizer import WeightDecay
from progressbar import ProgressBar
from model import BLSTM, BLSTMCRF
from libs.base import App as AbstractApp, Logger as Log
from libs.tools import Preprocessor
from d... | chantera/blstm-cws | app/train.py | Python | mit | 4,297 |
from rpython.translator.c.genc import CBuilder
from rpython.rtyper.lltypesystem.lltype import getfunctionptr
from rpython.translator.tool.cbuild import ExternalCompilationInfo
class CLibraryBuilder(CBuilder):
standalone = False
split = True
def __init__(self, *args, **kwds):
self.functions = kwd... | oblique-labs/pyVM | rpython/translator/c/dlltool.py | Python | mit | 1,451 |
# -*- coding: utf-8 -*-
#Copyright (C) 2011 Seán Hayes
#Django imports
from django.core.cache import cache
from django.test import TestCase
class BaseTestCase(TestCase):
def tearDown(self):
#FIXME: dqc doesn't intercept db destruction or rollback
cache.clear()
| SeanHayes/swarm-war | swarm_war/missions/tests/util.py | Python | agpl-3.0 | 271 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Blueprint
web_root = Blueprint("web_root", __name__, template_folder="templates")
| acque2two/AcTasker | AcTasker/web/web.py | Python | gpl-3.0 | 150 |
from searchv2.tests.test_builders import *
from searchv2.tests.test_models import *
from searchv2.tests.test_utils import *
from searchv2.tests.test_views import * | pydanny/djangopackages | searchv2/tests/__init__.py | Python | mit | 163 |
"""
Test ensuring roster channels
"""
from gabbletest import exec_test
from servicetest import call_async
import constants as cs
import ns
def test(q, bus, conn, stream):
conn.Connect()
roster_event = q.expect('stream-iq', query_ns=ns.ROSTER)
roster_event.stanza['type'] = 'result'
call_async(q, conn... | community-ssu/telepathy-gabble | tests/twisted/roster/ensure.py | Python | lgpl-2.1 | 1,752 |
import requests
from pathlib import Path
import os
def download(url: str, path: str):
r = requests.get(url, stream=True)
extension = get_extension(r.headers['Content-Type'])
if not extension:
return None
path = replace_extension(path, extension)
ensure_path(path)
with open(path, 'wb')... | theHarvester/paper-scraper | download/image.py | Python | apache-2.0 | 988 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... | BhallaLab/moose | moose-gui/suds/__init__.py | Python | gpl-3.0 | 5,620 |
"""Support for Swisscom routers (Internet-Box)."""
import logging
from aiohttp.hdrs import CONTENT_TYPE
import requests
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassistant.const import CONF_HOST
import homeassistant.he... | fbradyirl/home-assistant | homeassistant/components/swisscom/device_tracker.py | Python | apache-2.0 | 2,997 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'county_vmt.ui'
#
# Created: Thu Nov 21 11:10:25 2013
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Att... | anl-tracc/polaris-analyser | county_vmt.py | Python | bsd-3-clause | 1,297 |
# Doxyfile 1.7.4
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG +=... | makestuff/scripts | gendox/Doxyfile.py | Python | gpl-3.0 | 72,294 |
from validatish import validate
from error import Invalid
#####
# Validator base classes.
#
class Validator(object):
""" Abstract Base class for all validators """
def __call__(self, value):
""" A method that will raise an Invalid error """
def __repr__(self):
return 'validatish.%s()'%... | ish/validatish | validatish/validator.py | Python | bsd-3-clause | 7,908 |
"""
Copyright 2017 Ryan Wick (rrwick@gmail.com)
https://github.com/rrwick/Unicycler
This module contains functions relating to BLAST, which Unicycler uses to rotate completed circular
replicons to a standard starting point.
This file is part of Unicycler. Unicycler is free software: you can redistribute it and/or mod... | rrwick/Unicycler | unicycler/blast_func.py | Python | gpl-3.0 | 5,533 |
# -*- coding: iso-8859-15 -*-
# ISO-3166 alpha country codes - ver 1
ISO3166CountryCodesAlpha= { "ABW":"Aruba",\
"AFG":"Afghanistan",\
"AGO":"Angola",\
"AIA":"Anguilla",\
"ALA":"Åland Islands",\
"ALB":"Albania",\
"AND":"Andorra",\
"ANT":"Netherlands Antilles",\
"ARE":"United Arab Emirate... | kaosbeat/datakamp | RFIDIOt-master/rfidiot/iso3166.py | Python | mit | 16,392 |
# Time: O(nlogn)
# Space: O(n)
# The i-th person has weight people[i],
# and each boat can carry a maximum weight of limit.
#
# Each boat carries at most 2 people at the same time,
# provided the sum of the weight of those people is at most limit.
#
# Return the minimum number of boats to carry every given person.
# ... | tudennis/LeetCode---kamyu104-11-24-2015 | Python/boats-to-save-people.py | Python | mit | 1,193 |
# -*- coding: ascii -*-
import sys, os, os.path
import unittest, doctest
import cPickle as pickle
from datetime import datetime, tzinfo, timedelta
if __name__ == '__main__':
# Only munge path if invoked as a script. Testrunners should have setup
# the paths already
sys.path.insert(0, os.path.abspath(os.pa... | themattharris/json-dsttime | pytz/tests/test_tzinfo.py | Python | mit | 17,331 |
import os
class IMG(object):
FOLDER = 'meme-cache'
EXT = '.jpg'
class PATH(object):
ROOT = os.path.dirname(__file__)
IMAGES = os.path.join(ROOT, IMG.FOLDER)
| obestwalter/pet | unfinished/examples/code-evolution/b/memes/conf.py | Python | mit | 177 |
# Copyright (C) 2015 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ycmd... | NorfairKing/sus-depot | shared/shared/vim/dotvim/bundle/YouCompleteMe/third_party/ycmd/ycmd/tests/go/go_handlers_test.py | Python | gpl-2.0 | 1,192 |
# 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 u... | apache/incubator-superset | superset/databases/commands/importers/v1/__init__.py | Python | apache-2.0 | 2,567 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.