repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
authurlan/amdfin | refs/heads/develop | server/module/hasher.py | 1 | # -*- coding: utf-8 -*-
from Crypto.Hash import MD5
from Crypto.Hash import SHA256
class Hasher():
def __init__(self):
pass
def md5(self, message):
return MD5.new(message).hexdigest()
def sha256(self, message):
return SHA256.new(message).hexdigest()
# vim: set ts=4 sw=4 st... |
DickJC123/mxnet | refs/heads/master | python/mxnet/symbol/numpy/_symbol.py | 3 | # 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... |
yd0str/infernal-twin | refs/heads/master | build/pip/build/lib.linux-i686-2.7/pip/_vendor/lockfile/__init__.py | 475 | """
lockfile.py - Platform-independent advisory file locks.
Requires Python 2.5 unless you apply 2.4.diff
Locking is done on a per-thread basis instead of a per-process basis.
Usage:
>>> lock = LockFile('somefile')
>>> try:
... lock.acquire()
... except AlreadyLocked:
... print 'somefile', 'is locked already... |
qingpengchen2011/algorithm-study | refs/heads/master | algo-analyse/week6/2-sum/test_gen.py | 1 | a = [0] * 1000000; t = 0; modulus = 2 ** 24;
for i in xrange(1000000) :
t = (615949*t + 797807) % modulus
a[i] = t - modulus / 2
for i in (20,100,1000,10000,100000,1000000) :
fname = "sum2tc_%d.txt" % i
f = open(fname,"w")
for j in xrange(i) : f.write("%d\n" % a[j])
f.close()
|
ttglennhall/DjangoGirlsTutorial | refs/heads/master | myvenv/lib/python3.4/site-packages/django/conf/locale/sq/formats.py | 619 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'g.i.A'
# DA... |
maxamillion/ansible | refs/heads/devel | test/units/module_utils/basic/test_tmpdir.py | 35 | # -*- coding: utf-8 -*-
# Copyright (c) 2018 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
import shutil
import te... |
neumerance/cloudloon2 | refs/heads/master | .venv/lib/python2.7/site-packages/sphinx/websupport/search/whooshsearch.py | 5 | # -*- coding: utf-8 -*-
"""
sphinx.websupport.search.whooshsearch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Whoosh search adapter.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from whoosh import index
from whoosh.fields import Schema, ID... |
thomasf/offlineimap | refs/heads/master | docs/doc-src/conf.py | 9 | # -*- coding: utf-8 -*-
#
# pyDNS documentation build configuration file, created by
# sphinx-quickstart on Tue Feb 2 10:00:47 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... |
loic/django | refs/heads/master | tests/urlpatterns_reverse/included_app_urls.py | 405 | from django.conf.urls import url
from . import views
app_name = 'inc-app'
urlpatterns = [
url(r'^normal/$', views.empty_view, name='inc-normal-view'),
url(r'^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='inc-normal-view'),
url(r'^\+\\\$\*/$', views.empty_view, name='inc-special-vie... |
RobAltena/deeplearning4j | refs/heads/master | jumpy/jumpy/matlib.py | 2 | ################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless... |
xcstacy/kernel-N8000 | refs/heads/master | tools/perf/scripts/python/netdev-times.py | 11271 | # Display a process of packets and processed time.
# It helps us to investigate networking or network device.
#
# options
# tx: show only tx chart
# rx: show only rx chart
# dev=: show only thing related to specified device
# debug: work with debug mode. It shows buffer status.
import os
import sys
sys.path.append(os... |
joshpfosi/gbn | refs/heads/master | .waf-1.8.12-f00e5b53f6bbeab1384a38c9cc5d51f7/waflib/Node.py | 11 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import os,re,sys,shutil
from waflib import Utils,Errors
exclude_regs='''
**/*~
**/#*#
**/.#*
**/%*%
**/._*
**/CVS
**/CVS/**
**/.cvsignore
**/SCCS
**/SCCS/**
**/vssver.scc
**/.svn
**/.svn/**
**/BitKee... |
iguzu/gae-django | refs/heads/master | django/templatetags/i18n.py | 9 | import re
from django.template import Node, Variable, VariableNode, _render_value_in_context
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
from django.utils.encoding import force_unicode
register = Library()... |
blaggacao/OpenUpgrade | refs/heads/8.0 | addons/sales_team/sales_team.py | 75 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... |
KMFleischer/PyEarthScience | refs/heads/master | Transition_examples_NCL_to_PyNGL/read_data/TRANS_read_ASCII_lat_lon_value_way2.py | 1 | #
# File:
# TRANS_read_ASCII_lat_lon_value_way2.py
#
# Synopsis:
# Illustrates how to read an ASCII file and create a
# contour fill plot on a map
#
# Categories:
# I/O
# contour plot
# map plot
#
# Author:
# Karin Meier-Fleischer, based on NCL example
#
# Date of initial publication:
# ... |
ChanderG/scikit-learn | refs/heads/master | sklearn/cluster/tests/test_k_means.py | 132 | """Testing for K-means"""
import sys
import numpy as np
from scipy import sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing i... |
jtrobec/pants | refs/heads/master | src/python/pants/base/parse_context.py | 20 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
class ParseContext(... |
davidlmorton/spikepy | refs/heads/master | spikepy/builtins/visualizations/rasters.py | 1 | # Copyright (C) 2012 David Morton
#
# 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 distribut... |
pshowalter/solutions-geoprocessing-toolbox | refs/heads/dev | utils/test/clearing_operations_tests/ClearingOperationsCanvasAreaGRGTestCase.py | 1 | #------------------------------------------------------------------------------
# Copyright 2017 Esri
# 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/LICENS... |
preo/ansible-modules-extras | refs/heads/devel | cloud/cloudstack/cs_portforward.py | 7 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# 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 Lice... |
Eloston/nsmb-tools | refs/heads/master | classidtool/libupdate.py | 1 | '''
This file is part of nsmb-tools.
nsmb-tools 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.
nsmb-tools is distr... |
svfat/django-tutorial-bugreport | refs/heads/master | manage.py | 404 | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
hgl888/chromium-crosswalk | refs/heads/master | chrome/common/extensions/docs/server2/datastore_util.py | 29 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cPickle
import googledatastore as datastore
import logging
from future import Future
# N.B.: In order to use this module you should have a working c... |
ReamerKim/pad_crawling | refs/heads/master | model/Monster.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import re
import requests
import json
_no = re.compile(r"""<div class="no">No. ([^<]+)</div>""");
_name = re.compile(r"""<div class="name">([^<]+)</div>""")
_icon = re.compile(r"""<img class="imgicon" src="([^"]+)" /></div>""")
_cost = re.compile(r"""<div cl... |
bobuk/urpc | refs/heads/master | setup.py | 1 | from setuptools import setup, find_packages
setup(name="urpc", version="0.3.4",
py_modules=['urpc', 'aiourpc'],
url="http://github.com/bobuk/urpc",
author="Grigory Bakunov",
author_email='thebobuk@ya.ru',
description='uRPC is oversimplistic RPC over Redis',
install_requires=[
... |
rnestler/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/pytest/_pytest/capture.py | 178 | """
per-test stdout/stderr capturing mechanism.
"""
from __future__ import with_statement
import sys
import os
from tempfile import TemporaryFile
import py
import pytest
from py.io import TextIO
unicode = py.builtin.text
patchsysdict = {0: 'stdin', 1: 'stdout', 2: 'stderr'}
def pytest_addoption(parser):
grou... |
kubeflow/kfp-tekton-backend | refs/heads/master | sdk/python/tests/compiler/testdata/volume.py | 1 | # 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 agreed to in writing, ... |
PythonCharmers/orange3 | refs/heads/master | Orange/misc/datasets.py | 25 | import json
import os
class _DatasetInfo(dict):
def __init__(self):
super().__init__(self)
datasets_folder = os.path.join(os.path.dirname(__file__),
'../datasets')
with open(os.path.join(datasets_folder, 'datasets.info'), 'r') as f:
info =... |
LethusTI/supportcenter | refs/heads/master | vendor/django/django/contrib/formtools/tests/forms.py | 99 | from django import forms
from django.contrib.formtools.wizard import FormWizard
from django.http import HttpResponse
class Page1(forms.Form):
name = forms.CharField(max_length=100)
thirsty = forms.NullBooleanField()
class Page2(forms.Form):
address1 = forms.CharField(max_length=100)
address2 = forms.C... |
Perkville/django-tastypie | refs/heads/master | setup.py | 13 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
from tastypie import __version__
setup(
name='django-tastypie',
version=__version__,
description='A flexib... |
linjoahow/2015cdaa-w11 | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/gc.py | 743 | """This module provides access to the garbage collector for reference cycles.
enable() -- Enable automatic garbage collection.
disable() -- Disable automatic garbage collection.
isenabled() -- Returns true if automatic collection is enabled.
collect() -- Do a full collection right now.
get_count() -- Return the curren... |
CaledoniaProject/Empire | refs/heads/master | lib/modules/persistence/debugger/osk.py | 20 | from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-OSK',
'Author': ['@harmj0y'],
'Description': ("Sets the debugger for the on-screen keyboard (osk.exe) to be cmd.exe, "
"ano... |
dmcarvalho/KhartesTools | refs/heads/master | test/test_resources.py | 1 | # coding=utf-8
"""Resources test.
.. 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 Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = '... |
hoatle/odoo | refs/heads/8.0 | addons/website_event_track/controllers/__init__.py | 382 | import event
|
codesparkle/youtube-dl | refs/heads/master | youtube_dl/extractor/voicerepublic.py | 20 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
ExtractorError,
determine_ext,
int_or_none,
sanitized_Request,
)
class VoiceRepublicIE(InfoExtractor):
_VALID_URL = r'https?://v... |
xsynergy510x/android_external_chromium_org | refs/heads/cm-12.1 | third_party/tlslite/tlslite/utils/codec.py | 115 | # Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""Classes for reading/writing binary data (such as TLS records)."""
from .compat import *
class Writer(object):
def __init__(self):
self.bytes = bytearray(0)
def add(self, x, length):
self.bytes... |
scbash/xbmc | refs/heads/master | tools/darwin/Support/GenerateMissingImages-tvos.py | 10 | #!/usr/bin/python
import sys, os, json
from subprocess import call
assetCatalogPath = sys.argv[1]
brandAssetsDir = sys.argv[2] + '.brandassets'
def generateImage(contentsRelativeDir, isBaseImage1x, newWidth, newHeight):
contentsDir = os.path.join(assetCatalogPath, contentsRelativeDir)
if isBaseImage1x:
... |
poppy-project/pypot | refs/heads/master | tests/test_websocket.py | 1 | import json
import time
import unittest
import websocket
from pypot.creatures import PoppyErgoJr
from utils import get_open_port
@unittest.skip("tornado.ioloop from jr.ws as well as js.http must be stopped by jr.close() before launching new jr instances")
class TestWebsocketsCommunication(unittest.TestCase):
"""... |
SongGithub/Coding_Exercise | refs/heads/master | tests/test_tax_rate.py | 2 | from src.tax_rate import TaxRate
import unittest,os,settings
class TestTaxRate(unittest.TestCase):
"""
docstring for TestTaxRate
"""
def setUp(self):
tax_rate_file_path = os.path.join(
settings.TAX_RATE_BACKUP_PATH,
settings.TAX_RATE_DEFAULT_FILENAME
)
... |
agusc/scrapy | refs/heads/master | scrapy/extensions/debug.py | 152 | """
Extensions for debugging Scrapy
See documentation in docs/topics/extensions.rst
"""
import sys
import signal
import logging
import traceback
import threading
from pdb import Pdb
from scrapy.utils.engine import format_engine_status
from scrapy.utils.trackref import format_live_refs
logger = logging.getLogger(__n... |
cevaris/pants | refs/heads/master | src/python/pants/backend/python/interpreter_cache.py | 2 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shu... |
jdber1/opendrop | refs/heads/master | opendrop/app/ift/report/overview/detail/detail.py | 2 | # Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
# (i.e. you cannot make commercial derivatives).
#
# If you use this software in your research, please cite the foll... |
iSCInc/status | refs/heads/master | tests/base.py | 13 | try:
import json
except ImportError:
import simplejson as json
import os
import unittest
from google.appengine.ext import testbed
def load_schemas(path):
schemas = {}
for f in os.listdir(path):
filename, ext = os.path.splitext(f)
if ext == ".json":
schemas[filename] = json... |
Jeff-Tian/mybnb | refs/heads/master | Python27/Lib/test/test_aifc.py | 1 | from test.test_support import (findfile, TESTFN, unlink, captured_stdout,
run_unittest)
import unittest
from test import audiotests
import os
import io
import sys
import struct
import aifc
class AifcTest(audiotests.AudioWriteTests,
audiotests.AudioTestsWithSou... |
l33tdaima/l33tdaima | refs/heads/master | p859e/buddy_string.py | 1 | class Solution:
def buddyStrings(self, A: str, B: str) -> bool:
if len(A) != len(B):
return False
if A == B and len(set(A)) < len(A):
return True
diff = [(a, b) for a, b in zip(A, B) if a != b]
return len(diff) == 2 and diff[0] == diff[1][::-1]
# TESTS
tests... |
gangadhar-kadam/powapp | refs/heads/master | patches/january_2013/file_list_rename_returns.py | 30 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
from webnotes.utils import get_base_path
import os
def execute():
# find out when was the file list patch run
res = webnotes.conn.sql("""select applied_on from `__PatchLo... |
cuongnv23/ansible | refs/heads/devel | lib/ansible/module_utils/ec2.py | 5 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... |
SUSE-Cloud/nova | refs/heads/stable/havana | nova/tests/__init__.py | 13 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 compli... |
jld23/saspy | refs/heads/master | saspy/sasproccommons.py | 1 | #
# Copyright SAS Institute
#
# 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... |
d4rkl0rd3r3b05/Firewall | refs/heads/master | Firewall/apnd.py | 1 | from Tkinter import *
import os
class apndwin:
def apndwin(self,prntwin):
mainwin=Toplevel(master=prntwin)
mainwin.resizable(0,0)
mainwin.title("Append Rule")
#-----------------------------------------This is mainframe--------------------------------------------
mframe=Frame(mainwin)
fn... |
msiedlarek/wiring | refs/heads/master | tests/all/__init__.py | 1 | import unittest
import importlib
import six
class ModuleTest(unittest.TestCase):
module = 'wiring'
def test_import_all(self):
package = importlib.import_module(self.module)
if not hasattr(package, '__all__'):
return
for name in package.__all__:
self.assertTru... |
edx/lettuce | refs/heads/master | tests/integration/django/cucumber/second/features/step_definitions/second.py | 19 | # -*- coding: utf-8 -*-
from lettuce import step
@step(u'Given this app is the second app')
def given_this_app_is_the_second_app(step):
pass
|
cadyyan/codeeval | refs/heads/master | python/18_multiples_of_a_number.py | 2 | #!/usr/bin/env python
import sys
with open(sys.argv[1], 'r') as fh:
for line in fh.readlines():
line = line.strip()
if line == '':
continue
(x, n) = [int(v) for v in line.split(',')]
v = n
while v < x:
v += n
print v
|
vlachoudis/sl4a | refs/heads/master | python/src/Lib/encodings/iso2022_jp_3.py | 816 | #
# iso2022_jp_3.py: Python Unicode Codec for ISO2022_JP_3
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_3')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class Incrementa... |
johnnyliu27/openmc | refs/heads/develop | tests/regression_tests/lattice_hex/test.py | 11 | from tests.testing_harness import TestHarness
def test_lattice_hex():
harness = TestHarness('statepoint.10.h5')
harness.main()
|
jfallmann/bioconda-recipes | refs/heads/master | recipes/ega2/ega2.py | 22 | #!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
# Program Parameters
#
import os
import s... |
trivoldus28/pulsarch-verilog | refs/heads/master | tools/local/bas-release/bas,3.9/lib/python/lib/python2.3/idlelib/IdleHistory.py | 11 | class History:
def __init__(self, text, output_sep = "\n"):
self.text = text
self.history = []
self.history_prefix = None
self.history_pointer = None
self.output_sep = output_sep
text.bind("<<history-previous>>", self.history_prev)
text.bind("<<history-next>>... |
SaschaMester/delicium | refs/heads/master | tools/gyp-explain.py | 153 | #!/usr/bin/env python
# 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.
"""Prints paths between gyp targets.
"""
import json
import os
import sys
import time
from collections import deque
def usage():... |
lavish205/olympia | refs/heads/master | src/olympia/abuse/tests/test_serializers.py | 5 | from olympia.abuse.models import AbuseReport
from olympia.abuse.serializers import (
AddonAbuseReportSerializer, UserAbuseReportSerializer)
from olympia.accounts.serializers import BaseUserSerializer
from olympia.amo.tests import BaseTestCase, addon_factory, user_factory
class TestAddonAbuseReportSerializer(BaseT... |
yaqiyang/autorest | refs/heads/master | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/__init__.py | 25 | # 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 ... |
kvar/ansible | refs/heads/seas_master_2.9.5 | lib/ansible/parsing/dataloader.py | 25 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import c... |
hschovanec-usgs/magpy | refs/heads/master | magpy/gui/streampage.py | 1 | #!/usr/bin/env python
from magpy.stream import *
from magpy.absolutes import *
from magpy.transfer import *
from magpy.database import *
import wx
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure imp... |
yencarnacion/jaikuengine | refs/heads/master | .google_appengine/lib/webapp2-2.3/webapp2_extras/securecookie.py | 20 | # -*- coding: utf-8 -*-
"""
webapp2_extras.securecookie
===========================
A serializer for signed cookies.
:copyright: 2011 by tipfy.org.
:license: Apache Sotware License, see LICENSE for details.
"""
import hashlib
import hmac
import logging
import time
from webapp2_extras import json
... |
MTG/gaia | refs/heads/master | src/bindings/pygaia/mtgdb/__init__.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .collection import Collection
from .mtgdbcollection import MtgdbCollection
|
ET-CS/Simple-Python-Sitemap | refs/heads/master | gen_thumbs.py | 1 | #!/usr/bin/env python
## Import modules and helper functions
import os
# Get working directory
import os.path; path = os.path.dirname(os.path.abspath(__file__))
# tenjin Template Engine
import tenjin
# Tenjin.set_template_encoding('cp932') # template encoding
from tenjin.helpers import *
# Import settings file
import ... |
jymannob/Sick-Beard | refs/heads/development | cherrypy/lib/jsontools.py | 80 | import sys
import cherrypy
if sys.version_info >= (2, 6):
# Python 2.6: simplejson is part of the standard library
import json
else:
try:
import simplejson as json
except ImportError:
json = None
if json is None:
def json_decode(s):
raise ValueError('No JSON library is avai... |
wbsoft/frescobaldi | refs/heads/master | frescobaldi_app/widgets/tempobutton.py | 3 | # This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... |
wiki05/SublimeJEDI | refs/heads/master | jedi/evaluate/flow_analysis.py | 5 | from jedi.parser import tree as pr
class Status(object):
lookup_table = {}
def __init__(self, value, name):
self._value = value
self._name = name
Status.lookup_table[value] = self
def invert(self):
if self is REACHABLE:
return UNREACHABLE
elif self is ... |
dcroc16/skunk_works | refs/heads/master | google_appengine/lib/django-0.96/django/contrib/auth/handlers/modpython.py | 33 | from mod_python import apache
import os
def authenhandler(req, **kwargs):
"""
Authentication handler that checks against Django's auth database.
"""
# mod_python fakes the environ, and thus doesn't process SetEnv. This fixes
# that so that the following import works
os.environ.update(req.subp... |
th0th/harmony | refs/heads/master | harmony/taghandler.py | 1 | # -*- coding: utf-8 -*-
from mutagen.easyid3 import EasyID3
class TagHandler:
def __init__(self):
self.mask = None
def set_mask(self, mask):
self.mask = mask
def read_tags(self, filepath):
tags = EasyID3(filepath)
new_tags = {}
for tag in tags:
new_tags[tag] = tags[tag][0].encode('utf-8')
retur... |
Rastagong/A-Scholar-In-The-Woods | refs/heads/master | Releases/Post Compo/Sources/narro/tmxreader.py | 4 | # -*- coding: utf-8 -*-
"""
TileMap loader for python for Tiled, a generic tile map editor
from http://mapeditor.org/ .
It loads the \*.tmx files produced by Tiled.
"""
# Versioning scheme based on: http://en.wikipedia.org/wiki/Versioning#Designating_development_stage
#
# +-- api change, probably incompatible wit... |
weidongxu84/info-gatherer | refs/heads/master | django/contrib/localflavor/co/forms.py | 196 | """
Colombian-specific form helpers.
"""
from __future__ import absolute_import
from django.contrib.localflavor.co.co_departments import DEPARTMENT_CHOICES
from django.forms.fields import Select
class CODepartmentSelect(Select):
"""
A Select widget that uses a list of Colombian states as its choices.
""... |
mgagne/nova | refs/heads/master | nova/api/openstack/compute/schemas/v3/create_backup.py | 59 | # Copyright 2014 NEC Corporation. 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 ... |
DailyActie/Surrogate-Model | refs/heads/master | 01-codes/tensorflow-master/tensorflow/python/kernel_tests/division_past_test.py | 1 | # Copyright 2015 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... |
Adamssss/projectEuler | refs/heads/master | Problem 001-150 Python/pb058.py | 1 | import math
import time
t1 = time.time()
prime = []
def primeSieve(n):
global prime
n = (n+1)//2
p = [True]*(n)
i = 1
prime.append(2)
while i < n:
if p[i]:
t = 2*i+1
prime.append(t)
p[i] = False
j = 2*i*i+2*i
while j < n:
... |
aviciimaxwell/odoo | refs/heads/8.0 | addons/payment_buckaroo/tests/test_buckaroo.py | 321 | # -*- coding: utf-8 -*-
from lxml import objectify
import urlparse
import openerp
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment.tests.common import PaymentAcquirerCommon
from openerp.addons.payment_buckaroo.controllers.main import BuckarooController
from opener... |
fvcproductions/dotfiles | refs/heads/master | bin/sketch/Plugins/WakaTime.sketchplugin/Contents/Resources/wakatime/packages/requests/packages/chardet/latin1prober.py | 1777 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... |
ItsLastDay/academic_university_2016-2018 | refs/heads/master | subjects/SoftwareDesign/au-software_design-2017/chat/src/chat_pb2_grpc.py | 1 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import chat_pb2 as chat__pb2
class ChatStub(object):
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.ChatSession = channel.stream_stream(
'/Chat/ChatSession',
... |
gmt/portage | refs/heads/master | pym/portage/sync/__init__.py | 5 | # Copyright 2014-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import os
from portage import OrderedDict
from portage.module import Modules
from portage.sync.controller import SyncManager
from portage.sync.config_checks import check_type
_SUBMODULE_PATH_MAP = OrderedDict([... |
martinwicke/tensorflow | refs/heads/master | tensorflow/contrib/tfprof/python/tools/tfprof/tfprof_logger.py | 9 | # 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... |
xsynergy510x/android_external_chromium_org | refs/heads/cm-12.1 | build/android/pylib/gtest/test_options.py | 44 | # Copyright 2013 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.
"""Defines the GTestOptions named tuple."""
import collections
GTestOptions = collections.namedtuple('GTestOptions', [
'tool',
'cleanup_test_files'... |
ryanmockabee/golfr | refs/heads/master | flask/lib/python3.6/site-packages/wtforms/ext/sqlalchemy/fields.py | 177 | """
Useful form fields for use with SQLAlchemy ORM.
"""
from __future__ import unicode_literals
import operator
from wtforms import widgets
from wtforms.compat import text_type, string_types
from wtforms.fields import SelectFieldBase
from wtforms.validators import ValidationError
try:
from sqlalchemy.orm.util im... |
kubeflow/kfctl | refs/heads/master | py/kubeflow/kfctl/testing/pytests/kfam_test.py | 1 | import logging
import pytest
from kubeflow.testing import util
import json
from retrying import retry
from time import sleep
import uuid
from kubeflow.kfctl.testing.util import aws_util as kfctl_aws_util
def test_kfam(record_xml_attribute, cluster_name):
util.set_pytest_junit(record_xml_attribute, "test_kfam_e2e"... |
refeed/coala-bears | refs/heads/master | bears/vcs/git/GitCommitBear.py | 1 | import os
import shutil
import re
from bears.vcs.CommitBear import _CommitBear
from coala_utils.ContextManagers import change_directory
from coalib.misc.Shell import run_shell_command
class GitCommitBear(_CommitBear):
LANGUAGES = {'Git'}
ASCIINEMA_URL = 'https://asciinema.org/a/e146c9739ojhr8396wedsvf0d'
... |
Linkinzoo/H5Exercise | refs/heads/master | Task11_SASS学习/JiKe/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py | 1825 | # 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.
"""GYP backend that generates Eclipse CDT settings files.
This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML
files that can be importe... |
agry/NGECore2 | refs/heads/master | scripts/object/soundobject/soundobject_factory_exterior.py | 85615 | import sys
def setup(core, object):
return |
CGI-Nederland/FreshAir | refs/heads/master | server.py | 2 | import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
HandlerClass = SimpleHTTPRequestHandler
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"
if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = 8000
server_address = ('127.0.0.1', port)
HandlerClass.protocol_ver... |
wuyuewen/libcloud | refs/heads/trunk | docs/examples/container/ecs/container_registry.py | 30 | from libcloud.container.types import Provider
from libcloud.container.providers import get_driver
cls = get_driver(Provider.ECS)
# Connect to AWS
conn = cls(access_id='SDHFISJDIFJSIDFJ',
secret='THIS_IS)+_MY_SECRET_KEY+I6TVkv68o4H',
region='ap-southeast-2')
# Get a Registry API client for an ex... |
geomalgo/geomalgo | refs/heads/master | test/grid2d/test_grid2d.py | 2 | import unittest
import numpy as np
from geomalgo import (
Point2D, Grid2D, compute_index, compute_row_col, coord_to_index
)
from geomalgo.data import step
class TestCoordToIndex(unittest.TestCase):
def test_normal(self):
"""Test index is computed from coordinate"""
# -2 -1.5 -1 -0.5... |
enableiot/iotanalytics-rule-engine | refs/heads/master | pydeps/rules/conditions/processors/matchingPeriodFinder.py | 1 | # Copyright (c) 2015 Intel Corporation
#
# 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 ... |
davidzyx/PythonNotes | refs/heads/master | Part II/ch08_project01.py | 1 | #! python3
# Project: Generating Random Quiz Files
# Say you're a geography teacher with 35 students in your class and you want to give a pop quiz on
# US state capitals. Alas, your class has a few bad eggs in it, and you can't trust the students
# not to cheat. You'd like to randomize the order of questions so that ea... |
amite/ghostblog | refs/heads/master | node_modules/grunt-sass/node_modules/node-sass/node_modules/pangyp/gyp/pylib/gyp/common_test.py | 2542 | #!/usr/bin/env python
# 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.
"""Unit tests for the common.py file."""
import gyp.common
import unittest
import sys
class TestTopologicallySorted(unittest.TestCase):
... |
gfyoung/numpy | refs/heads/master | numpy/doc/misc.py | 19 | """
=============
Miscellaneous
=============
IEEE 754 Floating Point Special Values
--------------------------------------
Special values defined in numpy: nan, inf,
NaNs can be used as a poor-man's mask (if you don't care what the
original value was)
Note: cannot use equality to test NaNs. E.g.: ::
>>> myarr = ... |
m45t3r/i3pystatus | refs/heads/myfork | tests/test_uname.py | 22 |
import os
from i3pystatus import uname
def test_uname():
KEYS = ("sysname", "nodename", "release", "version", "machine")
uref = os.uname()
for key in KEYS:
um = uname.Uname(format="{" + key + "}")
um.init()
assert um.output["full_text"] == getattr(uref, key)
|
TangHao1987/intellij-community | refs/heads/master | python/testData/copyPaste/singleLine/Indent32.dst.py | 664 | class C:
def foo(self):
<caret> y = 2
|
EricMuller/mywebmarks-backend | refs/heads/master | requirements/twisted/Twisted-17.1.0/build/lib.linux-x86_64-3.5/twisted/trial/test/detests.py | 16 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for Deferred handling by L{twisted.trial.unittest.TestCase}.
"""
from __future__ import division, absolute_import
from twisted.trial import unittest
from twisted.internet import defer, threads, reactor
from twisted.trial.util import su... |
duqiao/django | refs/heads/master | tests/view_tests/tests/test_specials.py | 330 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import SimpleTestCase, override_settings
@override_settings(ROOT_URLCONF='view_tests.generic_urls')
class URLHandling(SimpleTestCase):
"""
Tests for URL handling in views and responses.
"""
redirect_target = "/%E4%B8%AD%... |
alisonbnt/watchtower | refs/heads/master | tower/elements/fire.py | 1 | exports = {
"name": "Fire",
"aspects": {
"amulets": [
{
"item": "warrior",
"effect": "health",
"description": "With the fire and heat of battle, "
"your fouls will perish much faster"
},
{... |
abhiskk/fast-neural-style | refs/heads/master | neural_style/vgg16.py | 3 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Vgg16(torch.nn.Module):
def __init__(self):
super(Vgg16, self).__init__()
self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1)
self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1)
... |
Amarchuk/2FInstability | refs/heads/master | core/instabCriteriaSolution.py | 1 | __author__ = 'amarch'
# -*- coding: utf-8 -*-
from numpy import *
import matplotlib.pyplot as plt
from scipy.optimize import *
import scipy
from scipy.special import *
import math
def run_once(f):
def wrapper(*args, **kwargs):
if not globals().has_key(str(f.__name__) + '_plot'):
globals()[str(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.