repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
waseem18/oh-mainline | refs/heads/master | vendor/packages/twisted/twisted/internet/iocpreactor/__init__.py | 84 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
I/O Completion Ports reactor
"""
from twisted.internet.iocpreactor.reactor import install
__all__ = ['install']
|
agrista/odoo-saas | refs/heads/master | addons/website_crm_partner_assign/__init__.py | 3964 | import controllers
import models
|
giorda-a/Domoleaf | refs/heads/master | domomaster/etc/domoleaf/cron/CronLogsCalc.py | 2 | #!/usr/bin/python3
import sys
sys.path.append('/usr/lib/domoleaf')
import socket
import json
from DaemonConfigParser import *;
if __name__ == "__main__":
try:
print("hey cron");
parser = DaemonConfigParser('/etc/domoleaf/master.conf')
ip = '127.0.0.1'
port = parser.getValueFromSect... |
yanchen036/tensorflow | refs/heads/master | tensorflow/examples/adding_an_op/cuda_op.py | 192 | # 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... |
django-notifications/django-notifications | refs/heads/master | notifications/tests/tests.py | 1 | '''
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
'''
# -*- coding: utf-8 -*-
# pylint: disable=too-many-lines,missing-docstring
import json
import pytz
from django.conf import settings
from... |
VestalNetSciHigh/store | refs/heads/master | code/calculate_stats.py | 1 | __author__ = 'VestalNetSciHigh'
""" Read in data (and array of distance metrics) and calculate various stats """
import time
# from numpy import loadtxt
import numpy
import settings
import datetime
start_time = time.time()
print "Started: " + datetime.datetime.fromtimestamp(start_time).strftime('%Y-%m-%d %H:%M:%S')
... |
j0057/ansible-1 | refs/heads/fix-powershell-shebang-not-found | lib/ansible/runner/lookup_plugins/fileglob.py | 176 | # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... |
hmgaudecker/econ-project-templates | refs/heads/master | {{cookiecutter.project_slug}}/.mywaflib/waflib/extras/fluid.py | 55 | #!/usr/bin/python
# encoding: utf-8
# Grygoriy Fuchedzhy 2009
"""
Compile fluid files (fltk graphic library). Use the 'fluid' feature in conjunction with the 'cxx' feature.
"""
from waflib import Task
from waflib.TaskGen import extension
class fluid(Task.Task):
color = 'BLUE'
ext_out = ['.h']
run_str = '${FLUID... |
scaphilo/koalixcrm | refs/heads/master | projectsettings/__init__.py | 14224 | # -*- coding: utf-8 -*-
|
superbobry/climin | refs/heads/master | climin/mathadapt.py | 1 | """This module provides functionality which is usable for
coding towards gnumpy and numpy: the idea is to avoid if clauses
in the optimizer code.
"""
import numpy as np
try:
import gnumpy as gp
except ImportError:
pass
def sqrt(x):
"""Return an array of the same shape containing the element square
... |
khaledhassan/python-xbee | refs/heads/master | examples/serial_example_series_1.py | 42 | #! /usr/bin/python
from xbee import XBee
import serial
"""
serial_example.py
By Paul Malmsten, 2010
Demonstrates reading the low-order address bits from an XBee Series 1
device over a serial port (USB) in API-mode.
"""
def main():
"""
Sends an API AT command to read the lower-order address bits from
an... |
ansible/ansible-modules-extras | refs/heads/devel | cloud/amazon/sqs_queue.py | 23 | #!/usr/bin/python
# 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 distributed... |
RedHatInsights/insights-core | refs/heads/master | insights/combiners/tomcat_virtual_dir_context.py | 1 | """
TomcatVirtualDirContextCombined - check VirtualDirContext option used in Tomcat
===============================================================================
This combiner provides information about whether a VirtualDirContext is used in config files in
both default locations or location derived from running Tom... |
kidaa/encoded | refs/heads/master | src/encoded/upgrade/rnai.py | 1 | from contentbase import upgrade_step
from .shared import ENCODE2_AWARDS
@upgrade_step('rnai', '', '2')
def rnai_0_2(value, system):
# http://redmine.encodedcc.org/issues/1295
# http://redmine.encodedcc.org/issues/1307
if 'status' in value:
if value['status'] == 'DELETED':
value['statu... |
escherba/phraser | refs/heads/master | phraser/cc/preprocess/data_import/html_entity/generate_html_entity_parser_data.py | 2 | #!/usr/bin/python
# Generate tokenization-related normalization data as C++ source code.
#
# We have to do this custom because of specific requirements to match the Penn
# Treebank training data.
import codecs
import re
def each_line(file_name, encoding='utf-8'):
with codecs.open(file_name, encoding=encoding) a... |
simbha/mAngE-Gin | refs/heads/master | lib/Django 1.7/django/contrib/gis/geos/geometry.py | 3 | """
This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
inherit from this object.
"""
from __future__ import unicode_literals
# Python, ctypes and types dependencies.
from ctypes import addressof, byref, c_double
# super-class for mutable list behavior
from django.contrib.gis.geos.mutable_lis... |
jm-begon/clustertools | refs/heads/master | continuous_integration/configure_slurm.py | 1 | # This file is taken from the Pulsar project
# (https://github.com/galaxyproject/pulsar) which is apache 2.0
#
from socket import gethostname
from string import Template
from subprocess import call
from getpass import getuser
SLURM_CONFIG_TEMPLATE = '''
# slurm.conf file generated by configurator.html.
# Put this fi... |
mhaberler/machinekit | refs/heads/master | share/fdm/thermistor_tables/Marlin_converter/ConvertTable.py | 12 | #!/usr/bin/python
# encoding: utf-8
"""
ConvertTable.py
Created by Alexander Rössler on 2014-03-24.
"""
import argparse
import string
def v2R(value):
return (4700.0*value)/(1024.0-value)
parser = argparse.ArgumentParser(description='Converts a Marlin thermistor table to Machinekit thermistor table')
parser.add... |
jrrembert/django | refs/heads/master | tests/dates/models.py | 194 | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Article(models.Model):
title = models.CharField(max_length=100)
pub_date = models.DateField()
categories = models.ManyToManyField("Categor... |
fireeye/flare-ida | refs/heads/master | python/flare/code_grafter.py | 1 | # -*- coding: utf-8 -*-
# Copyright (C) 2019 FireEye, Inc. All Rights Reserved.
"""Code grafting: Static linking of code into IDA Databases to aid emulation.
Code Grafting allows you to graft static implementations of imported
functions into your IDA Database (IDB) for purposes of emulation in Bochs IDB
mode or by ot... |
ga7g08/sympy | refs/heads/master | sympy/physics/matrices.py | 91 | """Known matrices related to physics"""
from __future__ import print_function, division
from sympy import Matrix, I, pi, sqrt
from sympy.functions import exp
from sympy.core.compatibility import range
def msigma(i):
r"""Returns a Pauli matrix `\sigma_i` with `i=1,2,3`
References
==========
.. [1] ... |
mitchrule/Miscellaneous | refs/heads/master | Django_Project/django/Lib/site-packages/django/db/backends/sqlite3/introspection.py | 42 | import re
from django.db.backends.base.introspection import (
BaseDatabaseIntrospection, FieldInfo, TableInfo,
)
field_size_re = re.compile(r'^\s*(?:var)?char\s*\(\s*(\d+)\s*\)\s*$')
def get_field_size(name):
""" Extract the size number from a "varchar(11)" type name """
m = field_size_re.search(name)
... |
fxia22/ASM_xf | refs/heads/master | PythonD/lib/python2.4/xml/dom/pulldom.py | 322 | import xml.sax
import xml.sax.handler
import types
try:
_StringTypes = [types.StringType, types.UnicodeType]
except AttributeError:
_StringTypes = [types.StringType]
START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT"
COMMENT = "COMMENT"
START_DOCUMENT = "START_DOCUMENT"
END_DOCUMENT = "END_DOCUMENT"
... |
vadimtk/chrome4sdp | refs/heads/master | tools/telemetry/telemetry/internal/backends/chrome/chrome_browser_backend.py | 6 | # 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.
import logging
import pprint
import shlex
import sys
from telemetry.core import exceptions
from telemetry.core import util
from telemetry import decorators
... |
ProfessorX/Config | refs/heads/master | .PyCharm30/system/python_stubs/-1247972723/PyQt4/QtGui/QSyntaxHighlighter.py | 2 | # encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QSyntaxHighlighter(__PyQt4_QtCore.QObject):
"""
QSyntaxHighlighter(QTextEdit)
QSyntaxHighlighter(QTextDocument)
QSyntaxHigh... |
openmv/openmv | refs/heads/master | scripts/examples/OpenMV/14-WiFi-Shield/ntp.py | 3 | # NTP Example
#
# This example shows how to get the current time using NTP with the WiFi shield.
import network, usocket, ustruct, utime
SSID='' # Network SSID
KEY='' # Network key
TIMESTAMP = 2208988800+946684800
# Init wlan module and connect to network
print("Trying to connect... (may take a while)...")
wlan =... |
Javex/mixminion | refs/heads/master | lib/mixminion/__init__.py | 6 | # Copyright 2002-2011 Nick Mathewson. See LICENSE for licensing information.
"""mixminion
Client and shared code for type III anonymous remailers.
"""
# This version string is generated from setup.py; don't edit it.
__version__ = "0.0.8alpha3"
# This 5-tuple encodes the version number for comparison. Don't e... |
msebire/intellij-community | refs/heads/master | python/lib/Lib/codecs.py | 116 | """ codecs -- Python Codec Registry, API and helpers.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import __builtin__, sys
### Registry and builtin stateless codec functions
try:
from _codecs import *
except ImportError, why:
raise SystemErr... |
huanpc/IoT-1 | refs/heads/master | gui/controller/.venv/lib/python3.5/site-packages/django/conf/locale/zh_Hant/formats.py | 1008 | # -*- 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 = 'Y年n月j日' # 2016年9月5... |
nicolas998/Op_Radar | refs/heads/master | 06_Codigos/Genera_Mapa_Slides.py | 1 | #!/usr/bin/env python
import argparse
import textwrap
import numpy as np
import os
from wmf import wmf
import pylab as pl
#Parametros de entrada del trazador
parser=argparse.ArgumentParser(
prog='Genera_Grafica_Qsim',
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent('''\
Genera l... |
maartenq/ansible | refs/heads/devel | lib/ansible/modules/storage/purestorage/purefa_volume.py | 24 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018, Simon Dodsley (simon@purestorage.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',... |
meganchang/Stem | refs/heads/master | test/unit/descriptor/extrainfo_descriptor.py | 3 | """
Unit tests for stem.descriptor.extrainfo_descriptor.
"""
import datetime
import unittest
from stem.descriptor.extrainfo_descriptor import ExtraInfoDescriptor, DirResponses, DirStats
CRYPTO_BLOB = """
K5FSywk7qvw/boA4DQcqkls6Ize5vcBYfhQ8JnOeRQC9+uDxbnpm3qaYN9jZ8myj
k0d2aofcVbHr4fPQOSST0LXDrhFl5Fqo5um296zpJGvRUeO6S... |
thnee/ansible | refs/heads/devel | lib/ansible/modules/network/iosxr/iosxr_lacp.py | 20 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is au... |
DefyVentures/edx-platform | refs/heads/master | lms/djangoapps/courseware/features/registration.py | 102 | # pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from lettuce import world, step
from lettuce.django import django_url
import time
@step('I register for the course "([^"]*)"$')
def i_register_for_the_course(_step, course):
url = django_url('courses/%s/about' % world.scenario_dict['COURS... |
ivaano/zato | refs/heads/master | code/alembic/versions/0011_1500abb1cf3_gh184_bring_up_to_date.py | 7 | """gh184 Bring Alembic migrations up to date
Revision ID: 0011_1500abb1cf3
Revises: 0010_3f03ae0ef253
Create Date: 2014-04-11 09:25:03.206296
"""
# revision identifiers, used by Alembic.
revision = '0011_1500abb1cf3'
down_revision = '0010_3f03ae0ef253'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.... |
kdwink/intellij-community | refs/heads/master | python/testData/completion/initParams.after.py | 83 | class C:
def __init__(self, auno=True): pass
c = C(auno=)
|
glorizen/nupic | refs/heads/master | tests/unit/nupic/encoders/delta_test.py | 28 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... |
CINPLA/python-neo | refs/heads/master | neo/test/coretest/test_analogsignal.py | 1 | # -*- coding: utf-8 -*-
"""
Tests of the neo.core.analogsignal.AnalogSignal class and related functions
"""
# needed for python 3 compatibility
from __future__ import division
import os
import pickle
try:
import unittest2 as unittest
except ImportError:
import unittest
import numpy as np
import quantities a... |
Proggie02/TestRepo | refs/heads/master | django/conf/locale/de/formats.py | 107 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j. F Y H:i:s'
YEAR_MONTH... |
pakra1/inf1340_2015_asst1 | refs/heads/master | exercise3.py | 6 | #!/usr/bin/env python
""" Assignment 1, Exercise 3, INF1340, Fall, 2015. Troubleshooting Car Issues.
This module contains one function diagnose_car(). It is an expert system to
interactive diagnose car issues.
"""
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2015 Susan Sim"
__license__... |
mhils/mitmproxy | refs/heads/master | examples/addons/events-websocket-specific.py | 1 | """WebSocket-specific events."""
import mitmproxy.http
import mitmproxy.websocket
class Events:
# WebSocket lifecycle
def websocket_handshake(self, flow: mitmproxy.http.HTTPFlow):
"""
Called when a client wants to establish a WebSocket connection. The
WebSocket-specific headers... |
nikpap/inspire-next | refs/heads/master | inspirehep/modules/forms/bundles.py | 2 | # -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014, 2015 CERN.
#
# INSPIRE 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... |
alanjw/GreenOpenERP-Win-X86 | refs/heads/7.0 | python/Lib/distutils/file_util.py | 55 | """distutils.file_util
Utility functions for operating on single files.
"""
__revision__ = "$Id$"
import os
from distutils.errors import DistutilsFileError
from distutils import log
# for generating verbose output in 'copy_file()'
_copy_action = {None: 'copying',
'hard': 'hard linking',... |
kastnerkyle/pylearn2 | refs/heads/master | pylearn2/expr/normalize.py | 5 | """
Code for normalizing outputs of MLP / convnet layers.
"""
__authors__ = "Ian Goodfellow and David Warde-Farley"
__copyright__ = "Copyright 2013, Universite de Montreal"
__credits__ = ["Ian Goodfellow and David Warde-Farley"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegro... |
jonlooney/jxmlease | refs/heads/master | jxmlease/dictnode.py | 1 | #!/usr/bin/env python
# Copyright (c) 2015-2016, Juniper Networks, Inc.
# All rights reserved.
#
# Copyright (C) 2012 Martin Blech and individual contributors.
#
# See the LICENSE file for further information.
"""Module that provides the XMLDictNode class."""
from __future__ import absolute_import
from xml.sax.xmlread... |
joshfriend/sqlalchemy-utils | refs/heads/master | sqlalchemy_utils/decorators.py | 2 | from collections import defaultdict
import itertools
import sqlalchemy as sa
import six
from .functions import getdotattr
class AttributeValueGenerator(object):
def __init__(self):
self.listener_args = [
(
sa.orm.mapper,
'mapper_configured',
self... |
csm-aut/csm | refs/heads/master | csmserver/views/host_dashboard.py | 1 | # =============================================================================
# Copyright (c) 2016, Cisco Systems, 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 sour... |
ninotoshi/tensorflow | refs/heads/master | tensorflow/python/kernel_tests/softplus_op_test.py | 15 | # 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... |
diedthreetimes/VCrash | refs/heads/master | src/visualizer/visualizer/hud.py | 189 | import goocanvas
import core
import math
import pango
import gtk
class Axes(object):
def __init__(self, viz):
self.viz = viz
self.color = 0x8080C0FF
self.hlines = goocanvas.Path(parent=viz.canvas.get_root_item(), stroke_color_rgba=self.color)
self.hlines.lower(None)
self.vl... |
h2oai/h2o-3 | refs/heads/master | h2o-py/tests/pyunit_utils/utilsPY.py | 1 | # Py2 compat
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from past.builtins import basestring
# standard lib
import copy
import datetime
from decimal import *
from functools import reduce
import imp
import json
import math
import os
import random
import ... |
zxjzxj9/FlaskBoard | refs/heads/master | web/lib/python2.7/site-packages/setuptools/command/__init__.py | 101 | __all__ = [
'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop',
'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts',
'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts',
'register', 'bdist_wininst', 'upload_docs', 'upload',
]
from distutils.command... |
City-of-Helsinki/kerrokantasi | refs/heads/master | democracy/__init__.py | 3 | default_app_config = 'democracy.apps.DemocracyAppConfig'
|
bzbarsky/servo | refs/heads/master | components/script/dom/bindings/codegen/parser/tests/test_putForwards.py | 142 | def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface I {
[PutForwards=B] readonly attribute long A;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown.")
parse... |
niknow/scipy | refs/heads/master | scipy/io/matlab/tests/test_byteordercodes.py | 126 | ''' Tests for byteorder module '''
from __future__ import division, print_function, absolute_import
import sys
from numpy.testing import assert_raises, assert_, run_module_suite
import scipy.io.matlab.byteordercodes as sibc
def test_native():
native_is_le = sys.byteorder == 'little'
assert_(sibc.sys_is_le... |
patrabu/dl120th | refs/heads/master | dat2db.py | 1 | #! /usr/bin/python
# -*- coding: utf-8 -*-
#
# dat2db - Put content of dat file from the Voltcraft DL-120TH into DB.
#
# Copyright 2012, 2015 Patrick Rabu
import argparse
import sys
import sqlite3
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Insert content of dat file into sq... |
xinjiguaike/edx-platform | refs/heads/master | openedx/core/djangoapps/credit/signature.py | 69 | """
Calculate digital signatures for messages sent to/from credit providers,
using a shared secret key.
The signature is calculated as follows:
1) Encode all parameters of the request (except the signature) in a string.
2) Encode each key/value pair as a string of the form "{key}:{value}".
3) Concatenate ... |
jackm/Kijiji-Repost-Headless | refs/heads/master | kijiji_repost_headless/get_ids.py | 1 | import json
import requests
def find_where(d, area_id=None):
"""
:param d: dictionary available here: http://www.kijiji.ca/j-locations.json
:param area_id: string, parent's region's ID
:return: tuple, containing the location id and area id of the selected_dict region
"""
list_of_dicts = sort... |
formiano/enigma2-4.4 | refs/heads/master | lib/python/Plugins/SystemPlugins/DeviceManager/HddMount.py | 16 | # for localized messages
from . import _
from enigma import *
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Screens.VirtualKeyBoard import VirtualKeyBoard
from Components.ActionMap import ActionMap
from Components.MenuList import MenuList
from Components.GUIComponent import GUIComp... |
jessedhillon/zulip | refs/heads/master | zerver/test_hooks.py | 103 | # -*- coding: utf-8 -*-
from zerver.lib.test_helpers import AuthedTestCase
from zerver.lib.test_runner import slow
from zerver.models import Message
import ujson
class JiraHookTests(AuthedTestCase):
def send_jira_message(self, action):
email = "hamlet@zulip.com"
api_key = self.get_api_key(email)
... |
voberoi/python-magento | refs/heads/master | magento/magento_ipython_shell.py | 1 | #!/usr/bin/env python
import sys
import argparse
from magento import MagentoAPI
try:
from IPython import embed
except:
print "You must have IPython installed to use this shell. Try"
print "'pip install ipython', 'easy_install ipython' , or head"
print "over to ipython.org."
sys.exit(1)
def main()... |
fhamborg/news-please | refs/heads/master | newsplease/helper_classes/class_loader.py | 1 | import importlib
class ClassLoader:
@classmethod
def from_string(cls, class_name):
if "." not in class_name:
raise ImportError("{0} doesn't look like a module path".format(class_name))
module_name = ".".join(class_name.split(".")[:-1])
class_name = class_name.split(".")[-1]
try:
loaded_module = impo... |
ychfan/tensorflow | refs/heads/master | tensorflow/examples/tutorials/word2vec/word2vec_basic.py | 13 | # 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... |
RAtechntukan/CouchPotatoServer | refs/heads/develop | libs/subliminal/async.py | 106 | # -*- coding: utf-8 -*-
# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com>
#
# This file is part of subliminal.
#
# subliminal is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 3 of... |
hgl888/chromium-crosswalk-efl | refs/heads/efl/crosswalk-10/39.0.2171.19 | build/copy_test_data_ios.py | 206 | #!/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.
"""Copies test data files or directories into a given output directory."""
import optparse
import os
import shutil
import sys
cla... |
rlworkgroup/metaworld | refs/heads/master | metaworld/policies/sawyer_plate_slide_v2_policy.py | 1 | import numpy as np
from metaworld.policies.action import Action
from metaworld.policies.policy import Policy, assert_fully_parsed, move
class SawyerPlateSlideV2Policy(Policy):
@staticmethod
@assert_fully_parsed
def _parse_obs(obs):
return {
'hand_pos': obs[:3],
'unused_1'... |
icelic/eks | refs/heads/master | py/django_eks/migrations/0008_auto_20170605_1524.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_eks', '0007_auto_20170529_0031'),
]
operations = [
migrations.RemoveField(
model_name='coursesimulation',... |
OpenFacetracker/facetracker-core | refs/heads/master | lib/youtube-dl/youtube_dl/extractor/bild.py | 31 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
class BildIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?bild\.de/(?:[^/]+/)+(?P<display_id>[^/]+)-(?P<id>\d+)(?:,auto=true)?\.bild\.html'
IE_DESC = 'Bild.de'
_TEST = {
... |
marcore/edx-platform | refs/heads/master | common/djangoapps/dark_lang/middleware.py | 46 | """
Middleware for dark-launching languages. These languages won't be used
when determining which translation to give a user based on their browser
header, but can be selected by setting the ``preview-lang`` query parameter
to the language code.
Adding the query parameter ``clear-lang`` will reset the language stored
... |
RichDijk/eXe | refs/heads/master | nevow/test/test_i18n.py | 14 | from twisted.trial import unittest
from cStringIO import StringIO
from nevow import inevow, flat, context, tags, loaders, rend
from nevow import i18n
def mockTranslator(s, domain=None):
args = {}
if domain is not None:
args['domain'] = domain
return 'MOCK(%s)[%s]' % (', '.join(['%s=%r' % (k,v)
... |
Lekanich/intellij-community | refs/heads/master | python/testData/refactoring/move/packageImport/after/src/a.py | 45382 | |
home-assistant/home-assistant | refs/heads/dev | tests/components/facebox/test_image_processing.py | 8 | """The tests for the facebox component."""
from unittest.mock import Mock, mock_open, patch
import pytest
import requests
import requests_mock
import homeassistant.components.facebox.image_processing as fb
import homeassistant.components.image_processing as ip
from homeassistant.const import (
ATTR_ENTITY_ID,
... |
sonnyhu/scipy | refs/heads/master | scipy/weave/tests/test_slice_handler.py | 96 | from __future__ import absolute_import, print_function
import parser
from numpy.testing import TestCase, assert_equal, run_module_suite
from scipy.weave import slice_handler
from scipy.weave.slice_handler import indexed_array_pattern
from scipy.weave.ast_tools import ast_to_string, find_first_pattern
from weave_test... |
harshilasu/GraphicMelon | refs/heads/master | y/google-cloud-sdk/lib/jinja2/meta.py | 659 | # -*- coding: utf-8 -*-
"""
jinja2.meta
~~~~~~~~~~~
This module implements various functions that exposes information about
templates that might be interesting for various kinds of applications.
:copyright: (c) 2010 by the Jinja Team, see AUTHORS for more details.
:license: BSD, see LICENSE fo... |
blaggacao/OpenUpgrade | refs/heads/8.0 | addons/account_test/__init__.py | 441 | import account_test
import report
|
tangledhelix/SublimeLinter-for-ST2 | refs/heads/master | sublimelinter/modules/objective-j.py | 9 | # objective-j.py - Lint checking for Objective-J - given filename and contents of the code:
# It provides a list of line numbers to outline and offsets to highlight.
#
# This specific module is part of the SublimeLinter project.
# It is a fork of the original SublimeLint project,
# (c) 2011 Ryan Hileman and licensed un... |
mick-d/nipype_source | refs/heads/master | nipype/interfaces/fsl/tests/test_auto_ContrastMgr.py | 5 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.fsl.model import ContrastMgr
def test_ContrastMgr_inputs():
input_map = dict(args=dict(argstr='%s',
),
contrast_num=dict(argstr='-cope',
),
corrections=dict(copyfile=False,
manda... |
ekampf/webapp2_requestparser | refs/heads/master | tests/reqparse/arguments/__init__.py | 14224 | # -*- coding: utf-8 -*-
|
chaowyc/youtube-dl | refs/heads/master | youtube_dl/extractor/libsyn.py | 106 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import unified_strdate
class LibsynIE(InfoExtractor):
_VALID_URL = r'(?P<mainurl>https?://html5-player\.libsyn\.com/embed/episode/id/(?P<id>[0-9]+))'
_TESTS = [{
'url': 'http://html5-pla... |
lmyrefelt/CouchPotatoServer | refs/heads/develop | couchpotato/core/plugins/userscript/main.py | 1 | from couchpotato import index
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.variable import isDict
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.environment import Env
from tornado... |
botswana-harvard/edc-tracker | refs/heads/develop | edc_quota/controller/models.py | 2 | from django.db import models
from django.utils import timezone
class ControllerQuota(models.Model):
"""Controllers quota model where each instance refers to a quota that
this controller is managing.
For example, a quota on the controller might be an enrollment cap
(target) of 3000 applied to the mode... |
jgonthier/psi4 | refs/heads/master | psi4/driver/qcdb/libmintsmolecule.py | 3 | #
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2019 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... |
apache/incubator-airflow | refs/heads/master | tests/providers/google/cloud/hooks/test_automl.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... |
jallohm/django | refs/heads/master | django/views/decorators/vary.py | 586 | from functools import wraps
from django.utils.cache import patch_vary_headers
from django.utils.decorators import available_attrs
def vary_on_headers(*headers):
"""
A view decorator that adds the specified headers to the Vary header of the
response. Usage:
@vary_on_headers('Cookie', 'Accept-langu... |
schinke/solid-fortnight-ba | refs/heads/master | flask/venv/lib/python2.7/site-packages/psycopg2/_range.py | 47 | """Implementation of the Range type and adaptation
"""
# psycopg/_range.py - Implementation of the Range type and adaptation
#
# Copyright (C) 2012 Daniele Varrazzo <daniele.varrazzo@gmail.com>
#
# psycopg2 is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public ... |
UNINETT/PyMetric | refs/heads/master | command.py | 1 | from cmd import Cmd
import readline
import networkx as nx
import sys
import os.path
from pajek import read_pajek
from model import Simulation, Model
from config import Config
from plotting import PlotUI
from textwrap import TextWrapper
from termcolor import colored, colored2, colored3
import utils
class MetricShell(Cm... |
zaina/nova | refs/heads/master | nova/scheduler/filters/metrics_filter.py | 42 | # Copyright (c) 2014 Intel, 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 ... |
remyroy/uwsgi | refs/heads/master | examples/bootstrap5.py | 34 | import uwsgi
print uwsgi.extract("data://0")
|
GenericStudent/home-assistant | refs/heads/dev | homeassistant/components/ovo_energy/config_flow.py | 5 | """Config flow to configure the OVO Energy integration."""
import aiohttp
from ovoenergy.ovoenergy import OVOEnergy
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigFlow
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from .const import CONF... |
HPPTECH/hpp_IOSTressTest | refs/heads/master | Refer/IOST_OLD_SRC/IOST_0.19/Libs/IOST_WMain/IOST_WMain_I2C.py | 2 | #!/usr/bin/python
#======================================================================
#
# Project : hpp_IOStressTest
# File : Libs/IOST_WMain/IOST_WMain_I2C.py
# Date : Oct 20, 2016
# Author : HuuHoang Nguyen
# Contact : hhnguyen@apm.com
# : hoangnh.hpp@gmail.com
# License : MIT License
# Copy... |
jrrembert/django | refs/heads/master | tests/utils_tests/test_itercompat.py | 569 | from django.test import TestCase
from .models import Category, Thing
class TestIsIterator(TestCase):
def test_regression(self):
"""This failed on Django 1.5/Py2.6 because category has a next method."""
category = Category.objects.create(name='category')
Thing.objects.create(category=categ... |
Workday/OpenFrame | refs/heads/master | tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/exceptions.py | 23 | #!/usr/bin/env python
"""Exceptions for generated client libraries."""
class Error(Exception):
"""Base class for all exceptions."""
class TypecheckError(Error, TypeError):
"""An object of an incorrect type is provided."""
class NotFoundError(Error):
"""A specified resource could not be found."""
... |
tietokilta-saato/tikplay | refs/heads/master | tikplay/provider/provider.py | 1 | #!/usr/bin/env python
# Part of tikplay
import importlib
import logging
import queue
from inspect import isclass
import provider.retrievers as retrievers
from .retriever import Retriever
from .task import Task
class Provider(object):
"""
Provides a method for getting the audio data off arbitrary URLs via dif... |
40223139/203739test | refs/heads/master | static/Brython3.1.0-20150301-090019/Lib/token.py | 743 | """Token constants (from "token.h")."""
__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF']
# This file is automatically generated; please don't muck it up!
#
# To update the symbols in this file, 'cd' to the top directory of
# the python source tree after building the interpreter and run:
#
# ./pyth... |
idncom/odoo | refs/heads/8.0 | addons/edi/models/res_currency.py | 437 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011-2012 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... |
kevinpark1217/PicoCTF-2017 | refs/heads/master | Much Ado About Hacking/calc.py | 1 | f = open('ending.txt', 'r')
text = f.read()
calc=text[0]
for i in range(1,len(text)-1,1):
c1 = ord(calc[i-1])
c = ord(text[i])
#c=((c1-32)+(o-32))%96+32
o = c-32+96+32+32-c1
if o > (96+32):
o = c-32+32+32-c1
calc += chr(o)
print calc[::-1]
|
Rodolfoarv/Mars-Explorer-AI-with-Python- | refs/heads/master | env/lib/python2.7/site-packages/pip/_vendor/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... |
globau/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/pywebsocket/src/test/set_sys_path.py | 496 | # Copyright 2009, 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... |
GiantSteps/essentia | refs/heads/master | test/src/unittest/temporal/test_logattacktime_streaming.py | 10 | #!/usr/bin/env python
# Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... |
harveybia/face-hack | refs/heads/master | venv/face/lib/python2.7/site-packages/setuptools/dist.py | 259 | __all__ = ['Distribution']
import re
import os
import sys
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.core import Distribution as _Distribution
from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
Distuti... |
hryamzik/ansible | refs/heads/devel | lib/ansible/module_utils/network/aireos/aireos.py | 85 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.