code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import unittest
import pytest
import cupy
from cupy import testing
from cupy_tests.core_tests.fusion_tests import fusion_utils
@testing.gpu
@testing.slow
@pytest.mark.skipif(
cupy.cuda.runtime.is_hip, reason='HIP does not support this')
class TestFusionExample(unittest.TestCase):
def generate_inputs(self, xp... | cupy/cupy | tests/cupy_tests/core_tests/fusion_tests/test_example.py | Python | mit | 1,541 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Comment'
db.delete_table('tickets_comment')
# ... | danjac/ownblock | ownblock/ownblock/apps/tickets/migrations/0002_auto__del_comment__add_field_ticket_comment__add_field_ticket_action.py | Python | mit | 7,671 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 0, transform = "Quantization", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Quantization/trend_MovingAverage/cycle_0/ar_/test_artificial_1024_Quantization_MovingAverage_0__20.py | Python | bsd-3-clause | 272 |
#!/usr/bin/python2
# Copyright (c) 2013, Rethink Robotics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this l... | abestick/ee125 | baxter/tools/src/update_robot.py | Python | bsd-3-clause | 7,023 |
#!/usr/bin/env python2
# Using class variables incorrectly
# What do you expect in the print statements below?
class A(object):
x = 1 # class variable
class B(A):
pass
class C(A):
pass
print A.x, B.x, C.x
B.x = 2
print A.x, B.x, C.x
A.x = 3
print A.x, B.x, C.x
# answer:
# The class varia... | enrimatta/RU_Python_IV | challenges/challenge02.py | Python | gpl-2.0 | 688 |
from django.contrib import auth
from django.core import validators
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.manager import EmptyManager
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import smart_str
from django.uti... | paulsmith/geodjango | django/contrib/auth/models.py | Python | bsd-3-clause | 15,774 |
#!/usr/bin/env python
import argparse
import redis
import flask
import calendar
import dateutil.parser
from gevent.wsgi import WSGIServer
from flask import Flask, jsonify
from flask_cors import CORS, cross_origin
app = Flask(__name__)
CORS(app)
REDIS_POOL = None
@app.route('/')
@cross_origin()
def hello_world():
... | danni-m/redis-tsdb | tools/GrafanaDatastoreServer.py | Python | agpl-3.0 | 2,440 |
# Copyright 2012 John Kleint
# This is free software, licensed under the MIT License; see LICENSE.txt.
"""BlameThrower analyzer unit tests."""
import unittest
from test import AnalyneTest
class AnalyzerTests(AnalyneTest):
def test_httpbin_pylint(self):
self.assert_analynes_equal('analyzers', 'pylint', ... | jkleint/blamethrower | test/analyzers/test_analyzers.py | Python | mit | 696 |
"""
SoftLayer.tests.CLI.modules.server_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a series of integration tests designed to test the complete
command line interface.
:license: MIT, see LICENSE for more details.
"""
try:
# Python 3.x compatibility
import builtins # NOQA
bui... | cloudify-cosmo/softlayer-python | SoftLayer/tests/CLI/modules/server_tests.py | Python | mit | 27,613 |
#
# Copyright (c) 2008--2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | colloquium/spacewalk | client/tools/rhncfg/config_client/rhncfgcli_list.py | Python | gpl-2.0 | 1,604 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------
# Filename: MAX7219fonts.py
# -----------------------------------------------------------
# Fonts data for use by the MAX7219array.py library
#
# v1.0
# JLC Archibald
# -------------------------------------------... | ceremcem/aktos-led-panel | MAX7219fonts.py | Python | mit | 51,355 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Tests for sysctl checks."""
from absl import app
from grr_response_core.lib.parsers import linux_sysctl_parser
from grr_response_server.check_lib import checks_test_lib
from grr.test_lib import test_lib
class SysctlTests(checks_test_lib.HostCheckTest):
@classmet... | google/grr | grr/server/grr_response_server/checks/sysctl_test.py | Python | apache-2.0 | 1,553 |
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.torrent.base import TorrentProvider
import traceback
import six
log = CPLog(__name__)
class TorrentSh... | entomb/CouchPotatoServer | couchpotato/core/providers/torrent/torrentshack/main.py | Python | gpl-3.0 | 2,899 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_mask_vect.py
--------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
******************************... | CS-SI/QGIS | python/plugins/processing/algs/grass7/ext/r_mask_vect.py | Python | gpl-2.0 | 1,850 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure macro expansion of $(VCInstallDir) is handled, and specifically
always / terminated for compatibility.
"""
import ... | Jet-Streaming/gyp | test/win/gyptest-macro-vcinstalldir.py | Python | bsd-3-clause | 743 |
# -*- coding: utf-8 -*-
"""
@file
@brief Defines a way to reference a package or a page in this package.
"""
import sphinx
from docutils import nodes
from .import_object_helper import import_any_object
class epkg_node(nodes.TextElement):
"""
Defines *epkg* node.
"""
pass
class ClassStruct:
"""... | sdpython/pyquickhelper | src/pyquickhelper/sphinxext/sphinx_epkg_extension.py | Python | mit | 7,895 |
# Copyright (c) 2012 OpenStack Foundation
# 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 ... | takeshineshiro/nova | nova/tests/unit/compute/test_claims.py | Python | apache-2.0 | 14,665 |
import warnings
from great_expectations.dataset.util import create_multiple_expectations
from great_expectations.profile.base import DatasetProfiler
# This particular file should be immune to the new changes
class ColumnsExistProfiler(DatasetProfiler):
@classmethod
def _profile(cls, dataset, configuration=No... | great-expectations/great_expectations | great_expectations/profile/columns_exist.py | Python | apache-2.0 | 1,449 |
"""
String Utils.
Bruce Wernick
10 June 2021
"""
import random
import string
from textdistance import hamming
__all__ = ['rand_str', 'pword', 'SameText', 'fsig']
def rand_str(n=12, chars=string.ascii_letters+string.digits):
"return a random string of length n"
return ''.join([random.choice(chars)... | bru32/magz | magz/ustring.py | Python | mit | 1,668 |
import sys
import os
import base64
from db import *
from funcs import *
from routes_ips import *
from routes_data import *
##
# ROOT
##
@app.route('/')
def hello_world():
return abort(404)
##
# MAIN
##
@app.route('/'+app.config['RNG_ID']+'/')
def get_endpoints():
data = {
'end... | sauloalrpi/pifollow | routes.py | Python | mit | 1,876 |
import sys
import xmlrpclib
import urllib
from certmaster import SSLCommon
class SSL_Transport(xmlrpclib.Transport):
user_agent = "pyOpenSSL_XMLRPC/%s - %s" % ('0.1', xmlrpclib.Transport.user_agent)
def __init__(self, ssl_context, timeout=None, use_datetime=0):
if sys.version_info[:3] >= (2, 5, 0):... | caglar10ur/func | func/overlord/sslclient.py | Python | gpl-2.0 | 2,005 |
#!/usr/bin/env python3
from collections import OrderedDict
import itertools
import logging
import threading
import xcffib
import xcffib.xproto
import xcffib.randr
from barython import _BarSpawner
logger = logging.getLogger("barython")
def get_randr_screens():
conn = xcffib.connect()
conn.randr = conn(xcff... | Anthony25/barython | barython/screen.py | Python | bsd-3-clause | 6,190 |
#!/usr/bin/env python3
import collections
from itertools import groupby
from typing import List, MutableMapping
from .path import Path
# future: sorting & unsorting
# fixme: problems with the total sum/value at the root
# (not the same, as value at root can be more than the total of the next level)
# solution: do no... | klieret/pyplot-hierarchical-pie | hpie/calc.py | Python | bsd-3-clause | 5,593 |
# -*- coding: utf-8 -*-
# defining the basic object we will be working with
# adapted from :
# /media/KINGSTON/ARMOR/ARMOR/python/weatherPattern.py ,
# /media/KINGSTON/ARMOR/ARMOR/python/clustering.py ,
# /media/KINGSTON/ARMOR/2013/pythonJan2013/basics.py
# Yau Kwan Kiu, Room 801, 23-1-2013
###################... | yaukwankiu/armor | pattern_.py | Python | cc0-1.0 | 62,433 |
from furl import furl
from lxml import etree
from django.conf import settings
from share import Harvester
class PLOSHarvester(Harvester):
url = 'http://api.plos.org/search'
MAX_ROWS_PER_REQUEST = 999
def do_harvest(self, start_date, end_date):
if not settings.PLOS_API_KEY:
raise E... | zamattiac/SHARE | providers/org/plos/harvester.py | Python | apache-2.0 | 1,721 |
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions an... | JazzeYoung/VeryDeepAutoEncoder | theano/misc/cpucount.py | Python | bsd-3-clause | 2,307 |
# -*- coding: utf-8 -*-
"""
The module :mod:`openerp.tests.common` provides unittest test cases and a few
helpers and classes to write tests.
"""
import errno
import glob
import importlib
import json
import logging
import os
import select
import subprocess
import threading
import time
import itertools
import unittest
... | vileopratama/vitech | src/openerp/tests/common.py | Python | mit | 15,778 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | ludmilamarian/invenio | invenio/legacy/bibexport/__init__.py | Python | gpl-2.0 | 1,044 |
''' Tests for feeds. '''
import unittest
import datetime
from reader.shared import db
from reader.models.feed import Feed
from testutils import ModelTest
class FeedsTests(unittest.TestCase):
def test_create_new_feed(self):
url = 'http://xkcd.com/rss.xml'
self.assertEqual(url, Feed(url).url)
... | ajferrick/simple_reader | server/tests/test_feeds.py | Python | gpl-2.0 | 1,452 |
import os
from django.test import TestCase
from django.test.utils import override_settings
import math
from dataset_manager.enums import FeatureType, ComputingStateType, FeatureFunctionType
from dataset_manager.models import Dataset
from django.conf import settings
test_path = os.path.join(settings.DATASET_DEFAULT_PA... | dumoulinj/ers | ers_backend/audio_processor/tests.py | Python | mit | 2,387 |
from parsimonious.exceptions import VisitationError
from parsimonious.exceptions import ParseError as ParsimoniousParseError
from .types import Source
class ParseError(ValueError): pass
class OutOfContextNodeError(ParseError): pass
class ComparisonParseError(ParseError): pass
class OperationParseError(ParseErr... | eykd/ravel | ravel/exceptions.py | Python | mit | 733 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class UsersApp(AppConfig):
name = 'munch.apps.users'
verbose_name = _('Users')
def ready(self):
import munch.apps.users.api.v1.urls # noqa
| crunchmail/munch-core | src/munch/apps/users/apps.py | Python | agpl-3.0 | 253 |
import unittest
# Skip this whole module test if running under PyPy (incompatible with Cython)
try:
import __pypy__
# Empty test unit to show the reason of skipping
class TestMissingDependency(unittest.TestCase):
@unittest.skip('Missing dependency - Cython is incompatible with PyPy')
def ... | lrq3000/unireedsolomon | unireedsolomon/tests/test_cpolynomial.py | Python | mit | 9,289 |
# Copyright © 2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implie... | splice/report_server | src/report_server/common/client.py | Python | gpl-2.0 | 5,321 |
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("core", "doctype", "domain")
frappe.reload_doc("core", "doctype", "has_domain")
active_domains = frappe.get_active_domains()
all_domains = frappe.get_all("Domain")
for d in all_domains:
if d.name not in active_domains:
in... | vjFaLk/frappe | frappe/patches/v10_0/remove_custom_field_for_disabled_domain.py | Python | mit | 442 |
from django.utils.encoding import smart_str
from haystack import models
from lazymodel import LazyModel
class SearchResult(models.SearchResult):
"""Extended SearchResult class for general purposes."""
def __getattr__(self, attr):
"""
The __getattr__ method of Haystack's SearchResult is too ... | apnarm/django-apn-search | apn_search/results.py | Python | mit | 1,372 |
"""Zookeeper Partitioner Implementation
:Maintainer: None
:Status: Unknown
:class:`SetPartitioner` implements a partitioning scheme using
Zookeeper for dividing up resources amongst members of a party.
This is useful when there is a set of resources that should only be
accessed by a single process at a time that mul... | python-zk/kazoo | kazoo/recipe/partitioner.py | Python | apache-2.0 | 14,668 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""The way the branch puller talks to the database."""
__metaclass__ = type
# Export nothing. This code should be obtained via utilities.
__all__ = []
from datetime import timede... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/code/model/branchpuller.py | Python | agpl-3.0 | 1,256 |
#!/usr/bin/env python3
#
# t.py: utility for contest problem development
# Copyright (C) 2009-2017 Oleg Davydov
#
# 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... | burunduk3/t.sh | verdict.py | Python | gpl-2.0 | 2,357 |
from typing import List, Tuple, Dict, NamedTuple, Optional
import json
import logging
import numpy
from depccg.types import ScoringResult
from depccg.cat import Category
logger = logging.getLogger(__name__)
def is_json(file_path: str) -> bool:
try:
with open(file_path, 'r') as data_file:
js... | masashi-y/depccg | depccg/utils.py | Python | mit | 4,155 |
# coding: iso-8859-1
"""
htpc-updater
Copyright (c) 2014 Nikola Klaric (nikola@generic.company)
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 th... | nikola/htpc-updater | src/htpc-updater.py | Python | mit | 10,353 |
"""
The CouchDB template loader allows for Tornado templates to be stored in CouchDB
and retrieved on demand and supports all of the syntax of including and
extending templates that you'd expect in any other template loader.
"""
import json
import logging
from tornado import escape
from tornado import httpclient
from ... | lucius-feng/tinman | tinman/couchdb.py | Python | bsd-3-clause | 2,097 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import ConfigParser
import StringIO
import unittest
class ConfigItems(object):
"""Return configuration file values from sections "DB" and "Web" in a
configuration file readable by ConfigParser.SafeConfigParser as defined in
the documentation of the ConfigParse... | dandersson/shortweb | swlib/config.py | Python | gpl-2.0 | 5,380 |
# -*- coding: utf-8 -*-
import itertools
import functools
import os
import re
import logging
import pymongo
import datetime
from dateutil.parser import parse as parse_date
import urlparse
from collections import OrderedDict
import warnings
import pytz
from flask import request
from django.core.urlresolvers import reve... | Ghalko/osf.io | website/project/model.py | Python | apache-2.0 | 156,052 |
import datetime
import math
import random
class Ordine:
#costruttore
def __init__(self, id_es, num_ord, id_ttl, qta, prezzo):
self.id_es=id_es
self.num_ord=num_ord
self.id_ttl=id_ttl
self.qta=qta
self.qta_eff=0
self.prezzo=prezzo
now = datetime.datetime.no... | DrFr4nk/Agent_Base_Market_Simulator | Ordine.py | Python | mit | 1,379 |
from flask.ext.script import Command, Manager, Option
from flask import current_app
import os
from subprocess import Popen
class InvalidPathException(Exception):
pass
class SyncJS(Command):
option_list = (
Option('--path', '-p', dest='path'),
)
def run_command(self, command):
cmd = P... | realizeapp/realize-core | core/commands/frontend.py | Python | agpl-3.0 | 1,248 |
# Copyright 2013-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | llvtt/mongo-connector | mongo_connector/doc_managers/doc_manager_simulator.py | Python | apache-2.0 | 4,571 |
"""Tests for utility functions used in remote consent forms.
Copyright (C) 2020 A. Samuel Pottinger ("Sam Pottinger", gleap.org)
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 t... | Samnsparky/cdibase | prog_code/util/consent_util_test.py | Python | gpl-3.0 | 4,657 |
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# 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, modi... | carlgao/lenga | images/lenny64-peon/usr/share/python-support/python-boto/boto/tests/test.py | Python | mit | 2,935 |
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from common import public
class qyxg_chinesefinancialnews():
need_check_ziduan = [
'bbd_table',
'search_key'
]
def check_bbd_table(self, indexstr, ustr):
ret = None
if ustr and len(ustr):
... | mefly2012/platform | src/clean_validate/qyxg_chinesefinancialnews.py | Python | apache-2.0 | 577 |
#!/usr/bin/env python2
# Shane Tully (shane@shanetully.com)
# shanetully.com
# GitHub repo: https://github.com/shanet/Google-Music-Playlist-Sync
# Makes use of the Unofficial Google Music API by Simon Weber
# https://github.com/simon-weber/Unofficial-Google-Music-API
# Copyright (C) 2013 Shane Tully
# This program ... | shanet/Google-Music-Playlist-Sync | google-music-playlist-sync.py | Python | gpl-3.0 | 14,734 |
from extraction.core import ExtractionRunner
from extraction.runnables import Extractor, RunnableError, Filter, ExtractorResult
import os
import sys
import extractor.csxextract.extractors.grobid as grobid
import extractor.csxextract.extractors.pdfbox as pdfbox
import extractor.csxextract.extractors.tei as tei
import ex... | SeerLabs/PDFMEF | src/extractor/run_extraction.py | Python | apache-2.0 | 2,199 |
from datetime import timedelta
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User
from django.db.models import Sum, Avg
from timeslot.models import Program
class IcecastLog(models.Model):
datetime_start = models.DateTimeField(blank=True, null=True)
datetim... | Xicnet/radioflow-scheduler | project/icecast_stats/models.py | Python | agpl-3.0 | 2,778 |
# -*- coding: iso-8859-1 -*-
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the usef... | BartoszCichecki/onlinepython | onlinepython/pypy-2.4.0-win32/lib-python/2.7/inspect.py | Python | gpl-2.0 | 42,959 |
#
# Copyright (C) 2016 Rodrigo Freitas
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distribute... | rsfreitas/shellbber | shellber/chat/__init__.py | Python | gpl-2.0 | 763 |
# Copyright 2014 A10 Networks
#
# 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 agree... | gandelman-a/neutron-lbaas | neutron_lbaas/drivers/driver_base.py | Python | apache-2.0 | 3,997 |
# Code imported from https://github.com/taskcluster/taskcluster/blob/32629c562f8d6f5a6b608a3141a8ee2e0984619f/services/treeherder/src/util/route_parser.js
# A Taskcluster routing key will be in the form:
# treeherder.<version>.<user/project>|<project>.<revision>.<pushLogId/pullRequestId>
# [0] Routing key prefix used... | jmaher/treeherder | treeherder/etl/taskcluster_pulse/parse_route.py | Python | mpl-2.0 | 1,512 |
# -*- coding: utf-8 -*-
# Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U
#
# This file is part of FIWARE project.
#
# 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://w... | telefonicaid/fiware-facts | tests/acceptance/fiwarecloto_client/client.py | Python | apache-2.0 | 4,297 |
from django.apps import AppConfig
class TestbConfig(AppConfig):
name = 'testb'
| bluekvirus/django-express | testb/apps.py | Python | mit | 85 |
# apis_v1/documentation_source/voter_guides_to_follow_retrieve_doc.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
def voter_guides_to_follow_retrieve_doc_template_values(url_root):
"""
Show documentation about voterGuidesToFollowRetrieve
"""
required_query_parameter_list = [
... | wevote/WebAppPublic | apis_v1/documentation_source/voter_guides_to_follow_retrieve_doc.py | Python | bsd-3-clause | 8,198 |
from datetime import date
from workalendar.tests import GenericCalendarTest
from workalendar.asia import HongKong, Japan, Qatar, Singapore
from workalendar.asia import SouthKorea, Taiwan, Malaysia
class HongKongTest(GenericCalendarTest):
cal_class = HongKong
def test_year_2010(self):
""" Interestin... | sayoun/workalendar | workalendar/tests/test_asia.py | Python | mit | 17,173 |
#!/usr/bin/env python3
import os
import sys
import argparse
from .usage import usage
from .smdimerge import smdimerge
from .timerge import timerge
from .maganim import maganim
def parse_args(args):
funcs = {
"smdimerge": smdimerge,
"timerge": timerge,
"maganim": maganim
}
if "--... | KoffeinFlummi/ArmaUtils | armautils_cli/__init__.py | Python | mit | 701 |
import time
from django.conf import settings
from django.contrib.auth.models import User
from selenium.common.exceptions import StaleElementReferenceException
from inthe_am.taskmanager.models import TaskStore
def find_element_and_do(
selector,
args=None,
kwargs=None,
test=lambda x: x.visible,
ac... | coddingtonbear/inthe.am | inthe_am/taskmanager/features/steps/utils.py | Python | agpl-3.0 | 1,490 |
from __future__ import unicode_literals
import os
import csv
import json
from jsonpath_rw import parse
import dvc.logger as logger
from dvc.exceptions import OutputNotFoundError, BadMetricError, NoMetricsError
from dvc.utils.compat import builtin_str, open, StringIO, csv_reader
def _read_metric_json(fd, json_path):... | dataversioncontrol/dvc | dvc/repo/metrics/show.py | Python | apache-2.0 | 7,590 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014-2016 Alex Forencich
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... | Diti24/python-ivi | ivi/agilent/agilentE4425B.py | Python | mit | 1,494 |
"""playbook URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | sir-code-a-lot/playbook | playbook/urls.py | Python | mit | 826 |
# Copyright 2019 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... | chemelnucfin/tensorflow | tensorflow/python/framework/indexed_slices.py | Python | apache-2.0 | 16,012 |
"""Support for OpenTherm Gateway sensors."""
import logging
from homeassistant.components.sensor import ENTITY_ID_FORMAT
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity, async_generate_entity_id
from .const i... | fbradyirl/home-assistant | homeassistant/components/opentherm_gw/sensor.py | Python | apache-2.0 | 2,747 |
# Sample code implementing LeNet-5 from Liu Liu
import tensorflow as tf
import numpy as np
import time
import h5py
# import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
import itertools
from copy import deepcopy
import os
import os.path
# from tensorflow.examples.tutorials.mnist import inpu... | HoliestCow/ece692_deeplearning | project5/cnn/cnnseqDETandSID.py | Python | mit | 12,377 |
__author__ = 'Cheng'
| TejasM/wisely | wisely_project/studyroom/__init__.py | Python | mit | 21 |
from flask import Blueprint, render_template
from TrainTime import TrainTime
traintime_blueprint = Blueprint('traintime_blueprint',__name__)
@traintime_blueprint.route('/traintime/')
def traintime_index():
return render_template('traintime_index.html',stations = list(TrainTime.getAvailableStations())+list(TrainT... | farseenabdulsalam/wap-proxy | TrainTimeBlueprint.py | Python | mit | 1,108 |
#!/usr/bin/env python
from camera import ConfigurableCamera
from settings import Job, IMAGES_DIRECTORY
def main():
job = Job()
if job.exists():
file_prefix = job.settings.file_prefix
output_file = IMAGES_DIRECTORY + '/' + file_prefix + '_{counter:03d}.jpg'
with ConfigurableCamera(job... | projectweekend/Pi-Camera-Time-Lapse | time_lapse.py | Python | mit | 440 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == "__main__":
from build import *
addroot()
import pytools.build as b
b.build()
b.run('qtfract')
| rboman/progs | apps/fractal/cpp_qt/run.py | Python | apache-2.0 | 179 |
import pytest
import string
import numpy as np
from numpy.random import random, randn
from numpy import allclose, empty, zeros, zeros_like, pi, array, int, all, float64
from numpy.fft import fftfreq
from mpi4py import MPI
from mpiFFT4py.pencil import R2C as Pencil_R2C
from mpiFFT4py.slab import R2C as Slab_R2C
from mp... | spectralDNS/mpiFFT4py | tests/test_FFT.py | Python | lgpl-3.0 | 10,981 |
import pyrow
import json
import asyncio
from autobahn.asyncio.websocket import WebSocketServerProtocol
from autobahn.asyncio.websocket import WebSocketServerFactory
class MyServerProtocol(WebSocketServerProtocol):
def __init__(self):
self.is_open = False
def onOpen(self):
try:
sel... | david-jarman/CookieRower | websocket_server.py | Python | bsd-2-clause | 1,483 |
# coding: utf-8
from django import template
from django.db import models
from ref.models import ExtendedParameterDict
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def verbose_name(value):
return value._meta.verbose_name
@register.filter
def ksh_protect_and_quote(v... | digitalfox/MAGE | ref/templatetags/filter.py | Python | apache-2.0 | 2,371 |
# Generated by Django 2.2.11 on 2020-10-12 14:18
from django.db import migrations, models
import huntserver.models
class Migration(migrations.Migration):
dependencies = [
('huntserver', '0061_puzzle_puzzle_file'),
]
operations = [
migrations.AlterField(
model_name='puzzle',
... | dlareau/puzzlehunt_server | huntserver/migrations/0062_auto_20201012_1018.py | Python | mit | 513 |
import re
import array
from seal.lib.aligner.mapping import Mapping
class SAMMapping(Mapping):
"""
A mapping implementation for storing SAM data.
A SAMMapping object is constructed from a list of SAM fields --
see http://samtools.sourceforge.net
"""
CIGAR_PATTERN = re.compile(r"(\d+)([MIDNSHP])")
REFID_PATT... | QwertyManiac/seal-cdh4 | seal/lib/aligner/sam_mapping.py | Python | gpl-3.0 | 1,761 |
'''TextFinder - a widget for searching through a text widget
'''
import Tkinter as tk
import ttk
class TextFinder(ttk.Frame):
def __init__(self, parent, text_widget):
self.text = text_widget
ttk.Frame.__init__(self, parent)
validatecommand = (self.register(self._on_validate), "%P")
... | boakley/robotframework-workbench | rwb/widgets/textfinder.py | Python | apache-2.0 | 8,510 |
# Copyright 2011 Terena. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the foll... | enriquepablo/django-vff | setup.py | Python | bsd-2-clause | 2,489 |
import numpy as np
import citysim3d.envs
from visual_dynamics.envs import Panda3dEnv
from visual_dynamics.spaces import Space, BoxSpace, TranslationAxisAngleSpace
from visual_dynamics.utils.config import ConfigObject
class SimpleQuadPanda3dEnv(citysim3d.envs.SimpleQuadPanda3dEnv, Panda3dEnv):
def _get_config(sel... | alexlee-gk/visual_dynamics | visual_dynamics/envs/quad_panda3d_env.py | Python | mit | 2,967 |
from headphones import logger
from headphones.exceptions import ConfigError
""" List of types, which ConfigOpt could handle internally, without conversions """
_primitives = (int, str, unicode, bool, list, float)
class OptionModel(object):
""" Stores value of option, and know, how to write this value to the conf... | maxkoryukov/headphones | headphones/config/_datamodel.py | Python | gpl-3.0 | 4,171 |
#!/usr/bin/env python
################################################################################
## PipeCheck: Specifying and Verifying Microarchitectural ##
## Enforcement of Memory Consistency Models ##
## ... | daniellustig/pipecheck | parse_litmus_test_results.py | Python | lgpl-2.1 | 3,270 |
# 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 https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | jeffbryner/MozDef | tests/alerts/test_guard_duty_probe.py | Python | mpl-2.0 | 2,607 |
'''
Created on Aug 2, 2013
@author: chadcumba
Parallel workflow execution with SLURM
'''
import os
import re
import subprocess
from time import sleep
from .base import (SGELikeBatchManagerBase, logger, iflogger, logging)
from nipype.interfaces.base import CommandLine
class SLURMPlugin(SGELikeBatchManagerBase):... | mick-d/nipype_source | nipype/pipeline/plugins/slurm.py | Python | bsd-3-clause | 4,983 |
"""Gait pattern planning module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import math
from typing import Any, Sequence
import gin
import numpy as np
from pybullet_envs.minitaur.agents.baseline_controller import gait_generator
_DE... | nrz/ylikuutio | external/bullet3/examples/pybullet/gym/pybullet_envs/minitaur/agents/baseline_controller/openloop_gait_generator.py | Python | agpl-3.0 | 7,711 |
import glob
import logging
import math
import OpenEXR
import Imath
import os
from PIL import Image, ImageChops
from golem.core.common import is_windows
logger = logging.getLogger("gnr.task")
def print_progress(i, total):
print "\rProgress: {} % ".format(100.0 * float(i + 1) / total),
def open_exr_as_rgb... | imapp-pl/golem | gnr/task/renderingtaskcollector.py | Python | gpl-3.0 | 9,385 |
#!/usr/local/bin/python2
# Advertise.py student version
# Python 2
# CBD 1st Feb.2011
import os.path
import sys
import getopt
from socket import *
def usage(ProgName):
print("usage: %s -port <port no.> -host<hostname> -service <service>\n"%(ProgName),
file=sys.stderr)
os.exit( 0 )
#
# Parse command line ... | rbprogrammer/advanced_python_topics | course-material/py2/Advertise.py | Python | apache-2.0 | 1,938 |
import sys, os
import ast
import copy
import pp
python2 = sys.version[0] == "2"
def find_unparse_module():
for path in sys.path:
for dirpath, dirs, files in os.walk(path):
for file in files:
if file == "unparse.py":
sys.path.append(dirpath)
... | dorki/py-namer | pynamer.py | Python | gpl-2.0 | 25,153 |
from .relation import *
from .operation import *
from .dependency import *
from .apt import *
from .pip import *
from .yatr import *
from syn.base_utils import harvest_metadata, delete
with delete(harvest_metadata, delete):
harvest_metadata('metadata.yml')
| mbodenhamer/depman | depman/__init__.py | Python | mit | 262 |
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from docker.errors import APIError
from requests.exceptions import ConnectionError
from compose.cli import errors
from compose.cli.errors import handle_connection_errors
from tests import mock
@pytest.yield_fixture
def mock... | sdurrheimer/compose | tests/unit/cli/errors_test.py | Python | apache-2.0 | 2,518 |
# 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
# distributed under the... | sileht/pifpaf | pifpaf/drivers/ceph.py | Python | apache-2.0 | 5,134 |
# 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... | iwaseyusuke/ryu | ryu/tests/unit/packet/test_zebra.py | Python | apache-2.0 | 21,409 |
def impkw():
print('impkw1')
def my_third_keyword():
print('my_third_keyword1')
| gliviu/hyperclick-robot-framework | fixtures/gotodef/approximate-resource-imports/gotodeflib1.py | Python | mit | 88 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_result_py3.py | Python | mit | 1,603 |
from melkman.green import green_init
green_init()
from datetime import datetime, timedelta
from eventlet.green import socket
from eventlet.support.greenlets import GreenletExit
from eventlet.wsgi import server as wsgi_server
import os
import time
from urlparse import urlsplit
from urllib import quote_plus
from webob i... | ltucker/melkman | tests/helpers.py | Python | gpl-2.0 | 6,931 |
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | callidus/PyKMIP | kmip/tests/unit/core/test_utils.py | Python | apache-2.0 | 4,594 |
import genmsg.msgs
try:
from cStringIO import StringIO # Python 2.x
except ImportError:
from io import StringIO # Python 3.x
MSG_TYPE_TO_IDL = {
'byte': 'octet',
'char': 'char',
'bool': 'boolean',
'uint8': 'unsigned short', # TODO reconsider mapping
'int8': 'short', # TODO reconsider m... | osrf/ros_dds | prototype/src/genidl/src/genidl/__init__.py | Python | apache-2.0 | 7,660 |
import logging
import bernhard
from logging import Handler
from bernhard import Client
from bernhard import TransportError
TCPTransport = bernhard.TCPTransport
UDPTransport = bernhard.UDPTransport
bernhard.log.addHandler(logging.NullHandler())
class ConnectionError(Exception):
def __init__(self, msg):
... | my-zhang/elogging | elogging/handlers/riemann.py | Python | apache-2.0 | 951 |
"""
Returns the X and Y (presumably longitude,latitude)
coordinates from the points in the indicated shapefile.
The missing value separates coordinates between shapes.
"""
from __future__ import print_function
import numpy
import pyferret
import shapefile
def ferret_init(efid):
"""
Initialization for the sha... | NOAA-PMEL/PyFerret | pyfermod/fershp/shapefile_readxy.py | Python | unlicense | 4,929 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.