repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
SGShuman/PreCourse | Chapter_7_Hypothesis_testing/t_test.py | import scipy.stats as scs
import numpy as np
# import statistics as st
sample_1 = [4.15848606, 3.86146363, 4.31545726, 3.3748772,
4.67023082, 4.45950272, 3.85894915, 4.41089417,
3.82360986, 3.79889443, 4.75884172, 3.27100914,
4.08939402, 4.08904694, 5.62589842, 3.71445656,... |
stscieisenhamer/ginga | ginga/rv/plugins/TVMark.py | """Non-interactive points marking local plugin for Ginga."""
from __future__ import absolute_import, division, print_function
from ginga.util.six import iteritems, itervalues
from ginga.util.six.moves import map, zip
# STDLIB
import re
import os
from collections import defaultdict
# THIRD-PARTY
import numpy as np
fro... |
ElementalAlchemist/txircd | txircd/modules/rfc/cmode_s.py | from twisted.plugin import IPlugin
from txircd.module_interface import IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType
from zope.interface import implements
class SecretMode(ModuleData, Mode):
implements(IPlugin, IModuleData, IMode)
name = "SecretMode"
core = True
affectedActions = { "disp... |
btubbs/wsgi-jwt-session | tests/test_jwt_session.py | # response contains session cookie that matches configured name.
from werkzeug.wrappers import BaseResponse
from werkzeug.test import Client
import cookies
import jwt
import json
from wsgi_jwt_session import JWTSessionMiddleware
def counter_app(environ, start_response):
session = environ['my_jwt_session']
s... |
pandas-dev/pandas | pandas/tests/arithmetic/conftest.py | import numpy as np
import pytest
import pandas as pd
from pandas import RangeIndex
import pandas._testing as tm
from pandas.core.api import (
Float64Index,
Int64Index,
UInt64Index,
)
from pandas.core.computation import expressions as expr
@pytest.fixture(
autouse=True, scope="module", params=[0, 1000... |
ctuning/ck | ck/repo/module/model.tensorflowapi/module.py | #
# Collective Knowledge (Tensorflow Model configured with Tensorflow Object Detection API)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer:
#
cfg={} # Will be updated by CK (meta description of this module)
work={} # Will be updated by CK (temporal data)
ck=No... |
jimporter/bfg9000 | test/unit/tools/test_ar.py | from unittest import mock
from .. import *
from bfg9000 import file_types, options as opts
from bfg9000.tools.ar import ArLinker
from bfg9000.versioning import Version
def mock_which(*args, **kwargs):
return ['command']
class TestArLinker(CrossPlatformTestCase):
def __init__(self, *args, **kwargs):
... |
dimagi/commcare-hq | corehq/ex-submodules/casexml/apps/phone/migrations/0005_auto_20210119_1001.py | # Generated by Django 2.2.16 on 2021-01-19 10:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('phone', '0004_auto_20191021_1308'),
]
operations = [
migrations.AddField(
model_name='synclogsql',
name='case_count... |
cybertk/depot_tools | presubmit_canned_checks.py | # 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.
"""Generic presubmit checks that can be reused by other presubmit checks."""
import os as _os
_HERE = _os.path.dirname(_os.path.abspath(__file__))
###... |
PFCM/datasets | rnndatasets/warandpeace/warandpeace.py | """Some helpers for loading war and piece as a dataset.
We assume it is a massive sequence (which it is) and chop it up into
whatever length the caller wants."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import collections
import csv
import i... |
RyodoTanaka/Coding_The_Matrix | python/chap_0/inverse_index.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def makeInverseIndex(strlist):
wdict={}
for ln, line in enumerate(strlist):
for word in set(line.split()):
if word in wdict:
wdict[word].append(ln)
else:
wdict[word]=[ln]
return wdict
def orSearc... |
andytom/toolkit | app/mkd_preview/__init__.py | # -*- coding: utf-8 -*-
"""
mkd_preview
~~~~~~~~~~~
Blueprint for live markdown preview.
:copyright: (c) 2015 by Thomas O'Donnell.
:license: BSD, see LICENSE for more details.
"""
from flask import Blueprint, render_template, current_app
mkd_preview = Blueprint('mkd_preview', __name__, template_f... |
mitsuhiko/django | tests/regressiontests/defer_regress/models.py | """
Regression tests for defer() / only() behavior.
"""
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.db import connection, models
class Item(models.Model):
name = models.CharField(max_length=15)
text = models.TextField(default="xyzzy")
value = mod... |
beeftornado/sentry | src/sentry/api/endpoints/group_hashes.py | from __future__ import absolute_import
from functools import partial
from rest_framework.response import Response
from sentry import eventstore
from sentry.api.bases import GroupEndpoint
from sentry.api.paginator import GenericOffsetPaginator
from sentry.api.serializers import EventSerializer, serialize
from sentry.... |
TaiSakuma/AlphaTwirl | tests/unit/selection/modules/test_BasicNot.py | # Tai Sakuma <tai.sakuma@cern.ch>
from alphatwirl.selection.modules import Not
import unittest
##__________________________________________________________________||
class MockEvent(object):
def __init__(self, val):
self.val = val
##__________________________________________________________________||
clas... |
flgiordano/netcash | +/google-cloud-sdk/lib/googlecloudsdk/third_party/apitools/base/protorpclite/protojson.py | #!/usr/bin/env python
#
# Copyright 2010 Google 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 o... |
tsikerdekis/ngraph.ergm | compare.py | import random
import matplotlib.pyplot as plt
import numpy as np
import networkx as nx
G = nx.florentine_families_graph()
def compute_weight(G, edge_coeff, tri_coeff):
'''
Compute the probability weight on graph G
'''
edge_count = len(G.edges())
triangles = sum(nx.triangles(G).values())
return... |
mtermoul/imp | imp/contrib/sites/migrations/0002_set_site_domain_and_name.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings... |
Igelinmist/etools | etools/apps/uptime/excel_utils.py | import io
import xlsxwriter
from datetime import date
def WriterToExcel(context):
output = io.BytesIO()
workbook = xlsxwriter.Workbook(output)
worksheet_s = workbook.add_worksheet("Отчет")
worksheet_s.set_column('A:A', 23)
worksheet_s.set_column('B:Z', 14)
# excel styles
title = workbook.... |
Woseseltops/signbank | signbank/dictionary/migrations/0027_auto_20180803_1340.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-08-03 11:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dictionary', '0026_auto_20180802_0936'),
]
operation... |
fresskarma/tinyos-1.x | tools/python/pytos/util/NescApp.py | # "Copyright (c) 2000-2003 The Regents of the University of California.
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose, without fee, and without written agreement
# is hereby granted, provided that the above copyright notice, the follow... |
pdxacm/acmapi | tests/test_types.py | import unittest
import datetime
from acmapi.types import date_type
from acmapi.types import datetime_type
from acmapi.types import ValidationError
class test_date_type(unittest.TestCase):
def test_valid_date(self):
self.assertEqual(
date_type('2014-04-11'),
datetime.date(2014,... |
civisanalytics/muffnn | muffnn/fm/tests/test_fm_regressor.py | """
Tests for the FM Regressor
based in part on sklearn's logistic tests:
https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/linear_model/tests/test_logistic.py
"""
from io import BytesIO
import pickle
import sys
from unittest import mock
import numpy as np
import pytest
import scipy.sparse as sp
from ... |
jeffhsu3/genda | tests/transcript_tests.py | import unittest
import pysam
from genda.transcripts import (Exon, Gene, Transcript, unique_sets,
compare_two_transcripts)
class TestGeneBreaks(unittest.TestCase):
def setUp(self):
self.simple_gene = Gene([Transcript([Exon('chr1', 10, 20),
Exon('chr1', 5... |
brython-dev/brython | www/src/Lib/test/test_xml_etree_c.py | # xml.etree test for cElementTree
import io
import struct
from test import support
from test.support.import_helper import import_fresh_module
import types
import unittest
cET = import_fresh_module('xml.etree.ElementTree',
fresh=['_elementtree'])
cET_alias = import_fresh_module('xml.etree.cEle... |
redpandalabs/django-oscar-stripe | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='django-oscar-stripe',
version='0.1',
url='https://github.com/tangentlabs/django-oscar-stripe',
author="David Winterbottom",
author_email="david.winterbottom@tangentlabs.co.uk",
description="Stripe payment module... |
testvidya11/ejrf | questionnaire/fixtures/questionnaire/section_2.py | from questionnaire.models import Questionnaire, Section, SubSection, Question, QuestionGroup, QuestionOption, QuestionGroupOrder
from django.core import serializers
questionnaire = Questionnaire.objects.get(name="JRF 2013 Core English", description="From dropbox as given by Rouslan")
section_1 = Section.objects.creat... |
sirusb/pastis | pastis/config.py | import ConfigParser
import os
def get_default_options():
"""
Returns default options
Here are all the options:
output_name : structure.pdb, str
The name of the PDB file to write. The name of the algorithm used will
be appended to this filename. The coordinates of each beads will also... |
dials/dials | tests/algorithms/indexing/test_model_evaluation.py | from __future__ import annotations
import copy
import functools
import os
import pytest
from cctbx import sgtbx, uctbx
from dxtbx.model import Crystal
from dxtbx.serialize import load
from dials.algorithms.indexing import model_evaluation
from dials.algorithms.indexing.assign_indices import AssignIndicesGlobal
from... |
impact-hiv/NepidemiX | nepidemix/utilities/linkedcounter.py |
"""
Implementation of a basic linked counter class. Counters linked to each others perform
the incremental/decremental arithmetic operations += and -= in unison.
"""
__author__ = "Lukas Ahrenberg <lukas@ahrenberg.se>"
__license__ = "Modified BSD License"
__all__ = ["LinkedCounter"]
class LinkedCounter(object):
... |
JeffDestroyerOfWorlds/hydro_examples | diffusion/diffusion-implicit.py | """
solve the diffusion equation:
phi_t = k phi_{xx}
with a Crank-Nicolson implicit discretization
M. Zingale (2013-04-03)
"""
import numpy
from scipy import linalg
import sys
import pylab
class Grid1d:
def __init__(self, nx, ng=1, xmin=0.0, xmax=1.0):
""" grid class initialization """
... |
mne-tools/mne-tools.github.io | 0.23/_downloads/817e637debd5e0e130040ef199e910dc/50_artifact_correction_ssp.py | # -*- coding: utf-8 -*-
"""
.. _tut-artifact-ssp:
Repairing artifacts with SSP
============================
This tutorial covers the basics of signal-space projection (SSP) and shows
how SSP can be used for artifact repair; extended examples illustrate use
of SSP for environmental noise reduction, and for repair of o... |
bastings/neuralmonkey | neuralmonkey/processors/german.py | import re
from typing import List
CONTRACTIONS = ["am", "ans", "beim", "im", "ins", "vom", "zum", "zur"]
CONTRACTIONS_SET = set(CONTRACTIONS)
UNCONTRACTED_FORMS = [["an", "dem"], ["an", "das"], ["bei", "dem"],
["in", "dem"], ["in", "das"], ["von", "dem"],
["zu", "dem"], ["... |
december1981/django-background-tasks | background_task/management/commands/process_tasks.py | from django.core.management.base import BaseCommand
import time
from optparse import make_option
import logging
import sys
from background_task.tasks import tasks, autodiscover
class Command(BaseCommand):
LOG_LEVELS = ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG']
help = 'Run tasks that are scheduled ... |
tjyang/vitess | test/vertical_split.py | #!/usr/bin/env python
#
# Copyright 2013, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
import logging
import time
import unittest
from vtproto import topodata_pb2
from vtdb import keyrange
from vtdb import keyrange_constants
fr... |
mfem/PyMFEM | mfem/_par/fe.py | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... |
indeedops/dd-agent | checks.d/haproxy.py | # (C) Datadog, Inc. 2012-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
from collections import defaultdict
import copy
import re
import time
# 3rd party
import requests
# project
from checks import AgentCheck
from config import _is_affirmative
from util import headers
STA... |
ericdill/asv | asv/plugins/virtualenv.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals, print_function
from distutils.version import LooseVersion
import inspect
import os
import six
from .. import environment
from ..console import log
from .. impor... |
ej2/pixelpuncher | pixelpuncher/game/migrations/0009_auto_20161026_0651.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-10-26 06:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('game', '0008_auto_20161026_0616'),
]
operations = [
migrations.RenameField(
... |
kezabelle/clastic | clastic/tests/test_render.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from nose.tools import eq_, ok_
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from clastic import Application
from clastic.render import (JSONRender,
JSONPRender,
... |
vicky2135/lucious | oscar/lib/python2.7/site-packages/phonenumbers/data/region_RW.py | """Auto-generated file, do not edit by hand. RW metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_RW = PhoneMetadata(id='RW', country_code=250, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[027-9]\\d{7,8}', possible_number_patter... |
svaante/decision-tree-id3 | examples/text_plot_examples.py | """
==========================
Text export from Estimator
==========================
An example text export of :class:`id3.id3.Id3Estimator` with
:file:`id3.export.export_text`
"""
from id3 import Id3Estimator, export_text
import numpy as np
feature_names = ["age",
"gender",
"sector"... |
gencer/sentry | src/sentry/api/endpoints/project_details.py | from __future__ import absolute_import
import six
import logging
from uuid import uuid4
from datetime import timedelta
from django.db import IntegrityError, transaction
from django.utils import timezone
from rest_framework import serializers, status
from rest_framework.response import Response
from sentry import fea... |
endlessm/chromium-browser | base/android/jni_generator/jni_refactorer.py | #!/usr/bin/env python2.7
# Copyright 2018 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.
"""Tool for doing Java refactors over native methods.
Converts
(a) non-static natives to static natives using @JCaller
e.g.
class A... |
jon-jacky/PyModel | samples/PowerSwitch/test_viewer.py | """
Like test_graphics, except just uses one pvm command
instead of three: pma, pmg, dot.
Output files have the same names and should have the same contents as
in test_graphics output files saved in fsmpy/ and svg/
"""
cases = [
('Generate FSM from PowerSwitch model program',
'pmv -T svg PowerSwitch'),
... |
multicastTor/multicastTor | torps/multicastsim.py | import datetime
import os
import os.path
from stem import Flag
from stem.exit_policy import ExitPolicy
from random import random, randint, choice, sample
import sys
import collections
import sets
import cPickle as pickle
import argparse
from models import *
import congestion_aware_pathsim
import process_consensuses
imp... |
dzhou/remotely | remotely/remotely.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xmlrpclib
import marshal
import base64
import pickle
import multiprocessing
def remotely(api_key, host, port):
"""
synchronous decorator for executing code remotely.
@param api_key: key for authentication
@param host: remotely server ip
@para... |
andreesg/bda.plone.payment | src/bda/plone/payment/__init__.py | # -*- coding: utf-8 -*-
from bda.plone.payment.interfaces import IPayment
from bda.plone.payment.interfaces import IPaymentEvent
from bda.plone.payment.interfaces import IPaymentFailedEvent
from bda.plone.payment.interfaces import IPaymentSettings
from bda.plone.payment.interfaces import IPaymentSuccessEvent
from zope.... |
tequa/ammisoft | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Scripts/explode.py | #!C:\Users\DMoran\Downloads\WinPython-64bit-2.7.13.1Zero\python-2.7.13.amd64\python.exe
#
# The Python Imaging Library
# $Id$
#
# split an animation into a number of frame files
#
from __future__ import print_function
from PIL import Image
import os
import sys
class Interval(object):
def __init__(self, interva... |
ros-controls/ros_control | controller_manager_tests/test/controller_manager_interface_test.py | #!/usr/bin/env python
import unittest
from controller_manager import controller_manager_interface
class TestUtils(unittest.TestCase):
def test_scripts(self):
# load my_controller1.
self.assertTrue(controller_manager_interface.load_controller('my_controller1'))
# load a non-existent contr... |
sonicrules1234/sonicbot | essentials/old_on_353.py | import time, traceback
minlevel = 1
arguments = ["self", "info"]
keyword = "353"
def main(self, info) :
"""Generates a list of nicks in the channel, also tries to see what modes they have."""
try :
for nick in info["words"][5:] :
if nick != "" :
correctnick = nick.replace(":"... |
boar/boar | boar/articles/managers.py | from boar.cacher.managers import CachingManager, CachingQuerySet
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.db import connection
from django.db.models.query import QuerySet
class SectionQuerySet(QuerySet):
def menu_items(self):
... |
btubbs/spa | spa/app.py | from werkzeug.exceptions import HTTPException
from werkzeug.routing import Map, Rule
from spa.wrappers import Request
class App(object):
def __init__(self, urls, settings=None, request_class=None):
self.urls = urls
self.settings = settings
self.map, self.handlers = build_rules(urls)
... |
nk113/django-ficuspumila | ficuspumila/core/test.py | # -*- coding: utf-8 -*-
import logging
from rpc_proxy.test import TestCase
from tastypie.test import ResourceTestCase
from ficuspumila.settings import ficuspumila as settings
API_PATH = '/api/v1/core/'
logger = logging.getLogger(__name__)
class Resource(TestCase, ResourceTestCase):
"""
Don't be smart so ... |
ebu/ebu-tt-live-toolkit | ebu_tt_live/documents/test/test_deduplicationReplaceStylesAndRegions.py | from unittest import TestCase
from ebu_tt_live import bindings
from ebu_tt_live.bindings.pyxb_utils import RecursiveOperation
from ebu_tt_live.bindings import ebuttdt as datatypes
from ebu_tt_live.bindings import ebuttm as metadata
from ebu_tt_live.node import deduplicator
from ebu_tt_live.documents.ebutt3 import EBUTT... |
diefenbach/django-lfs | lfs/manage/views/delivery_times.py | # django imports
from django.contrib.auth.decorators import permission_required
from django.urls import reverse
from django.forms import ModelForm
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext... |
huqa/pyfibot | pyfibot/modules/module_kivatietaa.py | # -*- coding: utf-8 -*-
'''
Created on 17.8.2013
@author: Hukka
'''
import time
from math import ceil
#from datetime import timedelta
#from datetime import datetime
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
def generate_kivatietaa(nick,text):
#print len(text)
if not text:
... |
dimagi/commcare-hq | corehq/apps/reports/tests/test_enterprise_user_filter.py | from django.http import HttpRequest
from django.test import TestCase
from pillowtop.es_utils import initialize_index_and_mapping
from corehq.apps.domain.models import Domain
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.enterprise.tests.utils import create_enterprise_permissions
from corehq.... |
anomam/pvlib-python | pvlib/tests/test_pvsystem.py | from collections import OrderedDict
import numpy as np
from numpy import nan, array
import pandas as pd
import pytest
from pandas.util.testing import assert_series_equal, assert_frame_equal
from numpy.testing import assert_allclose
from pvlib import pvsystem
from pvlib import atmosphere
from pvlib import iam as _iam... |
mozilla/relman-auto-nag | auto_nag/scripts/code_freeze_week.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
import re
import whatthepatch
from dateutil.relativedelta import relativedelta
from libmozdata import h... |
alex/llvmpy | llvm/core.py | #
# Copyright (c) 2008-10, Mahadevan R 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 ... |
thedrow/houston | setup.py | import setuptools
import sys
tests_require = ['nose', 'mock']
if sys.version_info < (2, 7, 0):
tests_require.append('unittest2')
desc = 'Application deployment on CoreOS clusters using fleetd and Consul'
classifiers = ['Development Status :: 3 - Alpha',
'Environment :: Console',
'In... |
dimagi/commcare-hq | corehq/apps/app_manager/tests/test_case_list_lookup.py | from django.test import SimpleTestCase
from corehq.apps.app_manager.models import Application, Module
from corehq.apps.app_manager.tests.app_factory import AppFactory
from corehq.apps.app_manager.tests.util import TestXmlMixin, patch_get_xform_resource_overrides
@patch_get_xform_resource_overrides()
class CaseListLo... |
CityofPittsburgh/pittsburgh-purchasing-suite | purchasing/data/contract_stages.py | # -*- coding: utf-8 -*-
import datetime
from sqlalchemy.schema import Sequence
from sqlalchemy.orm import backref
from sqlalchemy.dialects.postgresql import JSON
from purchasing.database import Model, db, Column, ReferenceCol
class ContractStage(Model):
'''Model for contract stages
A Contract Stage is the ... |
matthiaskramm/corepy | examples/proto/isv2.py | # Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... |
beeftornado/sentry | src/sentry/relay/projectconfig_cache/redis.py | from __future__ import absolute_import
import six
from sentry.relay.projectconfig_cache.base import ProjectConfigCache
from sentry.utils import json
from sentry.utils.redis import get_dynamic_cluster_from_options, validate_dynamic_cluster
REDIS_CACHE_TIMEOUT = 3600 # 1 hr
class RedisProjectConfigCache(ProjectCon... |
fugitifduck/exabgp | lib/exabgp/bgp/message/update/attribute/originatorid.py | # encoding: utf-8
"""
originatorid.py
Created by Thomas Mangin on 2012-07-07.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from exabgp.protocol.ip import IPv4
from exabgp.bgp.message.update.attribute.attribute import Attribute
# ============================================================== Origi... |
qiime2/docs | source/utils.py | # ----------------------------------------------------------------------------
# Copyright (c) 2016-2022, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
gmimano/commcaretest | corehq/elastic.py | import copy
from urllib import unquote
import rawes
from django.conf import settings
from corehq.pillows.mappings.app_mapping import APP_INDEX
from corehq.pillows.mappings.case_mapping import CASE_INDEX
from corehq.pillows.mappings.domain_mapping import DOMAIN_INDEX
from corehq.pillows.mappings.group_mapping import GRO... |
aldebaran/qibuild | python/qisys/envsetter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
"""
This module contains the :py:class:`EnvSetter` class,
designed to take care of environment variables.
"""
from __future... |
rs2/pandas | pandas/tests/tools/test_to_datetime.py | """ test to_datetime """
import calendar
from collections import deque
from datetime import (
datetime,
timedelta,
)
from decimal import Decimal
import locale
from dateutil.parser import parse
from dateutil.tz.tz import tzoffset
import numpy as np
import pytest
import pytz
from pandas._libs import tslib
from... |
iivvoo/ethic | ethic.py | #!/usr/bin/env python3
import sys
import binascii
class OpDef:
def __init__(self, value, mnemonic, adds=0, deletes=0, codeargs=0,
i=""):
""" defines an opcode.
value - the opcode value, e.g. 0x00
mnemonic - opcode mnemonic, e.g. STOP
adds - number of ... |
mcr/ietfdb | ietf/liaisons/widgets.py | from django.conf import settings
from django.core.urlresolvers import reverse
from django.db.models.query import QuerySet
from django.forms.widgets import Select, Widget, TextInput
from django.utils.safestring import mark_safe
class FromWidget(Select):
def __init__(self, *args, **kwargs):
super(FromWidge... |
DrKylstein/Cambot | maestro.py | # Copyright (c) 2011 Kyle Delaney
# 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 an... |
olivierverdier/sfepy | tests/test_input_active_fibres.py | input_name = '../examples/large_deformation/active_fibres.py'
output_name_trunk = 'test_active_fibres'
from testsBasic import TestInputEvolutionary
class Test(TestInputEvolutionary):
@staticmethod
def from_conf(conf, options):
return TestInputEvolutionary.from_conf(conf, options, cls=Test)
def c... |
mfussenegger/python-prompt-toolkit | prompt_toolkit/utils.py | from __future__ import unicode_literals
__all__ = (
'EventHook',
'DummyContext',
)
class EventHook(object):
"""
Event hook::
e = EventHook()
e += handler_function # Add event handler.
e.fire() # Fire event.
Thanks to Michael Foord:
http://www.voidspace.org.uk/pytho... |
eunchong/build | scripts/slave/ios/test_runner_test.py | #!/usr/bin/python
# 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.
"""Runs unit tests on test_runner.py.
Usage:
./test_runner_test.py
"""
# pylint: disable=relative-import
import environment_setup
impo... |
giacomov/fermi_blind_search | fermi_blind_search/mplog.py | from logging.handlers import RotatingFileHandler
import multiprocessing, threading, logging, sys, traceback
import os
class MultiProcessingLog(logging.Handler):
def __init__(self, name, mode, maxsize, rotate):
logging.Handler.__init__(self)
self._handler = RotatingFileHandler(name, mode, maxsize,... |
fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractGoldenphoenixtranslationsWordpressCom.py |
def extractGoldenphoenixtranslationsWordpressCom(item):
'''
Parser for 'goldenphoenixtranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', ... |
savioabuga/mpesaviz | config/settings/production.py | # -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django... |
rafidka/hadithhouse | hadiths/views.py | #
# The MIT License (MIT)
#
# Copyright (c) 2018 Rafid Khalid Al-Humaimidi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to ... |
jonasschnelli/bitcoin | test/functional/test_framework/test_framework.py | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
import configparser
from enum import Enum
import argparse
import loggin... |
acigna/pywez | zsi/test/wsdl2py/test_Manufacturer.py | #!/usr/bin/env python
############################################################################
# Joshua R. Boverhof, LBNL
# See LBNLCopyright for copyright notice!
###########################################################################
import os, sys, unittest
from ServiceTest import main, ServiceTestCase, Serv... |
lucuma/authcode | authcode/auth.py | # coding=utf-8
from passlib import hash as ph
from passlib.context import CryptContext
from . import utils, wsgi
from .auth_authentication_mixin import AuthenticationMixin
from .auth_authorization_mixin import AuthorizationMixin
from .auth_views_mixin import ViewsMixin
from .constants import (
DEFAULT_HASHER, VALI... |
yaqiyang/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive_operations.py | # 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 ... |
jeffjenkins/MongoAlchemy | examples/examples.py | # The MIT License
#
# Copyright (c) 2010 Jeffrey Jenkins
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... |
jleni/QRL | tests/core/test_Miner.py | from unittest import TestCase
from mock import Mock, patch, create_autospec, MagicMock
from pyqryptonight.pyqryptonight import StringToUInt256
from qrl.core.AddressState import AddressState
from qrl.core.Block import Block
from qrl.core.misc import logger
from qrl.core.ChainManager import ChainManager
from qrl.core.M... |
pratiknarang/SMADES | PreProcess/P2P_CONSTANTS.py | PCAPDATADIR = '/media/san1/data_uga/vansh_temp/test/demo/'
FLOWDATADIR = './jan_flows/'
SUPERFLOWDATADIR = './jan_superflow/'
TRAININGDIR = './training/'
PCAPFILES = 'PcapInputFiles.txt' #Dir with initial pcap
TSHARKOPTIONSFILE = 'TsharkOptions.txt'
FLOWOPTIONS = 'FlowOptions.txt'
FLOWOUTFILE = PCAPDATADIR + 'FLOWDATA'... |
arindampradhan/yaaHN | yaaHN/models/item.py | # from .. import helpers
class Item(object):
"""item class for the yaaHN"""
# loose instant of Item class as it varies often according to story,comment,poll,user
def __init__(self, id=None, deleted=None, type=None, by=None, time=None, text=None, dead=None, parent=None, kids=None, url=None, score=None... |
demisto/content | Packs/ExpanseV2/Scripts/ExpanseAggregateAttributionUser/ExpanseAggregateAttributionUser_test.py | import demistomock as demisto # noqa
import ExpanseAggregateAttributionUser
INPUT = [
{"user": "lmori", "count": 10},
{"srcuser": "fvigo"},
{"source_user": "DEVREL\\lmori"},
]
CURRENT = [
{"username": "fvigo", "sightings": 1, "groups": [], "description": None, "domain": ""}
]
RESULT = [
{"user... |
jmwatte/beets | test/test_art.py | # This file is part of beets.
# Copyright 2015, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, ... |
madcowswe/ODrive | tools/fibre-tools/interface_generator.py | #!/bin/python3
import yaml
import json
import jinja2
import jsonschema
import re
import argparse
import sys
from collections import OrderedDict
# This schema describes what we expect interface definition files to look like
validator = jsonschema.Draft4Validator(yaml.safe_load("""
definitions:
interface:
type: o... |
KevDi/Flashcards | app/__init__.py | from flask import Flask
from flask_bootstrap import Bootstrap
from flask_mail import Mail
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_pagedown import PageDown
from config import config
bootstrap = Bootstrap()
mail = Mail()
moment = Moment()
db... |
CSGreater-Developers/HMC-Grader | app/scripts/listStudents.py | import sys
from app.scripts.helpers import *
from app.structures.models.user import *
if __name__ == "__main__":
courseName = "CS 5" #raw_input("Course Name: ")
semester = "Spring 15" #raw_input("Course Semester: ")
course = getCourse(semester, courseName)
if course == None:
print "Could not find the co... |
let5sne/shadowsocks | test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import signal
import select
import time
from subprocess import Popen, PIPE
if 'salsa20' in sys.argv[-1]:
from shadowsocks import encrypt_salsa20
encrypt_salsa20.test()
print 'encryption test passed'
p1 = Popen(['python', 'shadowsocks/server.p... |
birdland/dlkit-doc | dlkit/logging_/license.py | # -*- coding: utf-8 -*-
"""Logging Open Service Interface Definitions
logging version 3.0.0
Copyright (c) 2002-2004, 2006-2008 Massachusetts Institute of
Technology.
Copyright (c) 2011 Ingenescus. All Rights Reserved.
This Work is being provided by the copyright holder(s) subject to the
following license. By obtaini... |
ocefpaf/ODM2-Admin | odm2admin/modelHelpers.py | import csv
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "templatesAndSettings.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
import re
from datetime import datetime
from django.core.exceptions import MultipleObjectsReturned
from django.db import transa... |
foxfields/MiniAdventure | dev_tools/text_translate.py | import sys
import struct
if len(sys.argv) == 1:
sys.exit("Must include a file to process")
with open(sys.argv[1]) as input_file:
header_file = ""
data_file = ""
text_dict = {}
count = 0
for line in input_file.readlines():
if count == 0:
header_file = line.strip()
... |
sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/openstackclient/tests/common/test_extension.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... |
r4ts0n/django-envelope | tests/urls.py | try:
# Django 1.6+
from django.conf.urls import patterns, include, url
except ImportError:
# Django 1.5
from django.conf.urls.defaults import patterns, include, url
from envelope.views import ContactView
class SubclassedContactView(ContactView):
pass
urlpatterns = patterns('',
(r'', include... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.