repo_name
stringlengths
5
100
ref
stringlengths
12
67
path
stringlengths
4
244
copies
stringlengths
1
8
content
stringlengths
0
1.05M
⌀
barrachri/epcon
refs/heads/develop
p3/management/commands/p3_ticket_badge.py
7
# -*- coding: UTF-8 -*- from datetime import datetime, timedelta from optparse import make_option from django.core.management.base import BaseCommand, CommandError from django.db.models import Q from conference import models from conference import utils class Command(BaseCommand): """ """ option_list = B...
valkyriesavage/gasustainability
refs/heads/master
django/utils/simplejson/__init__.py
324
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`simplejson` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of ...
tbepler/rnn
refs/heads/master
rnn/layers/lstm.py
1
import ctypes import numpy as np import math import rnn.kernel as algo import rnn.initializers as init class LSTM(object): def __init__(self, input_size, output_size, forget_bias=3, tau=float('inf') , initializer = init.xavier): self.inputs = input_size self.outputs = output_size...
gayathma/footballs
refs/heads/master
vendor/psy/psysh/test/tools/gen_unvis_fixtures.py
536
#! /usr/bin/env python3 import sys from os.path import abspath, expanduser, dirname, join from itertools import chain import json import argparse from vis import vis, unvis, VIS_WHITE __dir__ = dirname(abspath(__file__)) OUTPUT_FILE = join(__dir__, '..', 'fixtures', 'unvis_fixtures.json') # Add custom fixtures her...
sosreport/sos
refs/heads/master
sos/report/plugins/bcache.py
4
# Copyright (C) 2021, Canonical ltd # Ponnuvel Palaniyappan <ponnuvel.palaniyappan@canonical.com> # This file is part of the sos project: https://github.com/sosreport/sos # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of ...
ojake/django
refs/heads/master
tests/utils_tests/test_module_loading.py
281
import imp import os import sys import unittest from importlib import import_module from zipimport import zipimporter from django.test import SimpleTestCase, modify_settings from django.test.utils import extend_sys_path from django.utils import six from django.utils._os import upath from django.utils.module_loading im...
neske/aurora-p2pool
refs/heads/master
p2pool/p2p.py
147
from __future__ import division import math import random import sys import time from twisted.internet import defer, protocol, reactor from twisted.python import failure, log import p2pool from p2pool import data as p2pool_data from p2pool.bitcoin import data as bitcoin_data from p2pool.util import deferral, p2proto...
alaski/nova
refs/heads/master
nova/api/openstack/compute/multinic.py
6
# Copyright 2011 OpenStack Foundation # 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 requ...
40223136/w11-2
refs/heads/master
static/Brython3.1.1-20150328-091302/Lib/urllib/parse.py
735
"""Parse (absolute and relative) URLs. urlparse module is based upon the following RFC specifications. RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding and L. Masinter, January 2005. RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter and L.Masinter, Decemb...
cyberark-bizdev/ansible
refs/heads/devel
lib/ansible/modules/windows/win_audit_rule.py
23
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Noah Sparks <nsparks@outlook.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': ...
morrislab/phylowgs
refs/heads/master
parser/test/util/munge_positions.py
1
from collections import defaultdict import random import sys def chrom_key(chrom): chrom = chrom.lower() if chrom.isdigit(): return int(chrom) elif chrom == 'x': return 101 elif chrom == 'y': return 102 else: return 999 def main(): variants = defaultdict(list) for line in sys.stdin: ...
etzhou/edx-platform
refs/heads/master
pavelib/paver_tests/test_paver_quality.py
72
""" Tests for paver quality tasks """ import os from path import Path as path import tempfile import unittest from mock import patch, MagicMock, mock_open from ddt import ddt, file_data import pavelib.quality import paver.easy import paver.tasks from paver.easy import BuildFailure @ddt class TestPaverQualityViolatio...
stynr/diaphora
refs/heads/master
pygments/lexers/_cocoa_builtins.py
23
# -*- coding: utf-8 -*- """ pygments.lexers._cocoa_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This file defines a set of types used across Cocoa frameworks from Apple. There is a list of @interfaces, @protocols and some other (structs, unions) File may be also used as standalone generator for aboves...
2013Commons/HUE-SHARK
refs/heads/master
desktop/core/ext-py/Django-1.2.3/build/lib.linux-i686-2.7/django/contrib/localflavor/uy/util.py
504
# -*- coding: utf-8 -*- def get_validation_digit(number): """ Calculates the validation digit for the given number. """ sum = 0 dvs = [4, 3, 6, 7, 8, 9, 2] number = str(number) for i in range(0, len(number)): sum = (int(number[-1 - i]) * dvs[i] + sum) % 10 return (10-sum) % 10
wyc/django
refs/heads/master
tests/m2m_regress/tests.py
273
from __future__ import unicode_literals from django.core.exceptions import FieldError from django.test import TestCase from django.utils import six from .models import ( Entry, Line, Post, RegressionModelSplit, SelfRefer, SelfReferChild, SelfReferChildSibling, Tag, TagCollection, Worksheet, ) class M2MRegre...
tri2sing/LinearAlgebraPython
refs/heads/master
hw2.py
1
# version code 761 # Please fill out this stencil and submit using the provided submission script. from GF2 import one from vec import Vec from vec import scalar_mul from itertools import combinations ## Problem 1 def vec_select(veclist, k): ''' >>> D = {'a','b','c'} >>> v1 = Vec(D, {'a': 1}) >>> v2...
rayleigh0407/Hackathon-Bot
refs/heads/master
zhconv/zhconv.py
1
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module implements a simple conversion and localization between simplified and traditional Chinese using tables from MediaWiki. It doesn't contains a segmentation function and uses maximal forward matching, so it's simple. For a complete and accurate solution, see O...
tafia/servo
refs/heads/master
tests/wpt/web-platform-tests/tools/pywebsocket/src/mod_pywebsocket/common.py
489
# 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...
calfonso/ansible
refs/heads/devel
lib/ansible/plugins/callback/junit.py
22
# (c) 2016 Matt Clay <matt@mystile.com> # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' callback: junit type: aggregate short_...
myang321/django
refs/heads/master
django/core/validators.py
99
from __future__ import unicode_literals import re from django.core.exceptions import ValidationError from django.utils import six from django.utils.deconstruct import deconstructible from django.utils.encoding import force_text from django.utils.ipv6 import is_valid_ipv6_address from django.utils.six.moves.urllib.par...
rzr/iotivity
refs/heads/master
test/test_manager/xml_reporter.py
2
#!/usr/bin/python3 ''' /****************************************************************** * * Copyright 2018 Samsung Electronics 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...
ProjectSWGCore/NGECore2
refs/heads/master
scripts/object/tangible/tcg/series4/instant_travel_terminal_home.py
85615
import sys def setup(core, object): return
13xforever/webserver
refs/heads/master
qa/301-XForwardedFor-4.py
5
from base import * DIR = "x_forwarded_for_cgi_4" REMOTE_IP = "::1" CONF = """ vserver!1!rule!3010!match = directory vserver!1!rule!3010!match!directory = /%s vserver!1!rule!3010!handler = cgi vserver!1!rule!3010!handler!x_real_ip_enabled = 1 vserver!1!rule!3010!handler!x_real_ip_access_all = 0 vserver!1!rule!30...
sperka/shogun
refs/heads/develop
examples/undocumented/python_modular/stochasticgbmachine_modular.py
21
#!/usr/bin/env python import numpy as np traindat = '../../../data/uci/housing/fm_housing.dat' label_traindat = '../../../data/uci/housing/housing_label.dat' # set both input attributes as nominal (True) / continuous (False) feat_types=np.array([False,False,False,True,False,False,False,False,False,False,False,False,F...
Alkemic/webpage
refs/heads/master
module/about/views.py
1
# -*- coding: utf-8 -*- from smtplib import SMTPException from socket import error from django.contrib import messages from django.core.mail.message import EmailMessage from django.core.urlresolvers import reverse_lazy from django.utils.translation import ugettext_lazy as _ from django.views.generic.edit import FormVi...
Maccimo/intellij-community
refs/heads/master
python/testData/override/innerClass_after.py
83
class X(object): def foo(self): pass class A: class Inner(X): def foo(self): <selection>super(A.Inner, self).foo()</selection> def doStuff(self, foo=True): pass class B(A): def otherMethod(self, foo, bar): print foo, bar
kisna72/django
refs/heads/master
tests/get_or_create/models.py
55
from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Person(models.Model): first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) birthday = models.DateFiel...
koyuawsmbrtn/eclock
refs/heads/master
windows/Python27/Lib/encodings/mac_romanian.py
593
""" Python Character Mapping Codec mac_romanian generated from 'MAPPINGS/VENDORS/APPLE/ROMANIAN.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,inp...
ThirdProject/android_external_chromium_org
refs/heads/cm-11.0
third_party/tlslite/tlslite/utils/AES.py
407
"""Abstract class for AES.""" class AES: def __init__(self, key, mode, IV, implementation): if len(key) not in (16, 24, 32): raise AssertionError() if mode != 2: raise AssertionError() if len(IV) != 16: raise AssertionError() self.isBlockCipher = ...
rosudrag/Freemium-winner
refs/heads/master
VirtualEnvironment/Lib/site-packages/flask_openid.py
1
# -* coding: utf-8 -*- """ flaskext.openid ~~~~~~~~~~~~~~~ Tiny wrapper around python-openid to make working with the basic API in a theflasktest application easier. Adapt this code for your own project if necessary. :copyright: (c) 2010 by Armin Ronacher. :license: BSD, see LICENSE for m...
tbphu/fachkurs_bachelor
refs/heads/master
PythonIntro/20171103_PythonTest.py
3
import numpy as np import inspect import pickle # from itertools import ifilter class PythonTest: def __init__(self, solpath): pickle_in = open(solpath,"rb") self.sol = pickle.load(pickle_in) def test_01(self): print('--------------------------------------------') print('Frage ...
Memendia/HippieStation
refs/heads/master
tools/mapmerge2/frontend.py
86
# Common code for the frontend interface of map tools import sys import os import pathlib import shutil from collections import namedtuple Settings = namedtuple('Settings', ['map_folder', 'tgm']) MapsToRun = namedtuple('MapsToRun', ['files', 'indices']) def string_to_num(s): try: return int(s) except ...
xlk521/cloudguantou
refs/heads/master
django/contrib/auth/management/commands/changepassword.py
320
from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User import getpass class Command(BaseCommand): help = "Change a user's password for django.contrib.auth." requires_model_validation = False def _get_pass(self, prompt="Password: "): p = getpa...
lootr/netzob
refs/heads/next
netzob/src/netzob/Inference/Vocabulary/FormatOperations/__init__.py
54
#!/usr/bin/env python # -*- coding: utf-8 -*- #+---------------------------------------------------------------------------+ #| 01001110 01100101 01110100 01111010 01101111 01100010 | #| | #| Netzob : Inferring ...
tomchristie/django
refs/heads/master
django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py
14
from django.apps import apps from django.contrib.contenttypes.models import ContentType from django.core.management import BaseCommand from django.db import DEFAULT_DB_ALIAS, router from django.db.models.deletion import Collector from ...management import get_contenttypes_and_models class Command(BaseCommand): ...
frreiss/tensorflow-fred
refs/heads/master
tensorflow/python/keras/saving/saved_model/json_utils.py
4
# Copyright 2020 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...
ToxicFrog/lancow
refs/heads/master
madcow/protocol/cli.py
8
# Copyright (C) 2007, 2008 Christopher Jones # # This file is part of Madcow. # # Madcow 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...
unnikrishnankgs/va
refs/heads/master
venv/lib/python3.5/site-packages/pygments/lexer.py
27
# -*- coding: utf-8 -*- """ pygments.lexer ~~~~~~~~~~~~~~ Base lexer classes. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import print_function import re import sys import time from pygments.filter import apply_f...
jordiblasco/easybuild-easyblocks
refs/heads/master
easybuild/easyblocks/n/numpy.py
10
## # Copyright 2009-2015 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), # the Hercules foundation (htt...
BerserkerTroll/root
refs/heads/master
interpreter/llvm/src/examples/Kaleidoscope/MCJIT/cached/split-lib.py
108
#!/usr/bin/env python class TimingScriptGenerator: """Used to generate a bash script which will invoke the toy and time it""" def __init__(self, scriptname, outputname): self.shfile = open(scriptname, 'w') self.timeFile = outputname self.shfile.write("echo \"\" > %s\n" % self.timeFile) ...
synedge/graphite-web
refs/heads/master
webapp/tests/test_browser.py
35
# -*- coding: utf-8 -*- import json import os from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase from django.test.utils import override_settings from . import DATA_DIR class BrowserTest(TestCase): def test_browser(self): url = revers...
Azure/azure-sdk-for-python
refs/heads/sync-eng/common-js-nightly-docs-2-1768-ForTestPipeline
sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py
1
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
RzeroD/electrum-server
refs/heads/master
run_electrum_server.py
1
#!/usr/bin/env python # Copyright(C) 2011-2016 Thomas Voegtlin # # 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, m...
xianjunzhengbackup/Cloud-Native-Python
refs/heads/master
env/lib/python3.5/site-packages/pip/_vendor/distlib/compat.py
335
# -*- coding: utf-8 -*- # # Copyright (C) 2013-2016 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from __future__ import absolute_import import os import re import sys try: import ssl except ImportError: ssl = None if sys.ve...
adityaduggal/erpnext
refs/heads/develop
erpnext/patches/v4_2/fix_gl_entries_for_stock_transactions.py
28
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import print_function, unicode_literals import frappe from frappe.utils import flt def execute(): from erpnext.stock.stock_balance import repost repost(allow_zero_rate=True,...
chongtianfeiyu/kbengine
refs/heads/master
kbe/src/lib/python/Lib/encodings/cp865.py
272
""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP865.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'): ...
apahim/avocado-misc-tests
refs/heads/master
toolchain/gsl.py
1
#!/usr/bin/env python # 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 ...
strongswan/swidGenerator
refs/heads/master
swid_generator/signature_template.py
3
SIGNATURE = '<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">' \ '<SignedInfo>' \ '<CanonicalizationMethod Algorithm="http://www.w3.org/2006/12/xml-c14n11"/>' \ '<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>' \ '<Reference>' \ ...
ychen820/microblog
refs/heads/master
y/google-cloud-sdk/platform/google_appengine/lib/django-0.96/django/template/__init__.py
32
""" This is the Django template system. How it works: The Lexer.tokenize() function converts a template string (i.e., a string containing markup with custom template tags) to tokens, which can be either plain text (TOKEN_TEXT), variables (TOKEN_VAR) or block statements (TOKEN_BLOCK). The Parser() class takes a list ...
nischalsheth/contrail-controller
refs/heads/master
src/config/utils/db-loader/contrail_db_loader/resources/virtual_network.py
5
# -*- coding: utf-8 -*- # # Copyright (c) 2016 Juniper Networks, Inc. All rights reserved. # from __future__ import unicode_literals import logging from netaddr import IPNetwork, IPAddress from six import text_type import uuid from .resource import Resource from ..utils import timeit from cfgm_common.exceptions impor...
ITA-ftuyama/TG
refs/heads/master
test/tests.py
2
from mindwave.parser import ThinkGearParser, TimeSeriesRecorder import unittest class ParserTests(unittest.TestCase): def testParser(self): s = file("baseline.bytes").read() ts_recorder = TimeSeriesRecorder() parser = ThinkGearParser(recorders=[ts_recorder]) parser.feed(s) self.assertTrue(len...
agoose77/hivesystem
refs/heads/master
tutorial/layers/layer8/action3drones.py
16
import somelibrary import bee import libcontext from libcontext.socketclasses import * from libcontext.pluginclasses import * class animationmanager(bee.drone): def __init__(self): self.animations = {} def add_animation(self, identifier, animation): self.animations[identifier] = animation ...
topic2k/EventGhost
refs/heads/master
plugins/EventGhost/NewJumpIf.py
1
# -*- coding: utf-8 -*- # # This file is part of EventGhost. # Copyright © 2005-2019 EventGhost Project <http://www.eventghost.org/> # # EventGhost 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 versio...
Jenselme/servo
refs/heads/master
tests/wpt/css-tests/tools/pywebsocket/src/mod_pywebsocket/_stream_base.py
652
# Copyright 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: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
the0forge/sp
refs/heads/master
frontend/formfields.py
1
# { 'selector' : (value, filterchain), ... } # e.g. { 'input#customer_name': (customer.name, 'upper|make_list|join:-x-') } def CustomerForm(obj): return { 'input#customer_id': (obj.id, None), 'input#customer_name': (obj.name, None), 'input#customer_type': (obj.customer_type, None), ...
WangWenjun559/Weiss
refs/heads/master
summary/sumy/sklearn/neighbors/tests/test_kd_tree.py
129
import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.kd_tree import (KDTree, NeighborsHeap, simultaneous_sort, kernel_norm, nodeheap_sort, DTYPE, ITYPE) from sklearn.neighbors.dist_metrics import Dista...
zofuthan/edx-platform
refs/heads/master
common/lib/xmodule/xmodule/html_checker.py
234
from lxml import etree def check_html(html): ''' Check whether the passed in html string can be parsed by lxml. Return bool success. ''' parser = etree.HTMLParser() try: etree.fromstring(html, parser) return True except Exception as err: pass return False
rfree2/cjdns
refs/heads/master
node_build/dependencies/libuv/build/gyp/pylib/gyp/simple_copy.py
1869
# Copyright 2014 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. """A clone of the default copy.deepcopy that doesn't handle cyclic structures or complex types except for dicts and lists. This is because gyp copies so large structur...
mancoast/CPythonPyc_test
refs/heads/master
cpython/234_test_robotparser.py
27
import unittest, StringIO, robotparser from test import test_support class RobotTestCase(unittest.TestCase): def __init__(self, index, parser, url, good, agent): unittest.TestCase.__init__(self) if good: self.str = "RobotTest(%d, good, %s)" % (index, url) else: self....
jrkerns/mpld3
refs/heads/master
mpld3/tests/test_figure.py
21
""" Test creation of a figure """ import matplotlib.pyplot as plt from .. import fig_to_dict from numpy.testing import assert_equal def test_basic_figure(): size = (8, 6) dpi = 80 fig = plt.figure(figsize=size, dpi=dpi) rep = fig_to_dict(fig) plt.close(fig) assert_equal(list(sorted(rep.keys()...
Alpistinho/FreeCAD
refs/heads/master
src/Mod/OpenSCAD/OpenSCAD2Dgeom.py
16
#*************************************************************************** #* * #* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> * #* * #* This pr...
KNU-shebang/Shebang
refs/heads/master
shebang/oneroom/tests.py
1
# coding: utf-8 from django.test import TestCase from oneroom.models import Room, Comment from account.models import User class RoomAndCommentModelTest(TestCase): def test_saving_and_retrieving_rooms(self): user_ = User() user_.email = "blacksangi@gmail.com" user_.save() room1 =...
ted-gould/nova
refs/heads/master
plugins/xenserver/networking/etc/xensource/scripts/vif_rules.py
113
#!/usr/bin/env python # Copyright 2010-2011 OpenStack Foundation # 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/LIC...
lambdan/video-analysis
refs/heads/master
bitrate.py
1
import os import subprocess from subprocess import check_output import sys import matplotlib.pyplot as plt from natsort import natsorted import time import datetime runtime = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") def to_hhmmss(sec): # https://thingspython.wordpress.com/2010/09/27/code-golf-converting-seco...
anuruddhal/jinja2
refs/heads/master
examples/basic/inheritance.py
83
from jinja2 import Environment from jinja2.loaders import DictLoader env = Environment(loader=DictLoader({ 'a': '''[A[{% block body %}{% endblock %}]]''', 'b': '''{% extends 'a' %}{% block body %}[B]{% endblock %}''', 'c': '''{% extends 'b' %}{% block body %}###{{ super() }}###{% endblock %}''' })) print env.get_te...
lucernae/geonode
refs/heads/master
geonode/contrib/geosites/api.py
17
# -*- coding: utf-8 -*- ######################################################################### # # Copyright (C) 2016 OSGeo # # 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 ...
cgar/servo
refs/heads/master
tests/wpt/css-tests/tools/pytest/_pytest/_code/code.py
168
import sys from inspect import CO_VARARGS, CO_VARKEYWORDS import py builtin_repr = repr reprlib = py.builtin._tryimport('repr', 'reprlib') if sys.version_info[0] >= 3: from traceback import format_exception_only else: from ._py2traceback import format_exception_only class Code(object): """ wrapper arou...
clemux/debsources
refs/heads/master
debsources/app/infobox.py
1
# Copyright (C) 2014 The Debsources developers <info@sources.debian.net>. # See the AUTHORS file at the top-level directory of this distribution and at # https://anonscm.debian.org/gitweb/?p=qa/debsources.git;a=blob;f=AUTHORS;hb=HEAD # # This file is part of Debsources. Debsources is free software: you can # redistrib...
gohin/django
refs/heads/master
tests/utils_tests/test_encoding.py
288
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import datetime import unittest from django.utils import six from django.utils.encoding import ( escape_uri_path, filepath_to_uri, force_bytes, force_text, iri_to_uri, smart_text, uri_to_iri, ) from django.utils.functional import SimpleLazyObje...
titom1986/CouchPotatoServer
refs/heads/develop
couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/rottentomatoes.py
41
from __future__ import unicode_literals from .videodetective import VideoDetectiveIE # It just uses the same method as videodetective.com, # the internetvideoarchive.com is extracted from the og:video property class RottenTomatoesIE(VideoDetectiveIE): _VALID_URL = r'https?://www\.rottentomatoes\.com/m/[^/]+/trai...
CybOXProject/python-cybox
refs/heads/master
cybox/bindings/cybox_common.py
1
# Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. import sys from mixbox.binding_utils import * #List delimiter value for lists captured in *ObjectPropertyTypes __LIST_DELIMITER__ = "##comma##" class DateWithPrecisionType(GeneratedsSuper): """This type is u...
h-2/seqan
refs/heads/feature/lambda
misc/seqan_instrumentation/bin/classes/requests/packages/oreos/monkeys.py
34
# -*- coding: utf-8 -*- """ oreos.monkeys ~~~~~~~~~~~~~ Monkeypatches. """ #!/usr/bin/env python # #### # Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu> # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software # and its documentation for any purpose and without...
zachjanicki/osf.io
refs/heads/develop
scripts/osfstorage/fix_oldel_migration.py
57
# -*- coding: utf-8 -*- """Nodes that were updated between the first run of migrate_from_oldels and the catchup run of migrate_from_oldels will have logs that were unmigrated because the _migrated_from_old_models flag was set during the first migration. """ import logging import sys from website.models import Node fro...
spring-week-topos/nova-week
refs/heads/spring-week
nova/scheduler/filters/aggregate_multitenancy_isolation.py
15
# Copyright (c) 2011-2013 OpenStack Foundation # 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 # # Un...
yask123/rockstar
refs/heads/master
examples/none_rockstar.py
22
from rockstar import RockStar # yup, there is a programming language called `none` # https://bitbucket.org/duangle/none # you better be a rockstar in none. none_code = """(none (print "Hello World") )""" rock_it_bro = RockStar(days=400, file_name='hello.n', code=none_code) rock_it_bro.make_me_a_rockstar()
crichardson17/starburst_atlas
refs/heads/master
Low_resolution_sims/DustFree_LowRes/Geneva_noRot_cont/Geneva_noRot_cont_age4/Optical1.py
33
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # --------------------------------------------------...
XianliangJ/collections
refs/heads/master
TCPTuner/mahimahi/client.py
3
#!/usr/bin/python import socket import sys import random import string import time import os import struct import thread SAVE_CWND = 1 TCP_CONGESTION = 13 ADDRESS = os.environ.get("MAHIMAHI_BASE") or "127.0.0.1" if len(sys.argv) != 3: print "usage: python server.py PORT TUNER" sys.exit(-1) PORT = int(sys.arg...
waldocollective/swiftwind
refs/heads/master
swiftwind/housemates/urls.py
2
from django.conf.urls import url from django.contrib import admin from . import views urlpatterns = [ url(r'^$', views.HousemateListView.as_view(), name='list'), url(r'^create/$', views.HousemateCreateView.as_view(), name='create'), url(r'^update/(?P<uuid>.+)/$', views.HousemateUpdateView.as_view(), name=...
michele-comitini/pydal
refs/heads/master
tests/_adapt.py
2
import os DEFAULT_URI = os.getenv('DB', 'sqlite:memory') NOSQL = any([name in DEFAULT_URI for name in ("datastore", "mongodb", "imap")]) IS_IMAP = "imap" in DEFAULT_URI IS_GAE = "datastore" in DEFAULT_URI IS_MONGODB = "mongodb" in DEFAULT_URI IS_POSTGRESQL = 'postgres' in DEFAULT_URI IS_SQLITE = 'sqlite' in DEFAULT_UR...
PetePriority/home-assistant
refs/heads/dev
homeassistant/components/geofency/__init__.py
1
""" Support for Geofency. For more details about this component, please refer to the documentation at https://home-assistant.io/components/geofency/ """ import logging import voluptuous as vol from aiohttp import web import homeassistant.helpers.config_validation as cv from homeassistant.components.device_tracker im...
neuesleben123/rt-thread
refs/heads/master
bsp/mb9bf506r/rtconfig.py
41
import os # toolchains options ARCH='arm' CPU='cortex-m3' CROSS_TOOL='iar' if os.getenv('RTT_CC'): CROSS_TOOL = os.getenv('RTT_CC') # cross_tool provides the cross compiler # EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = '...
jounex/hue
refs/heads/master
desktop/libs/librdbms/src/librdbms/urls.py
1198
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
willharris/django
refs/heads/master
tests/admin_inlines/tests.py
10
from __future__ import unicode_literals import datetime import warnings from django.contrib.admin import ModelAdmin, TabularInline from django.contrib.admin.helpers import InlineAdminForm from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase from django.contrib.auth.models import Permission, User from...
allancaffee/scaly-mongo
refs/heads/master
tests/acceptance/manage/test_ensure_indexes.py
1
import os import subprocess from tests.acceptance.base_acceptance_test import BaseAcceptanceTest import tests.acceptance.manage.ensure_indexes_documents def run_ensure_indexes(): """Run ensure_indexes.py with the example documents. """ os.environ['PYTHONPATH'] = os.getcwd() process_args = [ '...
readbeyond/aeneas
refs/heads/master
aeneas/syncmap/smfbase.py
5
#!/usr/bin/env python # coding=utf-8 # aeneas is a Python/C library and a set of tools # to automagically synchronize audio and text (aka forced alignment) # # Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it) # Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it) # Copyright (C) 2015-2017, A...
jsakamoto/selenium
refs/heads/master
py/test/selenium/webdriver/marionette/mn_launcher_tests.py
18
# Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
yunify/qingcloud-sdk-python
refs/heads/master
qingcloud/iaas/actions/sdwan.py
1
# ========================================================================= # Copyright 2012-present Yunify, Inc. # ------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this work except in compliance with the Licens...
bbozhev/flask-test
refs/heads/master
flask/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/_base.py
436
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type, string_types __all__ = ["DOCUMENT", "DOCTYPE", "TEXT", "ELEMENT", "COMMENT", "ENTITY", "UNKNOWN", "TreeWalker", "NonRecursiveTreeWalker"] from xml.dom import Node DOCUMENT = Node.DOCUMENT_NODE DOCTYPE...
5225225/27_programming_challenges
refs/heads/master
8.py
1
import time from datetime import datetime, date try: day, month, year = raw_input("Enter DOB formated day/month/year: ").split("/") except ValueError: print("Invalid date") try: DOB = datetime(int(year), int(month), int(day)) except ValueError: print("Invalid date") now = datetime.now() delta = now ...
AlphaSmartDog/DeepLearningNotes
refs/heads/master
Note-6 A3CNet/Note-6.1 simple A3CNet/sonnet/python/modules/embed.py
9
# Copyright 2017 The Sonnet Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Limags/MissionPlanner
refs/heads/master
Lib/chunk.py
65
"""Simple class to read IFF chunks. An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File Format)) has the following structure: +----------------+ | ID (4 bytes) | +----------------+ | size (4 bytes) | +----------------+ | data | | ... | +----------------+ The ID...
jart/tensorflow
refs/heads/master
tensorflow/python/keras/layers/convolutional.py
11
# 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...
nicolastrres/feature_report
refs/heads/master
tasks/tasks.py
1
from paver.easy import task, sh, call_task @task def run_server(): sh('python3 feature_reporter.py') @task def test_and_code_style(): call_task('flake8') call_task('unit_test') @task def unit_test(): sh('nosetests') @task def flake8(): sh('flake8')
B3QL/pep263
refs/heads/master
tests/conftest.py
1
"""Pytest fixtures and test helpers.""" import io from functools import partial from itertools import zip_longest import pytest @pytest.fixture def empty_file(): """Return file-like object without content.""" return io.StringIO() def create_file(*lines): """Inject file-like object containing provided l...
corruptnova/namebench
refs/heads/master
nb_third_party/dns/rdtypes/IN/AAAA.py
248
# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above copyright notice and this permission notice # appear in all copies. # # THE SOFTWARE IS PROVIDED ...
ondra-novak/chromium.src
refs/heads/nw
native_client_sdk/src/build_tools/sdk_tools/command/__init__.py
168
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Package for all sdk_update commands."""
anuruddhal/stratos
refs/heads/master
components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/tests/test_git.py
8
# 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...
emschorsch/scrapy
refs/heads/master
scrapy/http/cookies.py
24
from cookielib import CookieJar as _CookieJar, DefaultCookiePolicy from scrapy.utils.httpobj import urlparse_cached class CookieJar(object): def __init__(self, policy=None): self.jar = _CookieJar(policy or DefaultCookiePolicy()) self.jar._cookies_lock = _DummyLock() def extract_cookies(self, ...
glorpen/webassets
refs/heads/master
src/webassets/filter/coffeescript.py
19
from __future__ import print_function import os, subprocess from webassets.filter import Filter from webassets.exceptions import FilterError, ImminentDeprecationWarning __all__ = ('CoffeeScript',) class CoffeeScript(Filter): """Converts `CoffeeScript <http://jashkenas.github.com/coffee-script/>`_ to real J...
Buggaarde/youtube-dl
refs/heads/master
youtube_dl/extractor/morningstar.py
220
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor class MorningstarIE(InfoExtractor): IE_DESC = 'morningstar.com' _VALID_URL = r'https?://(?:www\.)?morningstar\.com/[cC]over/video[cC]enter\.aspx\?id=(?P<id>[0-9]+)' _TEST = { 'url': 'http://www.mo...