repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
fairyzoro/python | refs/heads/master | Jimmy66/0014/0014.py | 34 | #!/bin/env python
# -*- coding: utf-8 -*-
#导入模块
import simplejson as json
import xlwt
#从文件(JSON形式)中读取数据返回字典
def read_file(filename):
with open(filename,'r') as fp:
content = fp.read()
#simplejson这个模块还没细看,怎么解码还是需要了解下
d = json.JSONDecoder().decode(content)
return d
#生成对应的xls文件
def gen_xls(... |
JimCircadian/ansible | refs/heads/devel | lib/ansible/utils/module_docs_fragments/keycloak.py | 43 | # Copyright (c) 2017 Eike Frost <ei@kefro.st>
#
# 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 versi... |
lmprice/ansible | refs/heads/devel | lib/ansible/plugins/action/group_by.py | 31 | # Copyright 2012, Jeroen Hoekx <jeroen@hoekx.be>
#
# 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 ve... |
henocdz/python-social-auth | refs/heads/master | social/pipeline/__init__.py | 72 | DEFAULT_AUTH_PIPELINE = (
# Get the information we can about the user and return it in a simple
# format to create the user instance later. On some cases the details are
# already part of the auth response from the provider, but sometimes this
# could hit a provider API.
'social.pipeline.social_auth... |
oss/shrunk | refs/heads/master | backend/setup.py | 1 | #!/usr/bin/env python3
from typing import Any
import fnmatch
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py as _build_py
VERSION = '2.0.0'
AUTHOR = 'Rutgers Open System Solutions'
class build_py(_build_py):
EXCLUDED = ['shrunk/config.py']
def find_package_mod... |
joakim-hove/django | refs/heads/master | tests/test_utils/views.py | 481 | from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.template import Context, Template
from .models import Person
def get_person(request, pk):
person = get_object_or_404(Person, pk=pk)
return HttpResponse(person.name)
def no_template_used(request):
template = ... |
IKholopov/HackUPC2017 | refs/heads/master | hackupc/env/lib/python3.5/site-packages/django/contrib/gis/geometry/regex.py | 657 | import re
# Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure
# to prevent potentially malicious input from reaching the underlying C
# library. Not a substitute for good Web security programming practices.
hex_regex = re.compile(r'^[0-9A-F]+$', re.I)
wkt_regex = re.compile(r'^(SRID=(?P<srid... |
zolegus/neon | refs/heads/master | neon/backends/tests/test_randomstate.py | 10 | # ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems 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.o... |
mstriemer/zamboni | refs/heads/master | mkt/constants/ratingsbodies.py | 13 | # -*- coding: utf-8 -*-
from tower import ugettext_lazy as _lazy
NAME_GENERAL = _lazy('For all ages')
# L10n: %d is the age in years. For ages %d and higher.
NAME_LAZY = _lazy('For ages %d+') # Fill this in after accessing.
NAME_REJECTED = _lazy(u'Rating Rejected')
NAME_PENDING = _lazy(u'Rating Pending')
class RAT... |
bschoenfeld/virginia-court-data-analysis | refs/heads/master | past_due_costs_vs_income.py | 1 | import csv
import sys
from os import environ, listdir
from os.path import isfile, join
from pprint import pprint
from census import Census
import numpy as np
import matplotlib.pyplot as plt
'''
Graph Past Due Court Costs vs Median Income By Zipcode
- Get income data from Census at tract level
- Group court cases by z... |
shawnadelic/shuup | refs/heads/master | shuup/core/fields/__init__.py | 2 | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import decimal
import numbers
impo... |
wkentaro/chainer | refs/heads/master | chainer/functions/array/repeat.py | 9 | import six
from chainer import backend
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
class Repeat(function_node.FunctionNode):
"""Repeat elements of an array."""
def __init__(self, repeats, axis=None):
if isinstance(repeats, six.integer_types):
... |
simod/geonode | refs/heads/master | geonode/catalogue/backends/pycsw_local.py | 1 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
uppsaladatavetare/foobar-api | refs/heads/develop | src/foobar/migrations/0019_auto_20170221_1547.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-21 15:47
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('foobar', '0018_auto_20170220_1322'),
]
operations ... |
jasonbot/django | refs/heads/master | tests/utils_tests/models.py | 188 | from django.db import models
class Category(models.Model):
name = models.CharField(max_length=100)
def next(self):
return self
class Thing(models.Model):
name = models.CharField(max_length=100)
category = models.ForeignKey(Category, models.CASCADE)
|
uglyboxer/linear_neuron | refs/heads/master | net-p3/lib/python3.5/site-packages/matplotlib/fontconfig_pattern.py | 11 | """
A module for parsing and generating fontconfig patterns.
See the `fontconfig pattern specification
<http://www.fontconfig.org/fontconfig-user.html>`_ for more
information.
"""
# Author : Michael Droettboom <mdroe@stsci.edu>
# License : matplotlib license (PSF compatible)
# This class is defined here because it m... |
PetrDlouhy/django-crispy-forms | refs/heads/dev | crispy_forms/base.py | 10 | # -*- coding: utf-8 -*-
def from_iterable(iterables):
"""
Backport of `itertools.chain.from_iterable` compatible with Python 2.5
"""
for it in iterables:
for element in it:
if isinstance(element, dict):
for key in element:
yield key
e... |
andreiw/xen3-arm-tegra | refs/heads/master | tools/python/xen/xend/XendProtocol.py | 3 | #============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope th... |
cst13/canstel | refs/heads/master | tx.py | 2 | from moneywagon import (
get_unspent_outputs, CurrentPrice, get_optimal_fee, PushTx,
get_onchain_exchange_rates
)
from moneywagon.core import get_optimal_services, get_magic_bytes
from bitcoin import mktx, sign, pubtoaddr, privtopub
from .crypto_data import crypto_data
class Transaction(object):
def __init... |
simonwydooghe/ansible | refs/heads/devel | lib/ansible/modules/network/fortios/fortios_log_setting.py | 7 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... |
artwr/airflow | refs/heads/master | airflow/operators/latest_only_operator.py | 3 | # -*- 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
#... |
felipenaselva/felipe.repository | refs/heads/master | plugin.video.streamhub/resources/lib/modules/jsunpack.py | 67 | """
urlresolver XBMC Addon
Copyright (C) 2013 Bstrdsmkr
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.... |
nmabhi/Webface | refs/heads/master | api-docs/conf.py | 9 | #!/usr/bin/env python2
import sys
import mock
import os
sys.path.insert(0, os.path.abspath('..'))
MOCK_MODULES = ['argparse', 'cv2', 'dlib', 'numpy', 'numpy.linalg', 'pandas']
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.MagicMock()
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.coverage... |
75651/kbengine_cloud | refs/heads/master | kbe/res/scripts/common/Lib/lib2to3/__init__.py | 737 | #empty
|
TeMPO-Consulting/mediadrop | refs/heads/axitube | mediacore/config/environment.py | 1 | # This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2013 MediaCore Inc., Felix Schwarz and other contributors.
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See L... |
Dark-Hacker/flasky | refs/heads/master | app/api_1_0/users.py | 104 | from flask import jsonify, request, current_app, url_for
from . import api
from ..models import User, Post
@api.route('/users/<int:id>')
def get_user(id):
user = User.query.get_or_404(id)
return jsonify(user.to_json())
@api.route('/users/<int:id>/posts/')
def get_user_posts(id):
user = User.query.get_or... |
DevangS/CoralNet | refs/heads/master | images/migrations/0004_big_changes_to_image_and_metadata_and_add_location_value_models.py | 1 | # encoding: 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):
# Adding model 'Value2'
db.create_table('images_value2', (
('id', self.gf('django.db.models.fi... |
sgraham/nope | refs/heads/master | tools/cygprofile/mergetraces.py | 20 | #!/usr/bin/python
# 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.
# Use: ../mergetraces.py `ls cyglog.* -Sr` > merged_cyglog
""""Merge multiple logs files from different processes into a single log.
Give... |
DamCB/tyssue | refs/heads/master | tests/core/test_monolayer.py | 2 | from numpy.testing import assert_array_equal
import numpy as np
from tyssue.generation import extrude, three_faces_sheet
from tyssue import Monolayer, config, Sheet
from tyssue.core.monolayer import MonolayerWithLamina
def test_monolayer():
sheet = Sheet("test", *three_faces_sheet())
mono = Monolayer.from_... |
vnsofthe/odoo-dev | refs/heads/master | addons/only_single_user/__openerp__.py | 1 | # -*- coding: utf-8 -*-
#
{
'name': 'only_single_user',
'version': '0.1',
'category': 'web',
'sequence': 23,
'summary': 'Only single user login',
'description': """
Only single user login,other session is logout for this id when user login.
""",
'author': 'VnSoft',
'website': 'http:/... |
eeshangarg/oh-mainline | refs/heads/master | vendor/packages/gdata/tests/gdata_tests/health/service_test.py | 127 | #!/usr/bin/python
#
# Copyright 2009 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 b... |
fmoreyra/ReservaLibrosISOO | refs/heads/master | login/models.py | 1 | import uuid
from datetime import datetime, date
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.translation import ugettext as _
from login.choices import *
class Profile(models.Model):
us... |
Vitallium/qtwebkit | refs/heads/phantomjs | Source/ThirdParty/gtest/test/gtest_xml_test_utils.py | 306 | #!/usr/bin/env python
#
# Copyright 2006, 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... |
iwaseyusuke/ryu | refs/heads/master | ryu/lib/packet/zebra.py | 4 | # Copyright (C) 2017 Nippon Telegraph and Telephone 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 appli... |
cytec/SickRage | refs/heads/master | lib/requests/packages/chardet/sjisprober.py | 1776 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... |
ijuma/kafka | refs/heads/trunk | tests/kafkatest/tests/client/quota_test.py | 9 | # 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 use ... |
anandology/pyjamas | refs/heads/master | examples/libtest/LoopTest.py | 12 | from UnitTest import UnitTest
import time
from write import write, writebr
class A(object):
def __init__(self, x):
self.x = x
def getX(self):
return self.x
def fib(n):
if n<3.0:
return 1.0
return fib(n-2.0)+fib(n-1.0)
def int_fib(n):
if n<3:
return 1
return i... |
vnsofthe/odoo-dev | refs/heads/master | addons/quality_control/models/qc_test_category.py | 1 | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api, exceptions, _
cl... |
sriprasanna/django-1.3.1 | refs/heads/master | django/contrib/gis/gdal/tests/test_geom.py | 154 | from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, \
OGRException, OGRIndexError, SpatialReference, CoordTransform, \
GDAL_VERSION
from django.utils import unittest
from django.contrib.gis.geometry.test_data import TestDataMixin
class OGRGeomTest(unittest.TestCase, TestDataMixin):
"This tests th... |
CAAD-RWTH/ClockworkForDynamo | refs/heads/master | nodes/2.x/python/MassFloor.Mass.py | 4 | import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
def GetMass(item):
if hasattr(item, "OwningMassId"): return item.Document.GetElement(item.OwningMassId).ToDSType(True)
else: return None
items = UnwrapElement(IN[... |
Ichag/openerp-server | refs/heads/master | openerp/addons/base/module/report/__init__.py | 463 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... |
jualjiman/knowledge-base | refs/heads/master | src/knowledge_base/users/apps.py | 1 | # -*- coding: utf-8 -*-
from django.apps import AppConfig
from django.db.models.signals import post_save
from knowledge_base.utils.signals import generate_thumbnail
class UsersAppConfig(AppConfig):
"""
AppConfig for the ```knowledge_base.users``` module.
"""
name = 'knowledge_base.users'
def rea... |
bjlittle/iris | refs/heads/pre-commit-ci-update-config | lib/iris/tests/system_test.py | 1 | # Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
This system test module is useful to identify if some of the key components required for Iris are available.
The system ... |
obi-two/Rebelion | refs/heads/master | data/scripts/templates/object/tangible/loot/collectible/collectible_parts/shared_light_table_glasstop_01.py | 2 | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/collectible/collectible_parts/shared_light_table_glasstop_01.if... |
dsajkl/123 | refs/heads/master | lms/djangoapps/bulk_email/migrations/0007_load_course_email_template.py | 182 | # -*- coding: utf-8 -*-
from south.v2 import DataMigration
class Migration(DataMigration):
def forwards(self, orm):
"Load data from fixture."
from django.core.management import call_command
call_command("loaddata", "course_email_template.json")
def backwards(self, orm):
"Perf... |
cloudera/hue | refs/heads/master | desktop/core/ext-py/boto-2.46.1/tests/integration/cognito/identity/test_cognito_identity.py | 112 | # Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights ... |
jinankjain/zamboni | refs/heads/master | mkt/stats/tests/test_views.py | 1 | import json
import mock
import requests
from nose.tools import eq_, ok_
from rest_framework.reverse import reverse
from django.conf import settings
import amo
from stats.models import Contribution
from mkt.api.tests.test_oauth import RestOAuth
from mkt.site.fixtures import fixture
from mkt.stats.views import APP_ST... |
spookylukey/django-debug-toolbar | refs/heads/master | tests/panels/test_redirects.py | 7 | from __future__ import absolute_import, unicode_literals
import django
from django.conf import settings
from django.http import HttpResponse
from django.test.utils import override_settings
from ..base import BaseTestCase
from debug_toolbar.compat import unittest
@override_settings(DEBUG_TOOLBAR_CONFIG={'INTERCEPT_R... |
zhouzhenghui/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/lib2to3/fixes/fix_reduce.py | 203 | # Copyright 2008 Armin Ronacher.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for reduce().
Makes sure reduce() is imported from the functools module if reduce is
used in that module.
"""
from lib2to3 import fixer_base
from lib2to3.fixer_util import touch_import
class FixReduce(fixer_base.BaseFix):
... |
lstern/SWProxy-plugins | refs/heads/master | SWParser/parser.py | 4 | #!/usr/bin/env python
import csv
import json
import cStringIO
import sys
import struct
import numbers
import os
import codecs
from SWPlugin import SWPlugin
from collections import OrderedDict
from smon_decryptor import decrypt_request, decrypt_response
from monsters import monsters_name_map as name_map
# ref: http://... |
staar/empty_project | refs/heads/master | build/tem/generate_bin.py | 1 | import sys
sys.path.append("./python_files/")
import configure
configuration = configure.configure()
print configuration
configuration.read()
print configuration
configuration.write_all()
|
shenlong3030/asv-django-guestbook | refs/heads/master | django/middleware/gzip.py | 13 | import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, s... |
seem-sky/kbengine | refs/heads/master | kbe/res/scripts/common/Lib/distutils/tests/test_install_headers.py | 147 | """Tests for distutils.command.install_headers."""
import sys
import os
import unittest
import getpass
from distutils.command.install_headers import install_headers
from distutils.tests import support
from test.support import run_unittest
class InstallHeadersTestCase(support.TempdirManager,
... |
statsmodels/statsmodels.github.io | refs/heads/master | v0.10.2/plots/graphics_regression_influence.py | 5 | # -*- coding: utf-8 -*-
'''
Using a model built from the the state crime dataset, plot the influence in
regression. Observations with high leverage, or large residuals will be
labeled in the plot to show potential influence points.
'''
import statsmodels.api as sm
import matplotlib.pyplot as plt
import sta... |
cgar/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/lint/tests/test_lint.py | 59 | from __future__ import unicode_literals
import os
import mock
import pytest
import six
from .. import lint as lint_mod
from ..lint import filter_whitelist_errors, parse_whitelist, lint
_dummy_repo = os.path.join(os.path.dirname(__file__), "dummy")
def _mock_lint(name):
wrapped = getattr(lint_mod, name)
re... |
sandeepgupta2k4/tensorflow | refs/heads/master | tensorflow/contrib/opt/python/training/variable_clipping_optimizer_test.py | 102 | # 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... |
linjoahow/2015cd_midterm | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/unittest/test/testmock/testhelpers.py | 737 | import unittest
from unittest.mock import (
call, _Call, create_autospec, MagicMock,
Mock, ANY, _CallList, patch, PropertyMock
)
from datetime import datetime
class SomeClass(object):
def one(self, a, b):
pass
def two(self):
pass
def three(self, a=None):
pass
class AnyT... |
zenlambda/pip | refs/heads/develop | tests/functional/test_requests.py | 58 | import pytest
@pytest.mark.skipif
def test_timeout(script):
result = script.pip(
"--timeout", "0.01", "install", "-vvv", "INITools",
expect_error=True,
)
assert (
"Could not fetch URL https://pypi.python.org/simple/INITools/: "
"timed out" in result.stdout
)
assert ... |
gnowgi/gnowsys-studio | refs/heads/master | gstudio/feeds.py | 3 |
# Copyright (c) 2011, 2012 Free Software Foundation
# 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, or (at your option) any later ver... |
awsdocs/aws-doc-sdk-examples | refs/heads/master | python/example_code/rekognition/rekognition_video_detection.py | 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use the AWS SDK for Python (Boto3) with Amazon Rekognition to
recognize people and objects in videos.
"""
import logging
import json
from pprint import pprint
import time
import boto3
f... |
e-gob/plataforma-kioscos-autoatencion | refs/heads/master | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/module_utils/openshift_common.py | 96 | #
# Copyright 2017 Red Hat | Ansible
#
# 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.
#
# ... |
pridemusvaire/yowsup | refs/heads/master | yowsup/layers/axolotl/store/sqlite/litesessionstore.py | 53 | from axolotl.state.sessionstore import SessionStore
from axolotl.state.sessionrecord import SessionRecord
class LiteSessionStore(SessionStore):
def __init__(self, dbConn):
"""
:type dbConn: Connection
"""
self.dbConn = dbConn
dbConn.execute("CREATE TABLE IF NOT EXISTS session... |
SijmeJan/Astrix | refs/heads/master | python/astrix/parameterfile.py | 1 | #!/usr/bin/python
import os
def ChangeParameter(inFileName, parameter):
"""Edit a valid Astrix input file to change parameters
Given a valid Astrix input file inFileName, edit it to change the parameters as listed in parameter
:param inFileName: Valid Astrix input parameter file.
:param parameter: L... |
realpython/flask-jwt-auth | refs/heads/master | project/server/config.py | 4 | # project/server/config.py
import os
basedir = os.path.abspath(os.path.dirname(__file__))
postgres_local_base = 'postgresql://postgres:@localhost/'
database_name = 'flask_jwt_auth'
class BaseConfig:
"""Base configuration."""
SECRET_KEY = os.getenv('SECRET_KEY', 'my_precious')
DEBUG = False
BCRYPT_LOG... |
SKA-ScienceDataProcessor/algorithm-reference-library | refs/heads/master | cluster_tests/ritoy-numba/cluster_test_ritoy_numba.py | 1 | # """ Radio interferometry toy
#
# This mimics the overall structure and workload of our processing.
#
# Tim Cornwell 9 Sept 2017
# realtimcornwell@gmail.com
# Adding Numba Testing, ^W_F^
# """
import numpy
from dask import delayed
from distributed import Client
import numba
# Make some randomly located points on 2D p... |
ktaneishi/deepchem | refs/heads/master | deepchem/models/xgboost_models/__init__.py | 2 | """
Scikit-learn wrapper interface of xgboost
"""
import numpy as np
import os
from deepchem.models import Model
from deepchem.models.sklearn_models import SklearnModel
from deepchem.utils.save import load_from_disk
from deepchem.utils.save import save_to_disk
from sklearn.model_selection import train_test_split, Grid... |
maartenq/ansible | refs/heads/devel | lib/ansible/modules/cloud/amazon/cloudfront_facts.py | 22 | #!/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... |
marklee77/muttutils | refs/heads/master | save_addrs.py | 1 | #!/usr/bin/env python
# addr_lookup.py
# Copyright (C) 2013 Mark Lee Stillwell
#
# 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 any later version.
#
# This p... |
shuggiefisher/crowdstock | refs/heads/master | django/utils/unittest/collector.py | 572 | import os
import sys
from django.utils.unittest.loader import defaultTestLoader
def collector():
# import __main__ triggers code re-execution
__main__ = sys.modules['__main__']
setupDir = os.path.abspath(os.path.dirname(__main__.__file__))
return defaultTestLoader.discover(setupDir)
|
dstufft/jinja2 | refs/heads/master | jinja2/compiler.py | 11 | # -*- coding: utf-8 -*-
"""
jinja2.compiler
~~~~~~~~~~~~~~~
Compiles nodes into python code.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from itertools import chain
from copy import deepcopy
from keyword import iskeyword as is_python_keyword
from jinja2... |
bhargavvader/gensim | refs/heads/develop | gensim/test/simspeed.py | 14 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s CORPUS_DENSE.mm CORPUS_SPARSE.mm [NUMDOCS]
Run speed test of similarity queries. Only use the first NUMDOCS d... |
heyandie/django-qsstats-magic | refs/heads/master | test_settings/postgres.py | 1 | INSTALLED_APPS = (
'qsstats',
'django.contrib.auth',
'django.contrib.contenttypes'
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'qsstats_test',
'USER': 'qsstats_test',
'PASSWORD': 'qsstats_test',
}
}
SECRET_KEY = 'foo' |
persandstrom/home-assistant | refs/heads/master | homeassistant/components/switch/ihc.py | 3 | """IHC switch platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.ihc/
"""
import voluptuous as vol
from homeassistant.components.ihc import (
validate_name, IHC_DATA, IHC_CONTROLLER, IHC_INFO)
from homeassistant.components.ihc.ihcdevice... |
ESSS/numpy | refs/heads/master | numpy/distutils/misc_util.py | 14 | from __future__ import division, absolute_import, print_function
import os
import re
import sys
import imp
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import distutils
from distutils.errors import DistutilsError
try:
from threading import local as tlocal
except ImportErro... |
BambooL/jeeves | refs/heads/master | demo/tests/simpleRule/wsgi.py | 15 | """
WSGI jelfig for jelf project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
import sys
sys.path.append(os.path.dirname(__file__))
sys.path.append(os.path.join(os.path... |
saurabh6790/test_final_med_app | refs/heads/master | accounts/doctype/budget_distribution/test_budget_distribution.py | 30 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
test_records = [
[{
"doctype": "Budget Distribution",
"distribution_id": "_Test Distribution",
"fiscal_year": "_Test Fiscal Year 2013",
}, {
"doctype": "Budget Distribution Detail... |
kingvuplus/PKT-gui2 | refs/heads/master | lib/python/Plugins/SystemPlugins/AnimationSetup/plugin.py | 15 | from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigListScreen
from Components.MenuList import MenuList
from Components.Sources.StaticText import StaticText
from Components.config import config, ConfigNumber, Conf... |
jshum/dd-agent | refs/heads/master | checks.d/nagios.py | 27 | # stdlib
from collections import namedtuple
import re
# project
from checks import AgentCheck
from utils.tailfile import TailFile
# fields order for each event type, as named tuples
EVENT_FIELDS = {
'CURRENT HOST STATE': namedtuple('E_CurrentHostState', 'host, event_state, event_soft_hard, return_code, payl... |
conejoninja/pelisalacarta | refs/heads/master | python/main-classic/servers/mailru.py | 9 | # -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para mail.ru
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core impor... |
SergioML9/emotion_simulation | refs/heads/master | configuration/model_settings.py | 2 | import configuration.automation_settings as automation_settings
overtime_contribution = 0.021
rest_time_contribution = 0.016
email_reception_contribution = 0.0029
ambient_contribution = 0.0012
noise_contribution = 0.03
luminosity_contibution = 0.000153
if automation_settings.automate_tasks: tasks_automation_contribut... |
rcbops/nova-buildpackage | refs/heads/master | nova/tests/test_virt.py | 14 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Isaku Yamahata
# 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/... |
ParthGanatra/mitmproxy | refs/heads/master | mitmproxy/platform/windows.py | 3 | import configargparse
import cPickle as pickle
from ctypes import byref, windll, Structure
from ctypes.wintypes import DWORD
import os
import socket
import SocketServer
import struct
import threading
import time
from collections import OrderedDict
from pydivert.windivert import WinDivert
from pydivert.enum import Dire... |
Ircam-Web/mezzanine-organization | refs/heads/master | organization/projects/migrations/0084_auto_20190304_2221.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-03-04 21:21
from __future__ import unicode_literals
from django.db import migrations
import mezzanine.core.fields
class Migration(migrations.Migration):
dependencies = [
('organization-projects', '0083_auto_20190221_1706'),
]
operatio... |
SimonSuster/lxmls-toolkit | refs/heads/master | lxmls/labs/day0.py | 2 | import numpy as np
import math
import matplotlib.pyplot as plt
## Exercise about gradient descent
def get_y(x):
value = pow((x+2),2) - 16*math.exp(-pow((x-2),2))
return value
def get_grad(x):
return (2*x+4)-16*(-2*x + 4)*np.exp(-((x-2)**2))
def gradient_descent(start_x,func,grad):
# Precision of th... |
mbohlool/client-python | refs/heads/master | kubernetes/test/test_v1_local_subject_access_review.py | 1 | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... |
realgo/luigi | refs/heads/master | test/task_test.py | 9 | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
noogel/xyzStudyPython | refs/heads/master | tornado/translate_tornado_4_2_1/tornado/test/util.py | 46 | from __future__ import absolute_import, division, print_function, with_statement
import os
import socket
import sys
from tornado.testing import bind_unused_port
# Encapsulate the choice of unittest or unittest2 here.
# To be used as 'from tornado.test.util import unittest'.
if sys.version_info < (2, 7):
# In py2... |
sjohannes/exaile | refs/heads/gdbus | xlgui/widgets/smart_playlist_editor.py | 1 | # Copyright (C) 2008-2010 Adam Olsen
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that... |
akaihola/django-yui-loader | refs/heads/master | yui_loader/middleware.py | 1 | __doc__ = """
YUI_include -- YUI Loader as Django middleware
(c) Antti Kaihola 2008,2009 http://djangopeople.net/akaihola/
akaihol+django@ambitone.com
This server-side middleware implements some of the functionality in the Yahoo
User Interface Loader component. YUI JavaScript and CSS m... |
Alexander-P/Isca | refs/heads/master | src/extra/python/scripts/create_amip_sst_timeseries.py | 1 | # -*- coding: utf-8 -*-s
import numpy as np
from calendar_calc import day_number_to_date
from netCDF4 import Dataset, date2num
import pdb
import create_timeseries as cts
import xarray as xar
from mpl_toolkits.basemap import shiftgrid
import matplotlib.pyplot as plt
def add_sst_anomaly(sst_in, anomaly_type=None):
... |
gnmiller/craig-bot | refs/heads/master | craig-bot/lib/python3.6/site-packages/urllib3/util/url.py | 8 | from __future__ import absolute_import
import re
from collections import namedtuple
from ..exceptions import LocationParseError
from ..packages import six, rfc3986
from ..packages.rfc3986.exceptions import RFC3986Exception, ValidationError
from ..packages.rfc3986.validators import Validator
from ..packages.rfc3986 imp... |
ldts/zephyr | refs/heads/evl-latency | scripts/kconfig/kconfig.py | 1 | #!/usr/bin/env python3
# Modified from: https://github.com/ulfalizer/Kconfiglib/blob/master/examples/merge_config.py
import argparse
import os
import sys
import textwrap
from kconfiglib import Kconfig, BOOL, TRISTATE, TRI_TO_STR
# Warnings that won't be turned into errors (but that will still be printed),
# identifi... |
AthelasPeru/laborapp | refs/heads/master | app/models/relationships.py | 1 | from app.models import db
roles_users = db.Table('roles_users',
db.Column('user_id', db.Integer(), db.ForeignKey('users.id')),
db.Column('role_id', db.Integer(), db.ForeignKey('roles.id')))
user_skills = db.Table("user_skills",
db.Column(
"user_id", db.Integer, db.ForeignKey("users.... |
arenadata/ambari | refs/heads/branch-adh-1.6 | ambari-server/src/main/resources/stacks/ADH/1.0/services/HDFS/package/scripts/params_windows.py | 2 | """
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 use this ... |
sergiopasra/numina | refs/heads/master | numina/array/nirproc.py | 3 | #
# Copyright 2008-2021 Universidad Complutense de Madrid
#
# This file is part of Numina
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE.txt
#
import math
import numpy
def fowler_array(fowlerdata, ti=0.0, ts=0.0, gain=1.0, ron=1.0,
badpixels=None, dtype='float64',
... |
jamesbulpin/xcp-xen-4.1 | refs/heads/master | tools/python/logging/logging-0.4.9.2/test/log_test3.py | 42 | #!/usr/bin/env python
#
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright n... |
cherez/youtube-dl | refs/heads/master | youtube_dl/extractor/dump.py | 120 | # encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class DumpIE(InfoExtractor):
_VALID_URL = r'^https?://(?:www\.)?dump\.com/(?P<id>[a-zA-Z0-9]+)/'
_TEST = {
'url': 'http://www.dump.com/oneus/',
'md5': 'ad71704d1e67dfd9e81e3e8b42d69d99',
... |
derekjchow/models | refs/heads/master | research/tcn/eval.py | 5 | # 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 applicab... |
NemesisRE/ACE3 | refs/heads/master | tools/github_privates_bot.py | 22 | #!/usr/bin/env python3
import os
import argparse
from pygithub3 import Github
def main():
gh = Github(user='acemod', repo='ACE3')
pull_requests = gh.pull_requests.list().all()
for request in pull_requests:
files = gh.pull_requests.list_files(request.number).all()
... |
SteadyQuad/android_kernel_yotaphone2 | refs/heads/lollipop5.0 | scripts/tracing/draw_functrace.py | 14679 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.