repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
ProjectSWGCore/NGECore2 | refs/heads/master | scripts/static_spawns/tatooine/mos_eisley_womprats.py | 2 | import sys
# Project SWG: MosEisley Rat Spawn: Static Spawns
# (C)2014 ProjectSWG
from resources.datatables import Options
from resources.datatables import State
def addPlanetSpawns(core, planet):
stcSvc = core.staticService
objSvc = core.objectService
# City Sewer Swamprats
city_sewer = stcSvc.spawnObje... |
moio/spacewalk | refs/heads/master | client/solaris/rhnclient/rhn/client/capabilities.py | 4 | #!/usr/bin/python
# a dict with "capability name" as the key, and the version
# as the value.
import UserDict
import os
import sys
import config
import rhnErrors
import rpcServer
import string
from translate import _
neededCaps = {"caneatCheese": {'version':"21"},
"supportsAutoUp2dateOption": {'versio... |
mikofski/pvlib-python | refs/heads/master | pvlib/tests/test_spa.py | 3 | import os
import datetime as dt
import warnings
try:
from importlib import reload
except ImportError:
try:
from imp import reload
except ImportError:
pass
import numpy as np
from numpy.testing import assert_almost_equal
import pandas as pd
import unittest
import pytest
try:
from num... |
SphinxKnight/kuma | refs/heads/master | kuma/scrape/tests/test_source_document_redirect.py | 2 | # -*- coding: utf-8 -*-
"""Tests for the DocumentRedirectSource class (HEAD document)."""
from __future__ import unicode_literals
from . import mock_requester, mock_storage
from ..sources import DocumentRedirectSource
def test_root_doc(root_doc, client):
"""Test a page without redirects."""
url = root_doc.ge... |
ueshin/apache-spark | refs/heads/master | python/pyspark/sql/pandas/group_ops.py | 23 | #
# 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... |
Zex0n/django-simple-cms | refs/heads/master | news/urls.py | 1 | from django.conf.urls import url
from . import views
urlpatterns = [
# url(r'^news/([\w-]+)$', views.ListView.as_view(), name='list'),
url(r'^news/$', views.ListView.as_view(), name='list_all'),
url(r'^news/(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
]
|
dario-chiappetta/password-manager | refs/heads/master | backend/flask/src/clipperz/exceptions.py | 9 | from clipperz import app
from flask import jsonify
class InvalidUsage(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
... |
anhstudios/swganh | refs/heads/develop | data/scripts/templates/object/mobile/shared_sirad_far.py | 2 | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_sirad_far.iff"
result.attribute_template_id = 9
result.stfNam... |
dcripplinger/rotj | refs/heads/master | src/text.py | 1 | # -*- coding: UTF-8 -*-
from six import string_types
from math import ceil
from datetime import datetime
import os
import time
import pygame
from pygame.locals import *
from constants import BLACK, ITEMS, WHITE
from helpers import is_half_second, load_image
CHARS = {
# numbers
'0': load_image(os.path.join('... |
brandond/ansible | refs/heads/devel | test/units/modules/monitoring/test_icinga2_feature.py | 68 | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Ansible Project
# Copyright (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from ansible.modules.monitoring import icinga2_feature
from units.modules.utils import AnsibleExitJs... |
dynaryu/inasafe | refs/heads/develop | safe/gis/test/test_gdal_ogr_tools.py | 7 | # coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **Converter Test Cases.**
Contact : assefay@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Sof... |
semonte/intellij-community | refs/heads/master | python/helpers/pydev/third_party/pep8/lib2to3/lib2to3/fixes/fix_raise.py | 327 | """Fixer for 'raise E, V, T'
raise -> raise
raise E -> raise E
raise E, V -> raise E(V)
raise E, V, T -> raise E(V).with_traceback(T)
raise E, None, T -> raise E.with_traceback(T)
raise (((E, E'), E''), E'''), V -> raise E(V)
raise "foo", V, T -> warns about string exceptions
CAVEATS:... |
Electroscholars/P.E.E.R.S | refs/heads/master | MainWindowArrowTest/youtube_dl/extractor/xxxymovies.py | 183 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
)
class XXXYMoviesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?xxxymovies\.com/videos/(?P<id>\d+)/(?P<display_id>[^/]+)'
_TEST = {
'url': 'http://xxx... |
linhainan/Simple_Spider | refs/heads/master | jx3_spider.py | 1 | from tools.Simple_Parser import Simple_Parser
from tools.Simple_WebCatcher import HTMLClient
class JX3_Spider:
def Get_News(self, page):
myparser = Simple_Parser()
return myparser.feed(page, u'<div class="news_list news_list02">', u'</div>');
def Get_CSS(self, page):
myparser = Simple_Pa... |
oVirt/vdsm | refs/heads/master | tests/virt/vmsecret_test.py | 2 | #
# Copyright 2015-2020 Red Hat, Inc.
#
# 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 ... |
roadmapper/ansible | refs/heads/devel | contrib/inventory/nsot.py | 23 | #!/usr/bin/env python
'''
nsot
====
Ansible Dynamic Inventory to pull hosts from NSoT, a flexible CMDB by Dropbox
Features
--------
* Define host groups in form of NSoT device attribute criteria
* All parameters defined by the spec as of 2015-09-05 are supported.
+ ``--list``: Returns JSON hash of host groups -... |
MounirMesselmeni/django | refs/heads/master | django/db/models/lookups.py | 11 | from copy import copy
from django.conf import settings
from django.db.models.expressions import Func, Value
from django.db.models.fields import (
DateField, DateTimeField, Field, IntegerField, TimeField,
)
from django.db.models.query_utils import RegisterLookupMixin
from django.utils import timezone
from django.ut... |
PabloVallejo/todomvc-django | refs/heads/master | task/views.py | 6445 | from django.shortcuts import render
# Create your views here.
|
chinmaygarde/depot_tools | refs/heads/master | third_party/pylint/pyreverse/main.py | 67 | # # Copyright (c) 2000-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# 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,... |
agry/NGECore2 | refs/heads/master | scripts/object/tangible/quest/quest_start/ep3_hunt_loot_silkthrower_fang.py | 85615 | import sys
def setup(core, object):
return |
ProjectSWGCore/NGECore2 | refs/heads/master | scripts/object/tangible/ship/components/armor/arm_subpro_special_elite_plastisteel.py | 85615 | import sys
def setup(core, object):
return |
ssalevan/func | refs/heads/master | func/minion/modules/iptables/common.py | 6 | #
# Copyright 2008
# Krzysztof A. Adamski <krzysztofa@gmail.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 ... |
alphagov/backdrop | refs/heads/master | backdrop/write/config/production.py | 1 | import os
from ...core.config.common import load_paas_settings
PAAS = load_paas_settings()
DATABASE_URL = PAAS.get('DATABASE_URL')
DATABASE_ENGINE = PAAS.get('DATABASE_ENGINE')
CA_CERTIFICATE = PAAS.get('CA_CERTIFICATE')
STAGECRAFT_URL = os.getenv('STAGECRAFT_URL')
BROKER_URL = PAAS.get('REDIS_URL') or os.getenv('REDI... |
JioEducation/edx-platform | refs/heads/master | lms/djangoapps/shoppingcart/tests/test_views.py | 9 | """
Tests for Shopping Cart views
"""
from collections import OrderedDict
import pytz
from urlparse import urlparse
from decimal import Decimal
import json
from django.http import HttpRequest
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.c... |
holmes/intellij-community | refs/heads/master | python/helpers/python-skeletons/io.py | 62 | """Skeleton for 'io' stdlib module."""
from __future__ import unicode_literals
import sys
import io
def open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None,
closefd=True, opener=None):
"""This is an alias for the builtin open() function.
:type file: string
:type mode: s... |
RichDijk/eXe | refs/heads/master | twisted/test/test_protocols.py | 16 | # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for twisted.protocols package.
"""
from twisted.trial import unittest
from twisted.protocols import basic, wire, portforward
from twisted.internet import reactor, protocol, defer
import string, struct
import StringIO
c... |
michalliu/OpenWrt-Firefly-Libraries | refs/heads/master | staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/lib/python3.4/netrc.py | 108 | """An object-oriented interface to .netrc files."""
# Module and documentation by Eric S. Raymond, 21 Dec 1998
import os, shlex, stat
__all__ = ["netrc", "NetrcParseError"]
class NetrcParseError(Exception):
"""Exception raised on syntax errors in the .netrc file."""
def __init__(self, msg, filename=None, l... |
dbergan/AutobahnPython | refs/heads/master | examples/twisted/websocket/echo_site_tls/server.py | 18 | ###############################################################################
##
## Copyright (C) 2011-2013 Tavendo GmbH
##
## 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
##
## h... |
rd2b/tools | refs/heads/master | jabberhandler/jabberhandler.py | 1 | #!/usr/bin/env python
#########################################################
# Name: jabberhandler.py #
# Description: TODO #
#########################################################
# Read http://xmpppy.sourceforge.net/examples/xsend.py
import sys,os,xmpp,time
action=sys.argv[1]
tojid=sys.argv[2]
tex... |
qenter/vlc-android | refs/heads/master | toolchains/arm/lib/python2.7/importlib/__init__.py | 456 | """Backport of importlib.import_module from 3.x."""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex... |
chrooter/planbox | refs/heads/staging | src/planbox_data/migrations/0013_project_payment_type.py | 4 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('planbox_data', '0012_project_expires_at'),
]
operations = [
migrations.AddField(
model_name='project',
... |
Comunitea/OCB | refs/heads/8.0 | addons/portal/wizard/share_wizard.py | 224 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... |
thanos/mykonosbiennale.org | refs/heads/master | pages/urls.py | 2 | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from . import views
urlpatterns = patterns('',
url(r'^(?P<slug>[^/.]+)/$', views.PageView.as_view(), name='page'),
url(r".*Mykonos_Biennale_2015", views.Redirect2013View.as_view(), name='redi... |
plotly/python-api | refs/heads/master | packages/python/plotly/plotly/validators/waterfall/insidetextfont/_colorsrc.py | 1 | import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="colorsrc", parent_name="waterfall.insidetextfont", **kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=plotly_name,
pare... |
mikebenfield/scikit-learn | refs/heads/master | sklearn/utils/fixes.py | 11 | """Compatibility fixes for older version of python, numpy and scipy
If you add content to this file, please give the version of the package
at which the fixe is no longer needed.
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# ... |
Envious-Data/shinano-sirius_msm8974abpro-511 | refs/heads/master | scripts/build-all.py | 1474 | #! /usr/bin/env python
# Copyright (c) 2009-2013, The Linux Foundation. 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
# ... |
adrienbrault/home-assistant | refs/heads/dev | tests/helpers/test_intent.py | 7 | """Tests for the intent helpers."""
import pytest
import voluptuous as vol
from homeassistant.core import State
from homeassistant.helpers import config_validation as cv, intent
class MockIntentHandler(intent.IntentHandler):
"""Provide a mock intent handler."""
def __init__(self, slot_schema):
"""I... |
MrSurly/micropython-esp32 | refs/heads/esp32 | tests/basics/int_intbig.py | 117 | # This tests long ints for 32-bit machine
a = 0x1ffffffff
b = 0x100000000
print(a)
print(b)
print(a + b)
print(a - b)
print(b - a)
# overflows long long implementation
#print(a * b)
print(a // b)
print(a % b)
print("&", a & b)
print(a | b)
print(a ^ b)
print(a << 3)
print(a >> 1)
a += b
print(a)
a -= 123456
print(a)
... |
LCAV/pyroomacoustics | refs/heads/master | pyroomacoustics/tests/test_visibility_uroom.py | 1 | # @version: 1.0 date: 05/06/2015 by Sidney Barthe
# @author: robin.scheibler@epfl.ch, ivan.dokmanic@epfl.ch, sidney.barthe@epfl.ch
# @copyright: EPFL-IC-LCAV 2015
from unittest import TestCase
import numpy as np
import pyroomacoustics as pra
fs = 8000
t0 = 0.
absorption = 0.90
max_order_sim = 2
sigma2_n = 5e-7
cor... |
open-power-host-os/builds | refs/heads/master | lib/packages_manager.py | 3 | # Copyright (C) IBM Corp. 2016.
#
# 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 in the... |
kubaszostak/gdal-dragndrop | refs/heads/master | osgeo/apps/Python27/Lib/encodings/koi8_u.py | 93 | """ Python Character Mapping Codec koi8_u generated from 'python-mappings/KOI8-U.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input... |
LEPT-Development/Android_kernel_lge_C50 | refs/heads/cm-12.1 | drivers/staging/prima/zone.py | 12 | class Zone:
def __init__(self, zone_name = "", country_list=[], db_string=""):
self.name = zone_name
self.country_list = country_list
self.db_string = db_string
def write_file(self, f):
f.write("#\n")
f.write("# Domain : %s\n" % self.name)
f.write("#\n")... |
drobilla/pugl | refs/heads/master | waflib/extras/erlang.py | 39 | #!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)
# Przemyslaw Rzepecki, 2016
"""
Erlang support
"""
import re
from waflib import Task, TaskGen
from waflib.TaskGen import feature, after_method, before_method
# to load the method "to_incnodes" below
from waflib.Tools import ccroot
# Those flags are re... |
schleichdi2/OpenNfr_E2_Gui-6.0 | refs/heads/master | lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py | 50 | from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.HelpMenu import HelpableScreen
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
from Components.FileList import FileList
from Tools.Directories import fileExists, resolveFilename, SCOP... |
pbougue/navitia | refs/heads/dev | source/tyr/migrations/versions/3131d5bf5570_add_full_sn_geometries_on_instances.py | 5 | """add full_sn_geometries on instances for managing geometries in ed2nav
Revision ID: 3131d5bf5570
Revises: 162b4fa5836a
Create Date: 2016-08-22 13:55:00.870197
"""
# revision identifiers, used by Alembic.
revision = '3131d5bf5570'
down_revision = '162b4fa5836a'
from alembic import op
import sqlalchemy as sa
def ... |
twiest/openshift-tools | refs/heads/stg | openshift/installer/vendored/openshift-ansible-3.5.91/roles/lib_openshift/src/class/oc_adm_ca_server_cert.py | 8 | # pylint: skip-file
# flake8: noqa
class CAServerCertConfig(OpenShiftCLIConfig):
''' CAServerCertConfig is a DTO for the oc adm ca command '''
def __init__(self, kubeconfig, verbose, ca_options):
super(CAServerCertConfig, self).__init__('ca', None, kubeconfig, ca_options)
self.kubeconfig = kube... |
douggeiger/gnuradio | refs/heads/master | gr-digital/python/digital/qa_hdlc_framer.py | 47 | #!/usr/bin/env python
#
# Copyright 2006,2007,2010,2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, ... |
cataliniordache/Human-Computer-Interaction-Project | refs/heads/master | RestfulServices/flask/lib/python2.7/site-packages/sqlparse/keywords.py | 58 | from sqlparse import tokens
KEYWORDS = {
'ABORT': tokens.Keyword,
'ABS': tokens.Keyword,
'ABSOLUTE': tokens.Keyword,
'ACCESS': tokens.Keyword,
'ADA': tokens.Keyword,
'ADD': tokens.Keyword,
'ADMIN': tokens.Keyword,
'AFTER': tokens.Keyword,
'AGGREGATE': tokens.Keyword,
'ALIAS': to... |
UMWRG/HydraPlatform | refs/heads/master | HydraLib/python/HydraLib/PluginLib/plugin.py | 2 | # (c) Copyright 2013, 2014, University of Manchester
#
# HydraLib 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 3 of the License, or
# (at your option) any later version.
#
# HydraPlatf... |
benschulz/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/pywebsocket/src/example/close_wsh.py | 495 | # Copyright 2012, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
partofthething/home-assistant | refs/heads/dev | homeassistant/util/dt.py | 4 | """Helper methods to handle the time in Home Assistant."""
import datetime as dt
import re
from typing import Any, Dict, List, Optional, Union, cast
import ciso8601
import pytz
import pytz.exceptions as pytzexceptions
import pytz.tzinfo as pytzinfo
from homeassistant.const import MATCH_ALL
DATE_STR_FORMAT = "%Y-%m-%... |
Maistho/CouchPotatoServer | refs/heads/master | libs/chardet/big5freq.py | 3132 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... |
wbyne/QGIS | refs/heads/master | scripts/qgis_fixes/fix_future_standard_library.py | 77 | from libfuturize.fixes.fix_future_standard_library import FixFutureStandardLibrary
|
arthurdk/gk-analysis | refs/heads/master | GKCLIParser.py | 1 | import argparse
class GKCLIParser:
def __init__(self):
self.DEFAULT_NB_PAGE = 10
def do_parse_args(self):
# TODO Make this parsing GREAT again
parser = argparse.ArgumentParser(description='Perform analysis on Gamekult reviews.',
formatter_class... |
rlr/fjord | refs/heads/master | vendor/packages/translate-toolkit/translate/search/indexing/PyLuceneIndexer.py | 3 | # -*- coding: utf-8 -*-
#
# Copyright 2008 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 y... |
SunghanKim/numpy | refs/heads/master | benchmarks/benchmarks/bench_ufunc.py | 29 | from __future__ import absolute_import, division, print_function
from .common import Benchmark, squares_
import numpy as np
ufuncs = ['abs', 'absolute', 'add', 'arccos', 'arccosh', 'arcsin',
'arcsinh', 'arctan', 'arctan2', 'arctanh', 'bitwise_and',
'bitwise_not', 'bitwise_or', 'bitwise_xor', 'cb... |
sunny414/tryton-client | refs/heads/master | tryton/gui/window/limit.py | 2 | #This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import sys
import gtk
import gettext
from tryton.config import TRYTON_ICON, CONFIG
from tryton.common import get_toplevel_window
_ = gettext.gettext
class Limit(object):
'... |
smartfile/django-1.4 | refs/heads/master | tests/regressiontests/wsgi/wsgi.py | 736 | # This is just to test finding, it doesn't have to be a real WSGI callable
application = object()
|
LubyRuffy/pr0bescan | refs/heads/master | plugins/webscript.py | 2 | #/usr/bin/env python
#coding=utf-8
from re import search
from libs.core.network import head,get
from libs.core.common import logging,runtime
from libs.core.common import print_color
log = logging.getLogger(__name__)
def output(target):
powereds = [{'type':'ASP/ASPX','str':'ASP.NET'}, {'type':'PHP','str... |
beck/django | refs/heads/master | django/template/__init__.py | 198 | """
Django's support for templates.
The django.template namespace contains two independent subsystems:
1. Multiple Template Engines: support for pluggable template backends,
built-in backends and backend-independent APIs
2. Django Template Language: Django's own template engine, including its
built-in loaders, ... |
tedye/leetcode | refs/heads/master | tools/leetcode.152.Maximum Product Subarray/leetcode.152.Maximum Product Subarray.submission0.py | 1 | class Solution(object):
def maxProduct(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums: return 0
maxPositive = 1
maxNegative = 1
m = nums[0]
for i in nums:
temp = maxPositive
maxPositive = max(i, max(i... |
cuongthai/cuongthai-s-blog | refs/heads/master | blog/utils.py | 5 | import re
_NORMALIZE = re.compile(r'\W+', re.UNICODE)
def slugify(text):
"""A unicode-aware alternative to Django's slugify"""
return _NORMALIZE.sub('-', text.lower()).strip('-')
|
qedsoftware/commcare-hq | refs/heads/master | corehq/apps/reports/formdetails/readable.py | 1 | from pydoc import html
from django.http import Http404
from django.utils.safestring import mark_safe
from corehq.apps.app_manager.exceptions import XFormException
from corehq.util.timezones.conversions import PhoneTime
from corehq.util.timezones.utils import get_timezone_for_request
from dimagi.ext.jsonobject import *
... |
xurubin/aurasium | refs/heads/master | pyAPKRewriter/src/Rewriter.py | 1 | '''
Created on Aug 19, 2011
@author: rubin
'''
import re
import sys, os
from DexType import *
from SmaliParser import dalvikMethodDeclaration
Java_Prototype_ClassName = "APIHook"
def genInvokeCommand(kind, arglist, method):
if method.hasImplicitThisPtr:
assert len(arglist) == method.getArgumentsRegCount(... |
FacundoAcevedo/gondolero | refs/heads/master | gondolero/web/views.py | 1 | from django.core.urlresolvers import reverse_lazy, reverse
from django.http import HttpResponseRedirect
from django.utils import timezone
from django.views import generic
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import ... |
firebase/firebase-ios-sdk | refs/heads/master | Firebase/CoreDiagnostics/ProtoSupport/nanopb_proto_generator.py | 4 | #!/usr/bin/env python
# Copyright 2019 Google
#
# 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 agr... |
sigmunau/nav | refs/heads/master | python/nav/smidumps/cisco_envmon_mib.py | 4 | # python version 1.0 DO NOT EDIT
#
# Generated by smidump version 0.4.8:
#
# smidump -f python CISCO-ENVMON-MIB
FILENAME = "./CISCO-ENVMON-MIB.my"
MIB = {
"moduleName" : "CISCO-ENVMON-MIB",
"CISCO-ENVMON-MIB" : {
"nodetype" : "module",
"language" : "SMIv2",
"organization" : ... |
siddhika1889/Pydev-Dependencies | refs/heads/master | pysrc/tests_mainloop/gui-wx.py | 54 | #!/usr/bin/env python
"""
A Simple wx example to test PyDev's event loop integration.
To run this:
1) Enable the PyDev GUI event loop integration for wx
2) do an execfile on this script
3) ensure you have a working GUI simultaneously with an
interactive console
Ref: Modified from wxPython source code wxPython/samp... |
kronicz/ecommerce-2 | refs/heads/master | lib/python2.7/site-packages/django/contrib/messages/__init__.py | 741 | from django.contrib.messages.api import * # NOQA
from django.contrib.messages.constants import * # NOQA
default_app_config = 'django.contrib.messages.apps.MessagesConfig'
|
cnsoft/kbengine-cocos2dx | refs/heads/cocos2dx-cnsoft | kbe/res/scripts/common/Lib/encodings/cp862.py | 272 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP862.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
... |
ficristo/brackets-shell | refs/heads/master | gyp/pylib/gyp/common.py | 18 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import with_statement
import collections
import errno
import filecmp
import os.path
import re
import tempfile
import sys
# A minimal memoizing d... |
EcmaXp/micropython | refs/heads/opencom | tests/misc/recursive_data.py | 52 | # This tests that printing recursive data structure doesn't lead to segfault.
import _io as io
l = [1, 2, 3, None]
l[-1] = l
try:
print(l, file=io.StringIO())
except RuntimeError:
print("RuntimeError")
|
pscholz/presto | refs/heads/master | lib/python/binary_psr.py | 2 | import numpy as Num
import parfile, psr_utils
from psr_constants import *
def myasarray(a):
if type(a) in [type(1.0),type(1L),type(1),type(1j)]:
a = Num.asarray([a])
if len(a) == 0:
a = Num.asarray([a])
return a
def shapR(m2):
"""
shapR(m2):
Return the Shapiro 'R' parameter... |
pipeflo/php-moodle-buildpack | refs/heads/master | tests/test_rewrite.py | 10 | import os
import os.path
import tempfile
import shutil
import subprocess
import imp
from nose.tools import eq_
class BaseRewriteScript(object):
def __init__(self):
info = imp.find_module('runner', ['lib/build_pack_utils'])
self.run = imp.load_module('runner', *info)
def setUp(self):
s... |
liguifan/Machine-Learning-Research | refs/heads/master | src/adaboost/model_rewriter.py | 1 | '''
model_reader provides methods to extract weights from the adaboostSAMME model
and rewrite them in a format suitable for initializing neural networks. It
pickles a list that contains weights of the neural network layer by layer.
'''
import argparse
import cPickle as pickle
import numpy as np
def write_weights(ada... |
schleichdi2/openpli-e2 | refs/heads/master | lib/python/Tools/Event.py | 61 |
class Event:
def __init__(self, start = None, stop = None):
self.list = [ ]
self.start = start
self.stop = stop
def __call__(self, *args, **kwargs):
for x in self.list:
x(*args, **kwargs)
def listen(self, fnc):
was_empty = len(self.list) == 0
self.list.append(fnc)
if was_empty:
if self.start:
... |
auntieNeo/asterisk | refs/heads/app_bla | contrib/ast-db-manage/config/versions/a541e0b5e89_add_pjsip_max_initial_qualify_time.py | 6 | """add pjsip max_initial_qualify_time
Revision ID: a541e0b5e89
Revises: 461d7d691209
Create Date: 2015-04-15 14:37:36.424471
"""
# revision identifiers, used by Alembic.
revision = 'a541e0b5e89'
down_revision = '461d7d691209'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('ps_globa... |
rasata/ansible | refs/heads/devel | lib/ansible/plugins/connections/__init__.py | 39 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2015 Toshio Kuratomi <tkuratomi@ansible.com>
#
# 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... |
40223211/logo-toys | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/unittest/runner.py | 637 | """Running tests"""
import sys
import time
import warnings
from . import result
from .signals import registerResult
__unittest = True
class _WritelnDecorator(object):
"""Used to decorate file-like objects with a handy 'writeln' method"""
def __init__(self,stream):
self.stream = stream
def __ge... |
2013Commons/HUE-SHARK | refs/heads/master | desktop/core/ext-py/Babel-0.9.6/build/lib.linux-i686-2.7/babel/messages/jslexer.py | 128 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists of v... |
MateuszG/django_auth | refs/heads/master | examples/test_fixture_cleandir.py | 2 | import pytest; import tempfile; import os
@pytest.fixture()
def cleandir():
newpath = tempfile.mkdtemp() # '/tmp/tmpKUnnz2'
os.chdir(newpath)
@pytest.mark.usefixtures("cleandir")
class TestDirectoryInit:
def test_cwd_starts_empty(self):
assert os.listdir(os.getcwd()) == []
with open("myf... |
storm-computers/odoo | refs/heads/9.0 | addons/website_form/__init__.py | 3964 | import controllers
import models
|
xyuanmu/XX-Net | refs/heads/master | python3.8.2/Lib/site-packages/setuptools/command/bdist_rpm.py | 1049 | import distutils.command.bdist_rpm as orig
class bdist_rpm(orig.bdist_rpm):
"""
Override the default bdist_rpm behavior to do the following:
1. Run egg_info to ensure the name and version are properly calculated.
2. Always run 'install' using --single-version-externally-managed to
disable eggs... |
charleswhchan/ansible | refs/heads/devel | contrib/inventory/nsot.py | 52 | #!/bin/env python
'''
nsot
====
Ansible Dynamic Inventory to pull hosts from NSoT, a flexible CMDB by Dropbox
Features
--------
* Define host groups in form of NSoT device attribute criteria
* All parameters defined by the spec as of 2015-09-05 are supported.
+ ``--list``: Returns JSON hash of host groups -> ho... |
fnordahl/nova | refs/heads/master | nova/tests/unit/api/ec2/test_middleware.py | 19 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
MediaMath/Diamond | refs/heads/master | src/collectors/smart/smart.py | 8 | # coding=utf-8
"""
Collect data from S.M.A.R.T.'s attribute reporting.
#### Dependencies
* [smartmontools](http://sourceforge.net/apps/trac/smartmontools/wiki)
"""
import diamond.collector
import subprocess
import re
import os
from diamond.collector import str_to_bool
class SmartCollector(diamond.collector.Coll... |
ezrover/pjsip-2.3 | refs/heads/master | tests/pjsua/scripts-sendto/159_no_rport_nit.py | 42 | # $Id$
import inc_sip as sip
import inc_sdp as sdp
# Ticket http://trac.pjsip.org/repos/ticket/718
# RTC doesn't put rport in Via, and it is reported to have caused segfault.
#
complete_msg = \
"""MESSAGE sip:localhost SIP/2.0
Via: SIP/2.0/UDP localhost:$LOCAL_PORT;branch=z9hG4bK$BRANCH
From: <sip:tester@localhost>;ta... |
edxnercel/edx-platform | refs/heads/master | openedx/core/lib/api/__init__.py | 199 | """
Package for common functionality shared across various APIs.
"""
|
ahmedaljazzar/edx-platform | refs/heads/master | lms/djangoapps/commerce/api/v1/tests/test_serializers.py | 13 | """ Commerce API v1 serializer tests. """
from django.test import TestCase
from ..serializers import serializers, validate_course_id
class CourseValidatorTests(TestCase):
""" Tests for Course Validator method. """
shard = 4
def test_validate_course_id_with_non_existent_course(self):
""" Verify a... |
RobertoMalatesta/phantomjs | refs/heads/master | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/commands/abstractlocalservercommand.py | 124 | # Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... |
MaplePlan/djwp | refs/heads/master | django/contrib/staticfiles/management/commands/collectstatic.py | 19 | from __future__ import unicode_literals
import os
import sys
from optparse import make_option
from django.core.files.storage import FileSystemStorage
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.encoding import smart_text
from django.utils.datastructures import SortedDict
from... |
collective/collective.taghelper | refs/heads/master | collective/taghelper/evri.py | 2 | import urllib, urllib2
try:
from xml.etree.ElementTree import XML
except ImportError:
from elementtree.ElementTree import XML
class Evri(object):
url = 'http://api.evri.com/v1/media/entities'
def __init__(self, api_key, relevance = 1.0):
self.api_key = api_key
self.relevance = releva... |
eersoy93/gonullu-gui | refs/heads/master | setup.py | 1 | #
# Gonullu GUI setup script
#
# Copyright 2017 Erdem Ersoy (erdemersoy@live.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) a... |
Micronaet/micronaet-addons-private | refs/heads/master | intervention_telegram/__openerp__.py | 1 | #!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<https://micronaet.com>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebr... |
dakcarto/QGIS | refs/heads/master | python/plugins/db_manager/dlg_import_vector.py | 7 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : Oct 13, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@... |
uberamd/NGECore2 | refs/heads/master | scripts/object/mobile/dressed_bh_male_rodian_01.py | 85615 | import sys
def setup(core, object):
return |
jk1/intellij-community | refs/heads/master | python/helpers/py2only/docutils/languages/ca.py | 148 | # $Id: ca.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: Ivan Vilata i Balaguer <ivan@selidor.net>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
# tra... |
sam-geek/mbed | refs/heads/master | workspace_tools/host_tests/example/MulticastSend.py | 129 | """
mbed SDK
Copyright (c) 2011-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 law or agreed to in wr... |
acfogarty/espressopp | refs/heads/master | testsuite/tabulated/polymer_melt_tabulated.py | 2 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################################
# ESPResSo++ #
# Test script for Tabulated potentials (LJ, FENE, Cosine) #
# ... |
miguelparaiso/PracticaOdoo | refs/heads/master | addons/account_payment/report/__init__.py | 436 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.