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 |
|---|---|---|---|---|---|
"""testApp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | Kos/rtable | testApp/urls.py | Python | isc | 867 |
# -*- coding: utf-8 -*-
from plugin_elrte_widget import ElrteWidget
from plugin_dialog import DIALOG
from plugin_uploadify_widget import (
uploadify_widget, IS_UPLOADIFY_IMAGE, IS_UPLOADIFY_LENGTH
)
# use disk_db for image storing
disk_db = db
# define a product table using memory db
db = DAL('sqlite:memory:'... | chugle/myapp | applications/welcome/controllers/plugin_elrte_widget.py | Python | gpl-2.0 | 5,412 |
#
#
# Copyright 2011,2013 Luis Ariel Vega Soliz and contributors.
# ariel.vega@uremix.org
#
# This file is part of python-mobile.
#
# python-mobile is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... | arielvega/python-mobile | src/mobile/unlocker/__init__.py | Python | gpl-3.0 | 1,103 |
import sys
import traceback
import urlparse
import dataetc
from Array import Array
from CSSStyleDeclaration import CSSStyleDeclaration
from unknown import unknown
import config
import time
from HTTP.HttpHoneyClient import hc
import re
class DOMObject(object):
def __init__(self, window, tag, parser):
self... | amohanta/phoneyc-1 | DOM/DOMObject.py | Python | gpl-2.0 | 6,096 |
# -*- coding: utf-8 -*-
import datetime
import re
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class JasonsDeliSpider(scrapy.Spider):
download_delay = 0.2
name = "jasonsdeli"
allowed_domains = ["jasonsdeli.com"]
start_urls = (
'https://ww... | iandees/all-the-places | locations/spiders/jasonsdeli.py | Python | mit | 2,370 |
from __future__ import absolute_import, unicode_literals
import sys
from functools import partial
from billiard.einfo import ExceptionInfo
from django.http import HttpResponse
from django.test.testcases import TestCase as DjangoTestCase
from django.template import TemplateDoesNotExist
from anyjson import deseriali... | sivaprakashniet/push_pull | p2p/lib/python2.7/site-packages/djcelery/tests/test_views.py | Python | bsd-3-clause | 6,651 |
import base64
import ipaddress
try:
import collections.abc as collections_abc # only works on python 3.3+
except ImportError:
import collections as collections_abc
from datetime import date, datetime
from dateutil import parser, tz
from six import string_types, iteritems, integer_types
from six.moves import... | 3lnc/elasticsearch-dsl-py | elasticsearch_dsl/field.py | Python | apache-2.0 | 12,401 |
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at
# McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/)
#
# 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... | kdheepak89/pypdevs | pypdevs/templates/relocator.py | Python | apache-2.0 | 2,139 |
import pythoncom
import win32com.server.util
import win32com.test.util
import unittest
from pywin32_testutil import str2bytes
class Persists:
_public_methods_ = [ 'GetClassID', 'IsDirty', 'Load', 'Save',
'GetSizeMax', 'InitNew' ]
_com_interfaces_ = [ pythoncom.IID_IPersistSt... | zhanqxun/cv_fish | win32com/test/testStreams.py | Python | apache-2.0 | 4,521 |
"""Test how the ufuncs in special handle nan inputs.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_equal, assert_
import pytest
import scipy.special as sc
from scipy._lib._numpy_compat import suppress_warnings
KNOWNFAILURES = {}
POST... | lhilt/scipy | scipy/special/tests/test_nan_inputs.py | Python | bsd-3-clause | 1,775 |
from ctypes import Structure, c_int16, c_uint16
class Filter(Structure):
""" Represents a Fixture filter """
_fields_ = [("categoryBits", c_uint16),
("maskBits", c_uint16),
("groupIndex", c_int16)]
def __init__(self, categoryBits=0x1, maskBits=0xFFFF... | cloew/NytramBox2D | nytram_box2d/engine/filter.py | Python | mit | 503 |
"""Base Entity for all TelldusLive entities."""
from datetime import datetime
import logging
from homeassistant.const import ATTR_BATTERY_LEVEL, DEVICE_DEFAULT_NAME
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Ent... | HydrelioxGitHub/home-assistant | homeassistant/components/tellduslive/entry.py | Python | apache-2.0 | 4,178 |
from blinker import Signal
on_init = Signal()
on_session = Signal()
on_parse = Signal()
on_meta = Signal()
on_wait = Signal()
| pudo/krauler | krauler/signals.py | Python | mit | 127 |
from __future__ import division, print_function
import os, json
from glob import glob
import numpy as np
from scipy import misc, ndimage
from scipy.ndimage.interpolation import zoom
import keras
from keras import backend as K
from keras.models import Sequential, Model
from keras.layers.core import Flatten, Dense, Dro... | roebius/deeplearning1_keras2 | nbs/resnet50.py | Python | apache-2.0 | 5,047 |
import os
import sys
import uuid
import logging
import datetime
import traceback
from PyQt5 import QtCore
import PyQt5.QtWidgets as QtWidgets
import PyQt5.Qt as Qt
import numpy as np
from pandas import Series, DatetimeIndex
from matplotlib.axes import Axes
from matplotlib.patches import Rectangle
from matplotlib.dates... | DynamicGravitySystems/DGP | examples/plot2_prototype.py | Python | apache-2.0 | 4,218 |
import os
from distutils import util
from distutils.core import Command
from distutils.filelist import FileList
class InstallMisc(Command):
"""
Common base class for installing some files in a subdirectory.
Currently used by install_data and install_localstate.
"""
user_options = [
('force... | Pikecillo/genna | external/4Suite-XML-1.0.2/Ft/Lib/DistExt/InstallMisc.py | Python | gpl-2.0 | 4,645 |
import numpy
import six
from chainer import backend
from chainer import function_node
import chainer.functions
import chainer.utils
from chainer.utils import type_check
import chainerx
class SelectorBase(function_node.FunctionNode):
"""Select an array element from a given axis or set of axes."""
def __init_... | okuta/chainer | chainer/functions/math/minmax.py | Python | mit | 6,399 |
#
# threads.py: anaconda thread management
#
# Copyright (C) 2012
# Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (... | Sabayon/anaconda | pyanaconda/threads.py | Python | gpl-2.0 | 6,224 |
from misago.markup import checksums
def is_post_valid(post):
valid_checksum = make_post_checksum(post)
return post.checksum == valid_checksum
def make_post_checksum(post):
post_seeds = [unicode(v) for v in (post.id, post.poster_ip)]
return checksums.make_checksum(post.parsed, post_seeds)
def updat... | leture/Misago | misago/threads/checksums.py | Python | gpl-2.0 | 1,229 |
#!/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
#
# Authors: Pavlo Svirin <pavlo.svirin@gmail.com>
import unittest
import os
... | PalNilsson/pilot2 | pilot/test/test_copytools_rucio.py | Python | apache-2.0 | 1,674 |
# mako/_ast_util.py
# Copyright (C) 2006-2016 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
ast
~~~
The `ast` module helps Python applications to process trees of the Pyth... | Widiot/simpleblog | venv/lib/python3.5/site-packages/mako/_ast_util.py | Python | mit | 25,691 |
# python
# This file is generated by a program (mib2py). Any edits will be lost.
from pycopia.aid import Enum
import pycopia.SMI.Basetypes
Range = pycopia.SMI.Basetypes.Range
Ranges = pycopia.SMI.Basetypes.Ranges
from pycopia.SMI.Objects import ColumnObject, MacroObject, NotificationObject, RowObject, ScalarObject, N... | xiangke/pycopia | mibs/pycopia/mibs/FRAME_RELAY_DTE_MIB.py | Python | lgpl-2.1 | 16,317 |
#! /usr/bin/python2.7
# coding=utf-8
########################################################
import matplotlib.pyplot as plt
import numpy as np
from numpy import *
import pylab
import os
import interpFunctions # Contient la fonction der_auto pour caler automatiquement
from interpFunctions import * # la... | ogirou/ODSTA | ODSTAIF.py | Python | mit | 13,600 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-16 00:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tratamientos', '0003_auto_20160515_2028'),
('turnos'... | mava-ar/sgk | src/turnos/migrations/0002_turno_sesion.py | Python | apache-2.0 | 623 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import os
import sys
import shutil
import subprocess
from fnmatch import fnmatchcase
from distutils.util import convert_path
# Do not EVER use setuptools, it makes cythonization fail
# Distribute fixes that
from distutils.core imp... | shiquanwang/numba | setup.py | Python | bsd-2-clause | 7,359 |
#!/usr/bin/env python
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2018 NIWA
#
# 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 yo... | arjclark/cylc | lib/parsec/util.py | Python | gpl-3.0 | 10,442 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from types import *
def typer(x,y):
if type(x) is StringType or type(y) is StringType :
print u'получена строка'
else:
if x > y:
print u'больше'
elif x < y:
print u'меньше'
else:
print u'равно'
typer("12", 4)
typer("12","4")
typer(12, 4)
typer(4, 45)
typer(4,... | pybursa/homeworks | a_karnauh/hw1/6.py | Python | gpl-2.0 | 354 |
"""SCons.Tool.link
Tool-specific initialization for the generic Posix linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009... | kerwinxu/barcodeManager | zxing/cpp/scons/scons-local-2.0.0.final.0/SCons/Tool/link.py | Python | bsd-2-clause | 4,734 |
def gen_next(v, x, y):
next = (v * 252533) % 33554393
if x == 0:
x = y + 1
y = 0
else:
x -= 1
y += 1
return [next, x, y]
a = [[0 for i in range(10)] for j in range(10)]
[v, x, y] = [20151125, 0, 0]
dx = 3010
dy = 3019
dx -= 1
dy -= 1
while True:
[v, x, y] = gen_... | imylyanyk/AdventOfCode | day25.py | Python | mit | 429 |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""Logictech MouseMan serial protocol.
http://www.softnco.demon.co.uk/SerialMouse.txt
"""
from twisted.internet import protocol
class MouseMan(protocol.Protocol):
"""
Parser for Logitech MouseMan serial mouse protocol (comp... | sorenh/cc | vendor/Twisted-10.0.0/twisted/protocols/mice/mouseman.py | Python | apache-2.0 | 2,882 |
'''
Copyright (C) 2016 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful... | MediaKraken/mkarchive | network_base_string_weblog.py | Python | gpl-2.0 | 4,025 |
"""
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... | irisyuichan/news_topic_mining | news_topic_clustering.py | Python | mit | 8,205 |
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# Copyright 2022 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Timesheet Tier Validation",
"version": "8.0.1.0.0",
"website":... | open-synergy/opnsynid-hr | hr_timesheet_tier_validation/__openerp__.py | Python | agpl-3.0 | 612 |
from __future__ import unicode_literals
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=50)
affiliation = models.CharField(max_length=100,null=True)
last_modified_date = models.DateTimeField(
blank=True, null=True)
def publish(self):
sel... | rachel3834/microlensing-online | tutorial/models.py | Python | gpl-3.0 | 8,075 |
# -*- coding: utf-8 -
#
# This file is part of offset. See the NOTICE for more information.#
import sys
__all__ = []
from .file import File, pipe
os_mod = sys.modules[__name__]
_signal = __import__('signal')
for name in dir(_signal):
if name[:3] == "SIG" and name[3] != "_":
setattr(os_mod, name, geta... | benoitc/offset | offset/os/__init__.py | Python | mit | 383 |
# 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... | hehongliang/tensorflow | tensorflow/python/keras/layers/embeddings.py | Python | apache-2.0 | 7,974 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-04 03:01
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('tntapp', '0004_auto_20160617_0048'),
... | Pazitos10/TNT | webapp/app/tntapp/migrations/0005_materia_ts_actualizacion_eventos.py | Python | mit | 578 |
# -*- Mode: Python; test-case-name: flumotion.test.test_greeter -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified un... | timvideos/flumotion | flumotion/test/test_greeter.py | Python | lgpl-2.1 | 2,934 |
import logging
from zentral.core.exceptions import ImproperlyConfigured
default_app_config = "zentral.core.compliance_checks.apps.ZentralComplianceChecksAppConfig"
logger = logging.getLogger("zentral.core.compliance_checks")
# compliance checks classes
compliance_check_classes = {}
def register_compliance_che... | zentralopensource/zentral | zentral/core/compliance_checks/__init__.py | Python | apache-2.0 | 1,092 |
import re
from datetime import timedelta
from urlparse import urlparse
from functools import wraps
from django.core.cache import cache
from .settings import (
FACEBOOK_APPLICATION_CANVAS_URL, FACEBOOK_APPLICATION_DOMAIN,
FACEBOOK_APPLICATION_NAMESPACE, FACEBOOK_SITE_URL
)
def cached_property(**kwargs):
... | luismasuelli/hoods-raising | fbgamers/utils.py | Python | gpl-3.0 | 1,973 |
from UI import window
import sys
import os
UI = window()
UI.loop()
| vongola12324/PhetStorm | main.py | Python | gpl-3.0 | 68 |
import os
import re
import asyncio
import logging
from collections import OrderedDict
from pypeman.message import Message
from pypeman.errors import PypemanConfigError
logger = logging.getLogger("pypeman.store")
DATE_FORMAT = '%Y%m%d_%H%M'
class MessageStoreFactory():
""" Message store factory class can gener... | jrmi/pypeman | pypeman/msgstore.py | Python | apache-2.0 | 9,722 |
import pygame
import math
import random
def interpolate(v1, v2, range):
return pygame.math.Vector2(v1.x + (v2.x - v1.x) * range,
v1.y + (v2.y - v1.y) * range)
class Particle(pygame.sprite.Sprite):
def __init__(self, game, image, pos, vel, life, lifetime,
fade_sta... | kidscancode/gamedev | war/particles.py | Python | mit | 4,829 |
# Copyright 2013 - Noorul Islam K M
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ed-/python-solumclient | solumclient/tests/test_client.py | Python | apache-2.0 | 1,083 |
# -*- coding: utf-8 -*-
import logging
from osv import fields, osv
_logger = logging.getLogger(__name__)
class hourly_fee_p_discount(osv.osv):
'''按位钟点费优惠设置'''
_name = "ktv.hourly_fee_p_discount"
_inherit = "ktv.hourly_fee_discount"
_description = "按位钟点费优惠设置"
| chengdh/openerp-ktv | openerp/addons/ktv_sale/hourly_fee_p_discount.py | Python | agpl-3.0 | 312 |
from django.conf.urls.defaults import *
urlpatterns = patterns('testrunner',
# Example:
# (r'^server/', include('server.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contri... | eob/synckit-research | server/testrunner/urls.py | Python | bsd-3-clause | 504 |
#----------------------------------------------------------------------
# Copyright (c) 2010-2015 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | plantigrade/geni-tools | src/gcf/geni/util/cred_util.py | Python | mit | 18,496 |
# Copyright (C) 2010-2014 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... | grnet/synnefo | snf-branding/synnefo_branding/utils.py | Python | gpl-3.0 | 1,774 |
"""
Windows executable build with py2exe
"""
from distutils.core import setup
import py2exe
import os
data_files = []
base_path = os.path.abspath(os.path.dirname(__file__))
def prep_data_files(dir):
for root, dirs, files in os.walk(base_path + dir):
path = root.split('/')
_tfiles = []
fo... | ctengiz/firewad | build_py2exe.py | Python | mit | 1,683 |
import os
from os.path import join
import sys
import re
def getOrDef(dic, key):
if not key in dic.keys():
return 0
return dic[key]
def readList(filename):
f = open(filename)
res = list(map(lambda w: w.replace("\n", ""), f.readlines()))
f.close()
return res
out = op... | sayon/ignoreme | lexers/utils/frequencies_kw.py | Python | mit | 899 |
"""Implement the hil-admin command."""
from hil import config, model, deferred, server, migrations, rest
from hil.commands import db
from hil.commands.migrate_ipmi_info import MigrateIpmiInfo
from hil.commands.util import ensure_not_root
from hil.flaskapp import app
from time import sleep
from flask_script import Manag... | SahilTikale/haas | hil/commands/admin.py | Python | apache-2.0 | 3,992 |
from pylab import *
def log_likelihood(params, xx):
mu, sigma = params[0], params[1]
logL = 0.
for x in xx:
f = 1./(sigma*sqrt(2.*pi))*exp(-0.5*((x - mu)/sigma)**2)
logL += log(mean(f))
return logL
# Load all of the posterior samples
xx = []
for i in xrange(0, 100):
posterior_sample = loadtxt(str(i) + '.txt'... | eggplantbren/RMHB | Code/Results/combine.py | Python | gpl-3.0 | 2,012 |
import collections
from sympy import (
Abs, Add, E, Float, I, Integer, Max, Min, N, Poly, Pow, PurePoly, Rational,
S, Symbol, cos, exp, oo, pi, signsimp, simplify, sin, sqrt, symbols,
sympify, trigsimp, sstr)
from sympy.matrices.matrices import (ShapeError, MatrixError,
NonSquareMatrixError, DeferredVe... | grevutiu-gabriel/sympy | sympy/matrices/tests/test_matrices.py | Python | bsd-3-clause | 80,543 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019~2999 - Cologler <skyoflw@gmail.com>
# ----------
#
# ----------
from jasily.subclasses import BaseClass
def test_subclass():
class A(BaseClass):
pass
assert A.subclasses() == (A, )
def test_subclass_subsubclass():
class A(BaseClass):
pass
... | Jasily/jasily-python | tests/test_subclasses.py | Python | mit | 421 |
# -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Soft... | brousch/opencraft | instance/tasks.py | Python | agpl-3.0 | 2,970 |
from collections import defaultdict
from tech.models import *
import logging
# load all the current ParamProperty and ParamValues in to memory
# the property_vals dict holds all the possible values of a given property.
# This allows us to do a fast look up to see if a given proprety name already has the same value ... | conlini/h2h | tech/repo.py | Python | mit | 7,754 |
"""
WSGI config for arda_db project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "arda_db.settings")
from django.core.w... | rwspicer/ARDA | arda_db/arda_db/wsgi.py | Python | mit | 389 |
mealCost = float(input())
tipPercent = int(input())
taxPercent = int(input())
tip0 = mealCost * (tipPercent / 100.0)
tax0 = mealCost * (taxPercent / 100.0)
totalCost = mealCost + tip0 + tax0
#'totalCost=totalCost+(mealCost * tipPercent / 100.0)+(mealCost * taxPercent / 100.0)
print("The total meal cost is {} dollars.... | reza-arjmandi/rpi-course | python practice/day2/solution.py | Python | mit | 348 |
# encoding=utf-8
__author__ = 'wangchao'
#python2 pip install jieba
#python3 pip3 install jieba3k
import jieba
seg_list = jieba.cut("我来到北京清华大学", cut_all=True)
print("Full Mode:", "/ ".join(seg_list)) # 全模式
seg_list = jieba.cut("我来到北京清华大学", cut_all=False)
print("Default Mode:", "/ ".join(seg_list)) # 精确模式
seg_list... | wang153723482/HelloWorld_my | HelloWorld_python/jieba/demo.py | Python | apache-2.0 | 659 |
# coding=utf-8
from django import template
register = template.Library()
@register.filter
def add_class(field, css):
return field.as_widget(attrs={"class":css})
| gfavre/beyondthehost | beyondthehost/beyondthehost/templatetags/registration_bootstrap.py | Python | mit | 165 |
# -*- coding: utf-8 -*-
"""
"""
# 定义对话相关
DIALOG_TYPE_NORMAL = 0 # 普通对话
DIALOG_TYPE_QUEST = 1 # 任务对话 | theheros/kbengine | demo/res/scripts/common/GlobalDefine.py | Python | lgpl-3.0 | 140 |
# Copyright 2011 Google 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 required by applicable law or a... | masamichi/bite-project | server/models/comments.py | Python | apache-2.0 | 1,287 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-27 22:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('suite', '0020_merge_20170227_2231'),
]
operations = [
migrations.AlterField... | fsxfreak/club-suite | clubsuite/suite/migrations/0021_auto_20170227_2231.py | Python | mit | 454 |
#!/usr/bin/env python
#-*-coding: utf-8 -*-
class Passenager(object):
def __init__(self, rsp_data_item):
self.__dict__.update(rsp_data_item)
class Ticket(object):
def __init__(self, rsp_data_item):
self.__dict__['secretStr'] = rsp_data_item.get('secretStr')
self.__dict__.update(rsp_d... | lilinux/piao | piao/objects.py | Python | apache-2.0 | 349 |
#!/usr/bin/python
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x, n = None):
self.val = x
self.next = n
def __str__(self):
cur = self
s = "%s" % cur.val
while cur.next:
cur = cur.next
s += "->%s" % cur.val
... | pandaoknight/leetcode | neo_medium/linked_list/swap-nodes-in-pairs/main.py | Python | gpl-2.0 | 2,183 |
#!/usr/bin/env python
import unittest
import textwrap
import snortpager
import StringIO
class AlertParseTest(unittest.TestCase):
alert_full_format = '[**] [1:10000001:1] ICMP test [**]\
[Priority: 0]\
01/21-05:14:56.944587 192.168.2.18 -> 184.150.183.114\
... | kahubbard/snortpager | tests/alerttest.py | Python | gpl-3.0 | 2,484 |
import os
import pymongo
from bson.json_util import dumps
from flask import Flask, request, jsonify
from flask_pymongo import PyMongo
from datetime import datetime
app = Flask(__name__)
app.config['MONGO_URI'] = 'mongodb://{host}:{port}/{database}'.format(
host=os.environ.get('MONGODB_HOST', 'localhost'),
po... | crcsmnky/movieweb | unused/ratings/ratings.py | Python | apache-2.0 | 1,674 |
# Copyright (C) 2011-2012 Canonical Services Ltd
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, ... | wikimedia/operations-debs-txstatsd | txstatsd/server/loggingprocessor.py | Python | mit | 2,426 |
from pytest import raises
from wikitextparser import Argument, Template, parse
def test_basics():
a = Argument('| a = b ')
assert ' a ' == a.name
assert ' b ' == a.value
assert not a.positional
assert repr(a) == "Argument('| a = b ')"
def test_anonymous_parameter():
a = Argument('| a ')
... | 5j9/wikitextparser | tests/test_argument.py | Python | gpl-3.0 | 3,632 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## @copyright
# Software License Agreement (BSD License)
#
# Copyright (c) 2017, Jorge De La Cruz, Carmen Castano.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the followi... | jdelacruz26/misccode | cad2xls.py | Python | bsd-3-clause | 2,955 |
from nbodykit.core import Algorithm, DataSource
from nbodykit import fof, utils
import numpy
def RaDecDataSource(d):
from nbodykit import plugin_manager
source = plugin_manager.get_plugin('RaDecRedshift')
d['unit_sphere'] = True
return source.from_config(d)
class FiberCollisionsAlgorithm(A... | mschmittfull/nbodykit | nbodykit/core/algorithms/FiberCollisions.py | Python | gpl-3.0 | 11,480 |
# Copyright 2020 Google 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 required by applicable law or agree... | GoogleCloudPlatform/guest-test-infra | container_images/pytest/example/src/application/main_test.py | Python | apache-2.0 | 688 |
import numpy as np
import pandas.util.testing as tm
from pandas import DataFrame, Series, read_csv, factorize, date_range
from pandas.core.algorithms import take_1d
try:
from pandas import (rolling_median, rolling_mean, rolling_min, rolling_max,
rolling_var, rolling_skew, rolling_kurt, rolli... | GuessWhoSamFoo/pandas | asv_bench/benchmarks/gil.py | Python | bsd-3-clause | 7,604 |
"""initial migration
Revision ID: 1e278961df6c
Revises:
Create Date: 2017-07-18 07:49:43.559270
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1e278961df6c'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto ... | weqopy/blog_instance | migrations/versions/1e278961df6c_initial_migration.py | Python | mit | 1,299 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# @Author: oesteban
# @Date: 2016-06-03 09:35:13
# @Last Modified by: oesteban
# @Last Modified time: 2016-08-17 17:41:23
import os
import numpy as np
imp... | shoshber/fmriprep | fmriprep/interfaces/utils.py | Python | bsd-3-clause | 5,876 |
# -*- coding: utf-8 -*-
"""
search.py
~~~~~~~~~~~~
This module implements search HPE OneView REST API
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_... | danielreed/python-hpOneView | hpOneView/search.py | Python | mit | 3,333 |
import pytest
from openshift_checks.docker_image_availability import DockerImageAvailability
@pytest.fixture()
def task_vars():
return dict(
openshift=dict(
common=dict(
service_type='origin',
is_containerized=False,
is_atomic=False,
... | EricMountain-1A/openshift-ansible | roles/openshift_health_checker/test/docker_image_availability_test.py | Python | apache-2.0 | 10,066 |
import os
from ecl.util.test import PathContext,TestAreaContext
from tests import EclTest
class PathContextTest(EclTest):
def test_error(self):
with TestAreaContext("pathcontext"):
# Test failure on creating PathContext with an existing path
os.makedirs("path/1")
... | OPM/ResInsight | ThirdParty/Ert/python/tests/util_tests/test_path_context.py | Python | gpl-3.0 | 1,682 |
def directory_path(instance, filename):
"""."""
from datetime import datetime
dt = datetime.today()
return 'user/{year}/{month}/{file}'\
.format(year=dt.year, month=dt.month, file=filename)
| MichelLacerda/django-for-clients | dfc/cauth/utils.py | Python | gpl-3.0 | 214 |
# -*- coding: utf-8 -*-
"""
"""
from __future__ import absolute_import
from contextlib import contextmanager
import imp
import posixpath
from zipfile import ZipFile
from click.testing import CliRunner
import pkginfo
import pytest
from six import PY3
def test_pyfile_compiled(packages, tmpdir):
packages.require_e... | dairiki/humpty | tests/test_functional.py | Python | bsd-3-clause | 4,051 |
#!/usr/bin/env python
# -*- coding: utf-8
# Dmitry Abramov
# Python v. 2.7.9
from __future__ import print_function
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
import numpy as np
from preprocessing.tokenize_and_stem import tokenize_and_stem
# from Scraper... | ProjectRecommend/Recommend | recommend/classifier/cluster/algorithms/KMeans.py | Python | gpl-2.0 | 4,159 |
#!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | google/sg2im | sg2im/utils.py | Python | apache-2.0 | 2,220 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | stacked_capsule_autoencoders/capsules/primary.py | Python | apache-2.0 | 10,152 |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
cl... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyKDE4/kdeui/KPixmapProvider.py | Python | gpl-2.0 | 722 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | googlecodelabs/migrate-python2-appengine | mod1b-flask/main.py | Python | apache-2.0 | 1,472 |
from basic import Basic
from sympify import _sympify
from cache import cacheit
from symbol import Symbol, Wild
from sympy import mpmath
from math import log as _log
def integer_nthroot(y, n):
"""
Return a tuple containing x = floor(y**(1/n))
and a boolean indicating whether the result is exact (that is,... | KevinGoodsell/sympy | sympy/core/power.py | Python | bsd-3-clause | 25,862 |
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | tux-00/ansible | lib/ansible/plugins/action/iosxr.py | Python | gpl-3.0 | 4,032 |
import numpy as np
import sklearn
import sklearn.datasets
import matplotlib.pyplot as plt
import math
import tensorflow as tf
def get_data():
X, y = sklearn.datasets.make_moons(600, noise=0.30)
y = y.reshape([600,1])
X_train = X[:400]; y_train = y[:400]
X_cv = X[400:500]; y_cv = y[400:500]
X_test =... | neilslater/nn_practice | 01_basic_mlp/mlp_tf.py | Python | mit | 5,623 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="mesh3d.legendgrouptitle.font", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_... | plotly/plotly.py | packages/python/plotly/plotly/validators/mesh3d/legendgrouptitle/font/_color.py | Python | mit | 425 |
"""
Extra utilities for waffle: most classes are defined in edx_toggles.toggles (https://edx-toggles.readthedocs.io/), but
we keep here some extra classes for usage within edx-platform. These classes cover course override use cases.
"""
import logging
import warnings
from contextlib import contextmanager
from edx_djan... | eduNEXT/edx-platform | openedx/core/djangoapps/waffle_utils/__init__.py | Python | agpl-3.0 | 5,613 |
from setuptools import setup
package_name = 'examples_rclpy_minimal_action_client'
setup(
name=package_name,
version='0.15.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['pack... | ros2/examples | rclpy/actions/minimal_action_client/setup.py | Python | apache-2.0 | 1,311 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | stitchfix/pybossa | pybossa/view/help.py | Python | agpl-3.0 | 1,848 |
## @package shesha.supervisor
## @brief User layer for initialization and execution of a COMPASS simulation
## @author COMPASS Team <https://github.com/ANR-COMPASS>
## @version 5.2.1
## @date 2022/01/24
## @copyright GNU Lesser General Public License
#
# This file is part of COMPASS <https://anr-compas... | ANR-COMPASS/shesha | shesha/supervisor/components/targetCompass.py | Python | gpl-3.0 | 8,047 |
import json
import os
import socket
import threading
import time
import traceback
from .base import (Protocol,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
strip_server)
from ..testrunner import Stop
webdriver = None
here = o... | mateon1/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorservodriver.py | Python | mpl-2.0 | 8,627 |
from distutils.core import setup
setup(name='matplot-opencv',
author = 'Yunfu Liu',
version = '0.1',
packages = ['matplot-opencv'],
) | yunfuliu/matplot-opencv | setup.py | Python | mit | 157 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pyxb.bundles.common.xhtml1 as xhtml
import pyxb.utils.domutils
pyxb.utils.domutils.BindingDOMSupport.SetDefaultNamespace(xhtml.Namespace)
head = xhtml.head(title='A Test Document')
body = xhtml.body()
body.append(xhtml.h1('Contents'))
body.append(xh... | jonfoster/pyxb-upstream-mirror | examples/xhtml/generate.py | Python | apache-2.0 | 986 |
#!/usr/bin/env python
#####################################################################
# #
# Fretwork #
# Copyright (C) 2009-2019 FoFiX Team #
# ... | fofix/fretwork | setup.py | Python | gpl-2.0 | 9,191 |
# -*- coding: utf8 -*-
# Copyright (c) 2017 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
from dace.processdefinition.processdef import ProcessDefinition
from dace.processdefinition.activitydef import ActivityDefinition
from dace.proces... | ecreall/nova-ideo | novaideo/connectors/facebook/content/definition.py | Python | agpl-3.0 | 3,654 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'MaxFlatPrice', fields ['year']
db.create_u... | zionist/mon | mon/apps/mo/migrations/0016_auto__add_unique_maxflatprice_year.py | Python | bsd-3-clause | 8,109 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import socket
import requests
import json
import argparse
import os
import re
if __name__ == '__main__':
"""
The following DNS records will be created
<prefix>-v4.<domain> for IPv4
<prefix>-v6.<domain> for IPv6
IP address depends on the result of i... | gam2046/UtilsClass | network/ddns.py | Python | gpl-3.0 | 5,180 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.