repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
alexlo03/ansible | refs/heads/devel | test/units/modules/network/fortimanager/test_fmgr_provisioning.py | 18 | # (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dis... |
clay23/lab2 | refs/heads/master | lib/flask/app.py | 345 | # -*- coding: utf-8 -*-
"""
flask.app
~~~~~~~~~
This module implements the central WSGI application object.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from threading import Lock
from datetime import timedelta
from itertools import... |
edgarRd/incubator-airflow | refs/heads/master | airflow/hooks/mysql_hook.py | 6 | # -*- coding: utf-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
#... |
tolmasky/cappuccino | refs/heads/master | Tools/Documentation/support/massage_text.py | 24 | #!/usr/bin/env python
#
# $1 Generated documentation directory
# The following transforms are performed:
# - Strip useless "[implementation]" littering the docs
# - Change "Static Public Member Functions" to "Class Methods"
# - Change "Public Member Functions" to "Instance Methods"
# - Change "Member Function Document... |
polarise/breeze | refs/heads/master | breeze/splice_mapping.py | 1 | # -*- encoding: utf-8 -*-
import sys
import os
import os.path
import glob
import logging
from utils import *
def splice_mapping( T, configs, audit ):
logging.debug( "Splice mapping..." )
# create the destination for splice alignments if not exists
try:
os.mkdir( configs['SPLICED_ALIGNER_PATH'] )
except OSError... |
milinbhakta/flaskjinja | refs/heads/master | flask1/Lib/site-packages/setuptools/command/develop.py | 450 | from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsError, DistutilsOptionError
import os
import glob
from pkg_resources import Distribution, PathMetadata, normalize_path
from setuptools.command.easy_install import easy_install
from setuptools.compat import PY3
impor... |
dereneaton/ipyrad | refs/heads/master | ipyrad/analysis/bucky.py | 1 | #!/usr/bin/env python
"ipyrad.analysis wrapper for parallel BUCKy concordance tree analyses"
from __future__ import print_function
from builtins import range
import os
import glob
import time
import numpy as np
import subprocess as sps
from collections import Counter
from ipyrad.analysis.utils import progressbar, P... |
DefyVentures/edx-platform | refs/heads/master | common/djangoapps/student/management/commands/change_enrollment.py | 138 | from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError
from optparse import make_option
from student.models import CourseEnrollment, User
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locations import SlashSeparatedCourseKey
class Command(BaseComma... |
jn7163/django | refs/heads/master | tests/test_discovery_sample/doctests.py | 471 | """
Doctest example from the official Python documentation.
https://docs.python.org/3/library/doctest.html
"""
def factorial(n):
"""Return the factorial of n, an exact integer >= 0.
>>> [factorial(n) for n in range(6)]
[1, 1, 2, 6, 24, 120]
>>> factorial(30) # doctest: +ELLIPSIS
2652528598121910... |
amunk/metagoofil | refs/heads/master | pdfminer/pdfcolor.py | 56 | #!/usr/bin/env python2
from psparser import LIT
## PDFColorSpace
##
LITERAL_DEVICE_GRAY = LIT('DeviceGray')
LITERAL_DEVICE_RGB = LIT('DeviceRGB')
LITERAL_DEVICE_CMYK = LIT('DeviceCMYK')
class PDFColorSpace(object):
def __init__(self, name, ncomponents):
self.name = name
self.ncomponents = ncomp... |
unreal666/outwiker | refs/heads/master | plugins/markdown/markdown/markdown_plugin_libs/pygments/styles/solarized.py | 4 | # -*- coding: utf-8 -*-
"""
pygments.styles.solarized
~~~~~~~~~~~~~~~~~~~~~~~~
Solarized by Camil Staps
A Pygments style for the Solarized themes (licensed under MIT).
See: https://github.com/altercation/solarized
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license... |
ldamewood/figures | refs/heads/master | scripts/Trilayer3D.py | 1 | import sys
sys.path.append("/Applications/VisIt.app/Contents/Resources/2.8.0/darwin-x86_64/lib/site-packages")
import os
import visit
import alpha
filesPath = "aztec.llnl.gov:/g/g14/damewood/scratchd/2014_Trilayer/vasp"
visit.Launch(vdir="/Applications/VisIt.app/Contents/Resources/bin/")
# Volume plot
visit.OpenDatab... |
dgsantana/arsenalsuite | refs/heads/master | cpp/lib/stonegui/configure.py | 6 |
import os
import sipconfig
import PyQt4.pyqtconfig as pyqtconfig
import sys
import getopt
import glob
opt_static=0
opt_debug=0
opt_generate_code=1
class StoneguiModuleMakefile(pyqtconfig.QtCoreModuleMakefile):
"""The Makefile class for modules that %Import QtXml.
"""
def __init__(self, *args, **kw):
"""Initiali... |
skirsdeda/cmsplugin-filer | refs/heads/develop | cmsplugin_filer_link/migrations/0001_initial.py | 28 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("filer", "0008_polymorphic__del_field_file__file_type_plugin_name"),
)
def forwards(self, orm):
# Addi... |
tuxfux-hlp-notes/python-batches | refs/heads/master | batch-67/12-modules/myenv/lib/python2.7/site-packages/wheel/wininst2wheel.py | 62 | #!/usr/bin/env python
import distutils.dist
import os.path
import re
import sys
import tempfile
import zipfile
from argparse import ArgumentParser
from glob import iglob
from shutil import rmtree
import wheel.bdist_wheel
from wheel.archive import archive_wheelfile
egg_info_re = re.compile(r'''(^|/)(?P<name>[^/]+?)-(?... |
xia0pin9/capstone | refs/heads/next | bindings/python/capstone/arm64_const.py | 4 | # For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [arm64_const.py]
# ARM64 shift type
ARM64_SFT_INVALID = 0
ARM64_SFT_LSL = 1
ARM64_SFT_MSL = 2
ARM64_SFT_LSR = 3
ARM64_SFT_ASR = 4
ARM64_SFT_ROR = 5
# ARM64 extender type
ARM64_EXT_INVALID = 0
ARM64_EXT_UXTB = 1
ARM64_EXT_UXTH = 2
ARM64_EXT_UXTW = 3
ARM64_EXT_U... |
esander91/zulip | refs/heads/master | confirmation/__init__.py | 123 | # -*- coding: utf-8 -*-
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the ... |
lidiamcfreitas/FenixScheduleMaker | refs/heads/master | ScheduleMaker/brython/www/src/Lib/test/test_compare.py | 169 | import unittest
from test import support
class Empty:
def __repr__(self):
return '<Empty>'
class Cmp:
def __init__(self,arg):
self.arg = arg
def __repr__(self):
return '<Cmp %s>' % self.arg
def __eq__(self, other):
return self.arg == other
class Anything:
def __e... |
zerolab/wagtail | refs/heads/main | wagtail/tests/modeladmintest/migrations/0009_relatedlink.py | 6 | # Generated by Django 3.1.1 on 2020-10-01 18:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0057_page_locale_fields_notnull'),
('modeladmintest', '0008_solobook'),
]
operations = [
... |
Innovahn/odoo.old | refs/heads/master | addons/mail/controllers/__init__.py | 3646 | import main
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
|
catapult-project/catapult | refs/heads/master | telemetry/telemetry/internal/testing/dependency_test_dir/dog/dog/__init__.py | 1038 | # 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.
|
rversteegen/commandergenius | refs/heads/sdl_android | project/jni/python/src/Lib/lib2to3/fixes/fix_funcattrs.py | 53 | """Fix function attribute names (f.func_x -> f.__x__)."""
# Author: Collin Winter
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixFuncattrs(fixer_base.BaseFix):
PATTERN = """
power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals'
... |
tohara/FAB-UI | refs/heads/master | fabui/python/force_reset.py | 1 | #!/usr/bin/python
#Force Totumduino Reset
import RPi.GPIO as GPIO
import time,sys
import serial
import ConfigParser
import logging
import os
config = ConfigParser.ConfigParser()
config.read('/var/www/fabui/python/config.ini')
#write LOCK FILE
open(config.get('task', 'lock_file'), 'w').close()
trace_file=config... |
williampierce/cc | refs/heads/master | tools/dsp/time_fft.py | 1 | #!/usr/bin/env python
import argparse
import numpy as np
from dspUtils import get_fft
DEFAULT_SIZE = 320000
DEFAULT_COUNT = 10
def main():
parser = argparse.ArgumentParser(
description =
'Compute FFTs of test data. Useful for timing.')
parser.add_argument("-s", "--size", type=int,
... |
arne-cl/pattern | refs/heads/master | examples/01-web/05-twitter-stream.py | 21 | import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))
import time
from pattern.web import Twitter
# Another way to mine Twitter is to set up a stream.
# A Twitter stream maintains an open connection to Twitter,
# and waits for data to pour in.
# Twitter.search() allows us to look a... |
ongwilliam/video_streaming_project | refs/heads/master | VideoStream.py | 1 | class VideoStream:
def __init__(self, filename):
self.filename = filename
try:
self.file = open(filename, 'rb')
except:
raise IOError
self.frameNum = 0
def nextFrame(self):
"""Get next frame."""
data = self.file.read(5) # Get the framelength from the first 5 bits
if data:
framelength = int(... |
gtko/Sick-Beard | refs/heads/development | lib/hachoir_core/field/static_field_set.py | 90 | from lib.hachoir_core.field import FieldSet, ParserError
class StaticFieldSet(FieldSet):
"""
Static field set: format class attribute is a tuple of all fields
in syntax like:
format = (
(TYPE1, ARG1, ARG2, ...),
(TYPE2, ARG1, ARG2, ..., {KEY1=VALUE1, ...}),
...
)... |
a-parhom/edx-platform | refs/heads/master | lms/djangoapps/verify_student/migrations/0009_remove_id_verification_aggregate.py | 13 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-27 16:27
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('verify_student', '0008_populate_idverificationaggregate'),
]
operations = [
migrat... |
abergeron/ccw_tutorial_theano | refs/heads/master | 02_compiling_and_running/02_shared.py | 4 | # Fill in the TODOs in this exercise, then run
# python 01_function.py to see if your solution works!
#
# This exercice make you use shared variable. You must create them and
# update them by swapping 2 shared variables values.
import numpy as np
raise NotImplementedError("TODO: add any other imports you need")
def m... |
iamjakob/lumiCalc | refs/heads/master | LumiDB/python/lumiReport.py | 1 | ###########################################################
# Luminosity/LumiTag/LumiCorrection report API #
# #
# Author: Zhen Xie #
###########################################################
import os,sys,time
... |
dplorimer/osf | refs/heads/master | scripts/retract_registrations.py | 8 | """Script for retracting pending retractions that are more than 48 hours old."""
import datetime
import logging
import sys
from modularodm import Q
from framework.auth import Auth
from framework.transactions.context import TokuTransaction
from website import models, settings
from website.app import init_app
from web... |
TridevGuha/django | refs/heads/master | django/db/backends/sqlite3/operations.py | 180 | from __future__ import unicode_literals
import datetime
import uuid
from django.conf import settings
from django.core.exceptions import FieldError, ImproperlyConfigured
from django.db import utils
from django.db.backends import utils as backend_utils
from django.db.backends.base.operations import BaseDatabaseOperatio... |
tiagofrepereira2012/tensorflow | refs/heads/master | tensorflow/contrib/text/python/ops/__init__.py | 102 | # Copyright 2017 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... |
vicky2135/lucious | refs/heads/master | lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py | 947 | from __future__ import division
from datetime import datetime
def total_seconds(td):
"""Python 2.6 compatability"""
if hasattr(td, 'total_seconds'):
return td.total_seconds()
ms = td.microseconds
secs = (td.seconds + td.days * 24 * 3600)
return (ms + secs * 10**6) / 10**6
class RedisCa... |
ashang/calibre | refs/heads/master | src/calibre/ebooks/mobi/writer8/main.py | 5 | #!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import copy, ... |
zturchan/CMPUT410-Lab6 | refs/heads/master | v1/lib/python2.7/site-packages/django/utils/numberformat.py | 337 | from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils import six
def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
force_grouping=False):
"""
Gets a number (as a number or string), and returns it as a string,
using formats ... |
cartwheelweb/packaginator | refs/heads/master | apps/package/models.py | 1 | # TODO - cleanup regex to do proper string subs
import logging
import os
import re
import sys
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Q
f... |
rcarmo/yaki-gae | refs/heads/master | appengine_config.py | 1 | import os, sys
sys.path.insert(0,os.path.join(os.path.dirname(os.path.abspath(__file__)),'lib'))
appstats_CALC_RPC_COSTS = True
def webapp_add_wsgi_middleware(app):
from google.appengine.ext.appstats import recording
#app = recording.appstats_wsgi_middleware(app)
return app
|
hulu/uwsgi | refs/heads/master | plugins/legion_cache_fetch/uwsgiplugin.py | 21 | NAME = 'legion_cache_fetch'
CFLAGS = []
LDFLAGS = []
LIBS = []
GCC_LIST = ['legion_cache_fetch']
|
mdj2/django | refs/heads/master | tests/prefetch_related/tests.py | 4 | from __future__ import absolute_import, unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.db import connection
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import six
from .models import (Author, Book, Reader, Qualification, T... |
hofschroeer/pybombs | refs/heads/master | mod_pybombs/globals.py | 8 | #
# Copyright 2013 Tim O'Shea
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
# PyBOMBS is distributed ... |
XiaodunServerGroup/ddyedx | refs/heads/master | common/lib/xmodule/xmodule/split_test_module.py | 6 | """
Module for running content split tests
"""
import logging
from webob import Response
from xmodule.progress import Progress
from xmodule.seq_module import SequenceDescriptor
from xmodule.x_module import XModule, module_attr
from lxml import etree
from xblock.core import XBlock
from xblock.fields import Scope, In... |
allmightyspiff/softlayer-python | refs/heads/master | SoftLayer/CLI/loadbal/ns_list.py | 2 | """List active Netscaler devices."""
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer import utils
@click.command()
@environment.pass_env
def cli(env):
"""List active Netscaler devices."""
mgr = SoftLayer.LoadBalancerManager(env.client)
... |
licco/zipline | refs/heads/master | tests/test_perf_tracking.py | 3 | #
# Copyright 2013 Quantopian, Inc.
#
# 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... |
anortef/calico | refs/heads/master | calico/felix/test/test_fetcd.py | 1 | # Copyright (c) Metaswitch Networks 2015. All rights reserved.
import json
import logging
from etcd import EtcdResult
from gevent.event import Event
from mock import Mock, call, patch, ANY
from calico.datamodel_v1 import EndpointId
from calico.felix.config import Config
from calico.felix.ipsets import IpsetActor
from ... |
chouseknecht/ansible | refs/heads/devel | lib/ansible/modules/inventory/add_host.py | 45 | # -*- mode: python -*-
# Copyright: (c) 2012, Seth Vidal (@skvidal)
# Copyright: Ansible Team
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1... |
caesar2164/edx-platform | refs/heads/master | lms/djangoapps/course_api/blocks/transformers/navigation.py | 35 | """
TODO
"""
from openedx.core.lib.block_structure.transformer import BlockStructureTransformer
from .block_depth import BlockDepthTransformer
class DescendantList(object):
"""
Contain
"""
def __init__(self):
self.items = []
class BlockNavigationTransformer(BlockStructureTransformer):
""... |
ibinti/intellij-community | refs/heads/master | plugins/hg4idea/testData/bin/mercurial/httpconnection.py | 91 | # httpconnection.py - urllib2 handler for new http support
#
# Copyright 2005, 2006, 2007, 2008 Matt Mackall <mpm@selenic.com>
# Copyright 2006, 2007 Alexis S. L. Carvalho <alexis@cecm.usp.br>
# Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
# Copyright 2011 Google, Inc.
#
# This software may be used and distribu... |
EvanzzzZ/mxnet | refs/heads/master | tools/accnn/acc_conv.py | 14 | import numpy as np
from scipy import linalg as LA
import mxnet as mx
import argparse
import utils
def conv_vh_decomposition(model, args):
W = model.arg_params[args.layer+'_weight'].asnumpy()
N, C, y, x = W.shape
b = model.arg_params[args.layer+'_bias'].asnumpy()
W = W.transpose((1,2,0,3)).res... |
csmengwan/autorest | refs/heads/master | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/models/__init__.py | 510 | # 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 ... |
googleapis/python-pubsublite | refs/heads/master | google/cloud/pubsublite_v1/types/cursor.py | 1 | # -*- coding: utf-8 -*-
# Copyright 2020 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... |
mupi/tecsaladeaula | refs/heads/develop | activities/migrations/0001_initial.py | 3 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
pass
def backwards(self, orm):
pass
models = {
}
complete_apps = ['activities'] |
iterativ/djangojames | refs/heads/master | djangojames/models/thumbs.py | 1 | # -*- encoding: utf-8 -*-
#
# New BSD License
#
# Initial django-thumbs by Antonio Melé
# http://code.google.com/p/django-thumbs/
#
# Authors:
#
# - Antonio Melé
# - Atizo AG (atizo.com)
from six import string_types
from PIL import Image
from django.conf import settings
from django.core.files.base import ContentFile
... |
cesarmarinhorj/phantomjs | refs/heads/master | src/qt/qtwebkit/Tools/Scripts/webkitpy/port/image_diff.py | 119 | # Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2010 Gabor Rapcsanyi <rgabor@inf.u-szeged.hu>, University of Szeged
# Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the foll... |
igboyes/virtool | refs/heads/master | virtool/jobs/build_index.py | 2 | import os
import typing
import virtool.history.db
import virtool.indexes.db
import virtool.otus.db
import virtool.db.sync
import virtool.errors
import virtool.history.utils
import virtool.jobs.job
import virtool.otus.utils
import virtool.utils
class Job(virtool.jobs.job.Job):
"""
Job object that builds a new... |
AnhellO/DAS_Sistemas | refs/heads/development | Ago-Dic-2017/Luis Zúñiga/Práctica 1/Cliente.py | 1 | from Persona import Persona
class Cliente(Persona):
"""Class Cliente
"""
# Attributes:
__numeroDeCliente = "" # (String)
# Operations
def __init__(self,nombre,paterno,materno,edad,genero,direccion,telefono,\
numCli):
super().__init__(nombre,paterno,materno,edad,genero,direccio... |
OmeGak/indico-plugins | refs/heads/master | piwik/indico_piwik/piwik.py | 1 | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... |
nict-isp/scn-admin | refs/heads/master | src/oflogger/oflogger/utils/connector.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
oflogger.utils.connector
~~~~~~~~~~~~~~~~~~~~~~~~
データベース等への接続ユーティリティ
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL3, see LICENSE for more details.
"""
import logging
import datetime
i... |
mjgrav2001/scikit-learn | refs/heads/master | examples/hetero_feature_union.py | 288 | """
=============================================
Feature Union with Heterogeneous Data Sources
=============================================
Datasets can often contain components of that require different feature
extraction and processing pipelines. This scenario might occur when:
1. Your dataset consists of hetero... |
mikewiebe-ansible/ansible | refs/heads/devel | lib/ansible/modules/network/meraki/meraki_firewalled_services.py | 17 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Kevin Breit (@kbreit) <kevin.breit@kevinbreit.net>
# 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
ANSIBLE_METADATA = {
... |
tarmstrong/nbdiff | refs/heads/master | nbdiff/server/command/SaveNotebookCommand.py | 1 | from . import BaseCommand
from flask import make_response
from IPython.nbformat import current
from unicodedata import normalize
class SaveNotebookCommand(BaseCommand):
def process(self, request, filename, db_session):
# format for notebook.
format = u'json'
data = request.form['download_... |
StingraySoftware/HENDRICS | refs/heads/main | hendrics/_astropy_init.py | 1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
__all__ = ["__version__"]
# this indicates whether or not we are in the package's setup.py
try:
_ASTROPY_SETUP_
except NameError:
import builtins
builtins._ASTROPY_SETUP_ = False
try:
from .version import version as __version__
except I... |
splunk/splunk-webframework | refs/heads/master | contrib/django/django/db/models/sql/aggregates.py | 195 | """
Classes to represent the default SQL aggregate functions
"""
from django.db.models.fields import IntegerField, FloatField
# Fake fields used to identify aggregate types in data-conversion operations.
ordinal_aggregate_field = IntegerField()
computed_aggregate_field = FloatField()
class Aggregate(object):
"""... |
edlabh/SickRage | refs/heads/master | lib/unidecode/x09d.py | 252 | data = (
'Fou ', # 0x00
'Yiao ', # 0x01
'Jue ', # 0x02
'Jue ', # 0x03
'Pi ', # 0x04
'Huan ', # 0x05
'Zhen ', # 0x06
'Bao ', # 0x07
'Yan ', # 0x08
'Ya ', # 0x09
'Zheng ', # 0x0a
'Fang ', # 0x0b
'Feng ', # 0x0c
'Wen ', # 0x0d
'Ou ', # 0x0e
'Te ', # 0x0f
'Jia ', # 0x10
'N... |
anthrotype/makeotflib-py | refs/heads/master | setup.py | 1 | from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
from distutils.command.build_clib import build_clib
import os
from os.path import join as pjoin
from glob import glob
from distutils import log
from distutils.errors import DistutilsSetupError
CURR_DIR = os.path.abspath(os.path.... |
dreamsxin/kbengine | refs/heads/master | kbe/src/lib/python/Lib/encodings/euc_kr.py | 816 | #
# euc_kr.py: Python Unicode Codec for EUC_KR
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_kr, codecs
import _multibytecodec as mbc
codec = _codecs_kr.getcodec('euc_kr')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(mbc.MultibyteIncrem... |
plotly/plotly.py | refs/heads/master | packages/python/plotly/plotly/graph_objs/waterfall/_stream.py | 2 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Stream(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "waterfall"
_path_str = "waterfall.stream"
_valid_props = {"maxpoints", "token"}
# maxpo... |
codepantry/django | refs/heads/master | tests/auth_tests/test_views.py | 183 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import itertools
import os
import re
from importlib import import_module
from django.apps import apps
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.contrib.auth import REDIRECT_FIELD_NAME, S... |
xiaonanln/myleetcode-python | refs/heads/master | src/378. Kth Smallest Element in a Sorted Matrix.py | 1 |
import time
from heapq import *
class Solution(object):
def kthSmallest(self, matrix, k):
"""
:type matrix: List[List[int]]
:type k: int
:rtype: int
"""
heap = []
R = len(matrix)
p = [0] * R
while k > 0:
# time.sleep(0.1)
maxn = None
for r in xrange(R):
# print k, r, p, heap
if ... |
gholt/python-brim | refs/heads/master | brim/tcp_echo.py | 1 | """Contains a simple straight TCP socket application.
The application just echoes any incoming data back. This is a good
starting point for other TCP applications. See the source for what's
implemented and why.
Configuration Options::
[tcp_echo]
call = brim.tcp_echo.TCPEcho
# chunk_read = <bytes>
# ... |
MER-GROUP/intellij-community | refs/heads/master | python/helpers/pydev/stubs/_get_tips.py | 88 | import os.path
import inspect
import sys
# completion types.
TYPE_IMPORT = '0'
TYPE_CLASS = '1'
TYPE_FUNCTION = '2'
TYPE_ATTR = '3'
TYPE_BUILTIN = '4'
TYPE_PARAM = '5'
def _imp(name, log=None):
try:
return __import__(name)
except:
if '.' in name:
sub = name[0:name.rfind('.')]
... |
kinoraw/kinoraw_tools | refs/heads/master | datamosh.py | 1 | import bpy, os
from bpy.props import IntProperty, StringProperty, BoolProperty
import subprocess
from . import functions
proxy_qualities = [ ( "1", "25%", "" ), ( "2", "50%", "" ),
( "3", "75%", "" ), ( "4", "100%", "" ),
( "5", "none", "" )]
# functions
def createdatamos... |
ej2/pixelpuncher | refs/heads/master | pixelpuncher/location/utils.py | 1 | import random
from pixelpuncher.game.utils.message import add_game_message
from pixelpuncher.location.models import Location, ServiceType
def assign_starting_locations(player):
locations = Location.objects.filter(starting_location=True)
for location in locations.all():
unlock_location(player, locati... |
topxiaoke/myedx | refs/heads/master | common/djangoapps/util/bad_request_rate_limiter.py | 46 | """
A utility class which wraps the RateLimitMixin 3rd party class to do bad request counting
which can be used for rate limiting
"""
from ratelimitbackend.backends import RateLimitMixin
class BadRequestRateLimiter(RateLimitMixin):
"""
Use the 3rd party RateLimitMixin to help do rate limiting on the Password R... |
sturmf/regatta | refs/heads/master | regatta/model/sailing_club.py | 1 | import uuid
from .guid import GUID
from sqlalchemy import Column, Integer, String, Boolean
from .base import BASE
class SailingClub(BASE):
__tablename__ = 'sailing_club'
__table_args__ = {'sqlite_autoincrement': True}
id = Column(Integer, primary_key=True)
"""a unique id independent of database save"... |
matthiasdiener/spack | refs/heads/develop | lib/spack/llnl/util/filesystem.py | 1 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
dsanders11/django-advanced-filters | refs/heads/master | tests/customers/admin.py | 1 | from django.contrib import admin
from advanced_filters.admin import AdminAdvancedFiltersMixin
from .models import Client
class ClientAdmin(AdminAdvancedFiltersMixin, admin.ModelAdmin):
advanced_filter_fields = ('language', 'first_name', 'rep',
('assigned_to__email', 'Sales Rep.'))
... |
dplorimer/osf | refs/heads/master | website/addons/figshare/messages.py | 24 | # MODEL MESSAGES :model.py
BEFORE_PAGE_LOAD_PRIVATE_NODE_MIXED_FS = 'Warning: This OSF {category} is private but figshare project {project_id} may contain some public files or filesets.'
BEFORE_PAGE_LOAD_PUBLIC_NODE_MIXED_FS = 'Warning: This OSF {category} is public but figshare project {project_id} may contain some p... |
MihaiMoldovanu/ansible | refs/heads/devel | lib/ansible/modules/notification/osx_say.py | 29 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Michael DeHaan <michael@ansible.com>
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',... |
weichen2046/algorithm-study | refs/heads/master | algorithms/python/greedy/selection_sort.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
A well-known sort algorithm, called Selection Sort. It is an application of
greedy strategy.
'''
def sort(array, order='asc'):
'''
Greedy approach to sort an array in ascending or descending order.
This sort algorithm also known as Selection Sort.
'''... |
vmalloc/pydeploy | refs/heads/master | tests/test__environment_utils.py | 1 | from .test_cases import ForgeTest
from pydeploy.environment import Environment
from pydeploy import environment_utils
class EnvironmentUtilsTest(ForgeTest):
def setUp(self):
super(EnvironmentUtilsTest, self).setUp()
self.env = self.forge.create_mock(Environment)
self.forge.replace(environme... |
JulyKikuAkita/PythonPrac | refs/heads/master | Design/ParkingLot.py | 1 | __source__ = 'https://www.bittiger.io/videos/DTGFfA5s3XdCTbGxG/TpxCSKrGpiKwuhP32'
# Implement a ( )
#
#
FurtherReading = '''
'''
#
#
#
VideoLecture = '''
summary: https://www.bittiger.io/videos/DTGFfA5s3XdCTbGxG/TpxCSKrGpiKwuhP32
面向对象是广为流传的设计思想,但是有太多的人沉迷于于此,甚至做出了过渡复杂的设计。在我看来,设计分三步:
第一步是还原世界。无论是设计停车场、还是设计21点扑克、还是设... |
jdemon519/cfme_tests | refs/heads/master | cfme/control/explorer/__init__.py | 2 | # -*- coding: utf-8 -*-
from navmazing import NavigateToSibling
from widgetastic.widget import View
from widgetastic_manageiq import ManageIQTree
from widgetastic_patternfly import Accordion, Dropdown
from cfme import BaseLoggedInPage
from cfme.base import Server
from utils.appliance.implementations.ui import navigato... |
wooga/airflow | refs/heads/master | tests/providers/amazon/aws/hooks/test_sns.py | 1 | #
# 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... |
Jaccorot/python | refs/heads/master | Jaccorot/0002/0002.py | 8 | #!/usr/local/bin/python
#coding=utf-8
#第 0002 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。
import uuid
import MySQLdb
def create_code(num, length):
#生成”num“个激活码,每个激活码含有”length“位
result = []
while True:
uuid_id = uuid.uuid1()
temp = str(uuid_id).replace('-', '')[:length]
if temp not... |
etashjian/ECE757-final | refs/heads/master | src/mem/slicc/symbols/Func.py | 43 | # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# 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 co... |
bkirui/odoo | refs/heads/8.0 | addons/delivery/__init__.py | 376 | # -*- 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... |
czhengsci/pymatgen | refs/heads/master | pymatgen/analysis/diffraction/xrd.py | 6 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
from math import sin, cos, asin, pi, degrees, radians
import os
import collections
import numpy as np
import json
from pymatgen.core.spectrum import Spectrum... |
tntnatbry/tensorflow | refs/heads/master | tensorflow/contrib/learn/python/learn/tests/dataframe/__init__.py | 118 | # Copyright 2016 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... |
xHeliotrope/injustice_dropper | refs/heads/master | env/lib/python3.4/site-packages/twilio/twiml.py | 21 | """
Make sure to check out the TwiML overview and tutorial at
https://www.twilio.com/docs/api/twiml
"""
import xml.etree.ElementTree as ET
from .exceptions import TwimlException
class Verb(object):
"""Twilio basic verb object.
"""
GET = "GET"
POST = "POST"
nestables = None
def __init__(self,... |
roubert/python-phonenumbers | refs/heads/dev | python/phonenumbers/data/region_AX.py | 11 | """Auto-generated file, do not edit by hand. AX metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_AX = PhoneMetadata(id='AX', country_code=358, international_prefix='00|99[049]',
general_desc=PhoneNumberDesc(national_number_pattern='[135]\\d{5,9}|[27]\\d{4,9}|4\\d{... |
wger-project/wger | refs/heads/master | wger/gym/migrations/0001_initial.py | 1 | # -*- coding: utf-8 -*-
from django.db import models, migrations
from django.conf import settings
import wger.gym.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
... |
beschulz/ved-decoder | refs/heads/master | lib/googlepb/protobuf/reflection.py | 2 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.googlepb.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions... |
UnrememberMe/pants | refs/heads/master | src/python/pants/util/strutil.py | 12 | # 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 re
import shl... |
wildjan/Flask | refs/heads/master | Work/Trivia - Module 5/env/Lib/site-packages/pip/_vendor/requests/sessions.py | 294 | # -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
from collections import Mapping
from datetime import datetime
from .auth import _basic_auth_str
from .compat import cookielib, Or... |
sudhirmohanraj/python_koans | refs/heads/master | python3/koans/triangle.py | 111 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Triangle Project Code.
# Triangle analyzes the lengths of the sides of a triangle
# (represented by a, b and c) and returns the type of triangle.
#
# It returns:
# 'equilateral' if all sides are equal
# 'isosceles' if exactly 2 sides are equal
# 'scalene' ... |
luamct/WebSci14 | refs/heads/master | dbmanager.py | 1 | '''
Created on Sep 24, 2012
@author: luam
'''
import MySQLdb
import socket
from sklearn.feature_extraction.dict_vectorizer import DictVectorizer
import numpy as np
import random
import math
class NothingToProcessException(Exception):
""" Raised when there are no more available pins on the DB """
pass
class DBMa... |
BT-ojossen/sale-workflow | refs/heads/8.0 | __unported__/product_special_type_sale/__openerp__.py | 33 | # -*- coding: utf-8 -*-
#
#
# Author: Guewen Baconnier
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License... |
dkubiak789/OpenUpgrade | refs/heads/8.0 | addons/purchase/edi/__init__.py | 448 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GN... |
GbalsaC/bitnamiP | refs/heads/master | venv/lib/python2.7/site-packages/method_override/templatetags/method_override.py | 2 | from __future__ import absolute_import
from django.template import Library, Node, Variable
from method_override import settings
__all__ = ['method_override']
register = Library()
@register.simple_tag
def method_override(method):
'''Renders a hidden input with the method override value.'''
return setting... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.