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 |
|---|---|---|---|---|---|
"""Test Logex Initization and Error Handling"""
import subprocess
from unittest import TestCase
from samples import app, api, logex
from samples import bp_app, api_v1, api_v2, bp_logex
class BaseTestCase(TestCase):
DEBUG = True
__blueprints__ = False
@classmethod
def setUpClass(cls):
cls.a... | pinntech/flask-logex | tests/base.py | Python | mit | 1,058 |
# InteractiveWidgets.py
#!/bin/python
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
import ipywidgets as widgets
from IPython.display import display
import numpy as np
from itertools import cycle
plt.style.use("fivethirtyeight")
cla... | laserkelvin/IPython-Notebook-Tools | InteractiveWidgets.py | Python | gpl-3.0 | 11,014 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3_generated_agents_create_agent_sync.py | Python | apache-2.0 | 1,645 |
import os
from django import forms
from django.contrib.staticfiles.storage import staticfiles_storage
from django.db.models import fields
from django.db.models.fields import files
from django.utils.six import text_type
try:
from django.core import checks
except ImportError: pass
from smartfields.settings import KE... | un33k/django-smartfields | smartfields/fields/__init__.py | Python | mit | 11,464 |
# -*- coding: utf-8 -*-
"""
B2HANDLE utilities
"""
import os
from b2stage.apis.commons.endpoint import EudatEndpoint
try:
from b2handle.handleclient import EUDATHandleClient as b2handle
from b2handle.clientcredentials import PIDClientCredentials as credentials
from b2handle import handleexceptions
except... | EUDAT-B2STAGE/http-api | projects/b2stage/backend/apis/commons/b2handle.py | Python | mit | 6,987 |
# python imports
import unittest
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from foreman.application import make_app
class MockSession(dict):
def __init__(self, sid):
self.sid = sid
def should_save(self):
return True
class MockSessionStore(object):
de... | ubunteroz/foreman | foreman/tests/url_tests/base_tester.py | Python | gpl-3.0 | 1,395 |
"""
Test whether a process started by lldb has no extra file descriptors open.
"""
from __future__ import print_function
import os
import lldb
from lldbsuite.test import lldbutil
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
def python_leaky_fd_version(test):
import sys
# Py... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py | Python | bsd-3-clause | 4,059 |
# -*- coding: utf8 -*-
__module__ = "test_Array.py"
__author__ = "Jonathan D. Lettvin"
__copyright__ = "\
Copyright(C) 2016 Jonathan D. Lettvin, All Rights Reserved"
__credits__ = [ "Jonathan D. Lettvin" ]
__license__ = "GPLv3"
__version__ = "0.0.1"
__maintainer__ = "Jonathan D. Lettvin"
__email__ ... | jlettvin/Unicode | py2/test/test_Array.py | Python | gpl-3.0 | 3,301 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | faizan-barmawer/openstack_ironic | ironic/tests/db/utils.py | Python | apache-2.0 | 6,199 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 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.apac... | zestrada/nova-cs498cc | nova/openstack/common/processutils.py | Python | apache-2.0 | 5,489 |
from lsd.models import LSDRun, RunTrees, RunTaxonDates, RunOutGroups
from lsd.exceptions.RunParserException import RunParserException
from datetime import datetime
from django.utils import timezone
from django.db import transaction
import re
import tempfile
class LSDRunParser:
"""A parser of request that returns a... | fredericlemoine/lsd-web | lsd_web/lsd/controlers/LSDRunParser.py | Python | gpl-2.0 | 4,054 |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | kayzhou/tornado | tornado/httputil.py | Python | apache-2.0 | 29,436 |
"""
Integration with the Rachio Iro sprinkler system controller.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.rachio/
"""
from abc import abstractmethod
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice... | persandstrom/home-assistant | homeassistant/components/binary_sensor/rachio.py | Python | apache-2.0 | 4,460 |
import argparse
import configparser
import sys
from ..api import _v1
class ConfigHandler:
def __init__(
self,
args: argparse.Namespace,
config: configparser.ConfigParser,
default_config: _v1._private.DefaultConfig,
config_filename: _v1._private.ConfigFilename,
):
... | larose/utt | utt/plugins/0_config.py | Python | gpl-3.0 | 1,041 |
# Copyright (c) 2010 Hunter Blanks http://artifex.org/~hblanks/
# 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 th... | CapOM/ChromiumGStreamerBackend | tools/telemetry/third_party/gsutilz/third_party/boto/tests/integration/ec2/cloudwatch/test_connection.py | Python | bsd-3-clause | 11,614 |
__version__ = '2.0.18'
| gleitz/howdoi | howdoi/__init__.py | Python | mit | 23 |
from conans import ConanFile, CMake, tools
class LLAConan(ConanFile):
name = "LogicalAccess"
version = "2.3.0"
license = "https://github.com/islog/liblogicalaccess/blob/develop/LICENSE"
url = "https://github.com/islog/liblogicalaccess"
description = "ISLOG RFID library"
settings = "os", "compil... | islog/liblogicalaccess | conanfile.py | Python | lgpl-3.0 | 7,672 |
# Copyright 2014 IBM Corp.
from setuptools import setup, find_packages
setup(
name="hostmaintenance-client",
version="0.1",
packages=find_packages(exclude=['*.tests', 'tests',
'tests.*', '*.tests.*']),
entry_points={
'novaclient.extension': [
'ho... | openstack/powervc-driver | nova-powervc/hostmaintenanceclient/setup.py | Python | apache-2.0 | 380 |
class Card:
"""
Static class that handles cards. We represent cards as 32-bit integers, so
there is no object instantiation - they are just ints. Most of the bits are
used, and have a specific meaning. See below:
Card:
bitrank suit rank... | RIP95/kurisu-bot | addons/deuces/card.py | Python | mit | 5,195 |
"""The tests for the manual Alarm Control Panel component."""
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.setup import setup_component
from homeassistant.const import (
STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_... | MungoRae/home-assistant | tests/components/alarm_control_panel/test_manual.py | Python | apache-2.0 | 16,012 |
import os
from util.util import *
from util.csproj import *
from collections import deque
class EnvironmentItem:
def __init__(self, name, joinchar, values):
self.name = name
self.joinchar = joinchar
self.values = values
def __str__(self):
return os.path.expandvars(self.joinch... | mono/bockbuild | bockbuild/environment.py | Python | mit | 2,224 |
import ctypes
libc = ctypes.CDLL(None, use_errno=True)
def errcheck(result, func, args):
if result < 0:
e = ctypes.get_errno()
raise OSError(e, errno.strerror(e))
return result
def lookup(restype, name, argtypes):
f = libc[name]
f.restye = restype
f.argtypes = argtypes
f.err... | FuelCellUAV/FC_datalogger | quick2wire/quick2wire/syscall.py | Python | cc0-1.0 | 503 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | annarev/tensorflow | tensorflow/python/data/kernel_tests/unbatch_test.py | Python | apache-2.0 | 9,713 |
# $Id: simplecall.py 2171 2008-07-24 09:01:33Z bennylp $
#
# SIP account and registration sample. In this sample, the program
# will block to wait until registration is complete
#
# Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
#
# This program is free software; you can redistribute it and/or modify
... | ryanrdetzel/pjsip | pjsip-apps/src/python/samples/simplecall.py | Python | gpl-2.0 | 2,836 |
#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/formatters.py
__all__=('Formatter','DecimalFormatter')
__version__=''' $Id: formatters.py 3959 2012-09-27 14:39:39Z robin $ '''
_... | nakagami/reportlab | src/reportlab/lib/formatters.py | Python | bsd-3-clause | 3,887 |
import unittest
from datetime import datetime, timedelta
from fs.memoryfs import MemoryFS
from mock import Mock, patch
from xblock.runtime import KvsFieldData, DictKeyValueStore
import xmodule.course_module
from xmodule.modulestore.xml import ImportSystem, XMLModuleStore
from opaque_keys.edx.locations import SlashS... | geekaia/edx-platform | common/lib/xmodule/xmodule/tests/test_course_module.py | Python | agpl-3.0 | 10,863 |
from dashie_sampler import DashieSampler
import random
import requests
import collections
import re
import datetime
class ConfluenceCutFromDevelopAndRelease(DashieSampler):
def __init__(self, *args, **kwargs):
DashieSampler.__init__(self, *args, **kwargs)
def name(self):
return 'conflu... | edhiley/pydashie | pydashie/confluence_cut_from_develop_and_release.py | Python | mit | 2,020 |
# -*- coding: utf-8 -*-
from . import renderers | chrisjsewell/PyGauss | pygauss/chemlab_patch/graphics/__init__.py | Python | gpl-3.0 | 48 |
import numpy as np
import tensorflow as tf
from autoencoder.io import read_text, preprocess
from autoencoder.api import autoencode
import keras.backend as K
# for full reproducibility
np.random.seed(1)
tf.set_random_seed(1)
sess = tf.Session(config=tf.ConfigProto(intra_op_parallelism_threads=1,
... | theislab/dca | data/test-biochemists-zinb-ae.py | Python | apache-2.0 | 551 |
# Generated by Django 2.0.1 on 2018-02-14 16:14
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customer', '0003_auto_20180131_1525'),
]
operations = [
migrations.AlterField(
model_name='custome... | Semprini/cbe | cbe/cbe/customer/migrations/0004_auto_20180214_1614.py | Python | apache-2.0 | 692 |
"""Tests for OAuth2Reddit class."""
from __future__ import print_function, unicode_literals
from praw import Reddit, errors, decorators
from praw.objects import Submission
from six import text_type
from .helper import (PRAWTest, NewOAuthPRAWTest, USER_AGENT, betamax,
betamax_custom_header, mock_s... | michael-lazar/praw3 | tests/test_oauth2_reddit.py | Python | gpl-3.0 | 12,877 |
#!/usr/bin/env python
#
# Copyright 2015, Viktor Stanchev and contributors
#
# This file is part of pirate-get.
#
# pirate-get 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 Lic... | yanguojun/pirate-get | pirate-get.py | Python | agpl-3.0 | 25,402 |
#
# Copyright (C) 2014
# Sean Poyser (seanpoyser@gmail.com)
#
# 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... | ronniehd/repository.ronniehd | plugin.program.super.favourites/service.py | Python | gpl-3.0 | 3,483 |
"""
Nose test running.
This module implements ``test()`` and ``bench()`` functions for NumPy modules.
"""
from __future__ import division, absolute_import, print_function
import os
import sys
import warnings
from numpy.compat import basestring
import numpy as np
from .utils import import_nose, suppress_warnings
_... | b-carter/numpy | numpy/testing/nose_tools/nosetester.py | Python | bsd-3-clause | 20,562 |
#!/usr/bin/env python
from __future__ import print_function, absolute_import
import os
import subprocess
from . import database
import pybedtools as pbt
def get_window_data(conn, analysis_type, temp_file):
"""
Create a temp file of the requested statistic for each variant.
Execute a query against the va... | bgruening/gemini | gemini/gemini_windower.py | Python | mit | 3,125 |
# Test SIR with fixed recovery time under different dynamics
#
# Copyright (C) 2017--2020 Simon Dobson
#
# This file is part of epydemic, epidemic network simulations in Python.
#
# epydemic is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... | simoninireland/epydemic | test/test_sir_fixedrecovery.py | Python | gpl-3.0 | 1,340 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import pytest
import spack.installer as inst
import spack.repo
import spack.spec
def test_build_request_errors(install_... | iulian787/spack | lib/spack/spack/test/buildrequest.py | Python | lgpl-2.1 | 1,708 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | 0x0all/nupic | py/nupic/swarming/ModelRunner.py | Python | gpl-3.0 | 39,154 |
# Copyright 2020 Tensorforce Team. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | reinforceio/tensorforce | test/test_documentation.py | Python | apache-2.0 | 12,771 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | was4444/chromium.src | third_party/WebKit/Tools/Scripts/webkitpy/common/net/file_uploader.py | Python | bsd-3-clause | 4,518 |
#!/usr/bin/env python
import glob
import os
infiles=glob.glob('*_R.fits')
for file in infiles:#infiles:
agcnumber=file.split('_R.fits')[0]
print agcnumber
os.system('uat_mask.py '+str(agcnumber))
os.system('LCSrunellipseHa.py '+str(agcnumber))
| rfinn/LCS | paper1code/LCSrunellipseHa_all.py | Python | gpl-3.0 | 265 |
# Copyright 2011 OpenStack Foundation
#
# 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 l... | bswartz/cinder | cinder/tests/unit/utils.py | Python | apache-2.0 | 12,217 |
from sys import version_info
from django.conf import settings
from django.http.response import HttpResponseBadRequest
from morango.models import InstanceIDModel
from rest_framework import mixins
from rest_framework import status
from rest_framework import views
from rest_framework import viewsets
from rest_framework.r... | mrpau/kolibri | kolibri/core/device/api.py | Python | mit | 4,991 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#######################################################################
# Pinytodo - A Pinyto synced ToDo-List for Gtk+
# Copyright (C) 2105 Johannes Merkert <jonny@pinyto.de>
#
# This program is free software: you can redistribute it and/or mo... | Pinyto/pinytodo | pinyto_desktop_todo/PreferencesPinytoDesktopTodoDialog.py | Python | gpl-3.0 | 2,046 |
"""
Based on http://www.djangosnippets.org/snippets/595/
by sopelkin
"""
from django import forms
from django.forms import widgets
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
class CommaSeparatedUserInput(widgets.Input):
input_type = 'text'
def ren... | HiddenClever/django-messages | django_messages/fields.py | Python | bsd-3-clause | 1,923 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import datetime
import json
import logging
import os
import re
from telemetry import value as value_module
from telemetry.core import util
from telemetry.re... | guorendong/iridium-browser-ubuntu | tools/telemetry/telemetry/results/html_output_formatter.py | Python | bsd-3-clause | 6,072 |
#!/usr/bin/env python
# coding=utf-8
"""TrainingPreparator engine action.
Use this module to add the project main code.
"""
from .._compatibility import six
from .._logging import get_logger
from marvin_python_toolbox.engine_base import EngineBaseDataHandler
__all__ = ['TrainingPreparator']
logger = get_logger('... | marvin-ai/marvin-python-toolbox | marvin_python_toolbox/management/templates/python-engine/project_package/data_handler/training_preparator.py | Python | apache-2.0 | 859 |
from JumpScale import j
from Telegram import Telegram
from handlers.loggerHandler import LoggerHandler
from handlers.DemoHandler import DemoHandler
from handlers.InteractiveHandler import InteractiveHandler
import gevent
class TelegramBot:
"""
"""
def __init__(self, telegramkey=None):
"""
... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/telegram/TelegramBot.py | Python | apache-2.0 | 1,760 |
__author__ = 'smartschat'
class MultigraphDecoder:
def __init__(self, multigraph_creator):
self.coref_multigraph_creator = multigraph_creator
def decode(self, corpus):
for doc in corpus:
for mention in doc.system_mentions:
mention.attributes["set_id"] = None
... | Yegor-Budnikov/cort | cort/coreference/multigraph/decoders.py | Python | mit | 1,601 |
"""Author: Konrad Zemek, Michal Zmuda
Copyright (C) 2015 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'
Brings up a set of worker nodes. They can create separate clusters.
Script is parametrised by worker type related configurator.
"""
import copy
import json
import os
import ... | onedata/cluster-example | bamboos/docker/environment/worker.py | Python | mit | 7,994 |
import re
def multiple_replacer(*key_values):
replace_dict = dict(key_values)
def replacement_function(match): return replace_dict[match.group(0)]
pattern = re.compile("|".join([re.escape(k) for k, v in key_values]), re.M)
return lambda string: pattern.sub(replacement_function, string)
def multiple... | mre/kafka-influxdb | kafka_influxdb/encoder/escape_functions.py | Python | apache-2.0 | 518 |
# Copyright 2022 Nisaba Authors.
#
# 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 writi... | google-research/nisaba | nisaba/scripts/brahmic/util_test.py | Python | apache-2.0 | 1,046 |
#!/usr/bin/env python
'''
Component to handle data storage and search of all commands run
'''
from framework.dependency_management.dependency_resolver import BaseComponent
from framework.dependency_management.interfaces import CommandRegisterInterface
from framework.lib.general import cprint
from framework.db import m... | sharad1126/owtf | framework/db/command_register.py | Python | bsd-3-clause | 2,254 |
import logging
from collections import defaultdict
from django.core.management.base import (BaseCommand,
CommandError)
from django.db.utils import IntegrityError
from treeherder.model.derived import JobsModel
from treeherder.model.models import (FailureLine,
... | akhileshpillai/treeherder | treeherder/autoclassify/management/commands/autoclassify.py | Python | mpl-2.0 | 3,526 |
#------------------------------------------------------------------------------
'''A sample class-style, custom model using a modified laminate theory.'''
# Users can define classes for custom laminate theory models.
# Additionally, users can define custom defaults.
import math
import collections as ct
import pandas ... | par2/lamana | lamana/models/Wilson_LT.py | Python | bsd-3-clause | 9,880 |
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | LukeC92/iris | lib/iris/tests/unit/fileformats/um/fast_load_structured_fields/test_FieldCollation.py | Python | lgpl-3.0 | 8,389 |
# coding=utf8
"""
计算各类账户的净值
"""
import datetime
import pandas as pd
import tradingtime as tt
# from .nav import Nav
class Futures(object):
"""
期货账户净值计算
"""
def __init__(self, df):
self.df = df.sort_values("datetime") # 原始数据
if "tradeDay" not in self.df.columns:
self.df... | lamter/slaveo | fund/futures.py | Python | gpl-3.0 | 6,315 |
# Copyright (c) 2015 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import ... | jsachs/infer | infer/lib/python/inferlib/issues.py | Python | bsd-3-clause | 9,001 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from activities.models import Activity
from django.utils.html import escape
import bleach
class Feed(models.Model):
user = models.ForeignKey(User)
date = models.DateTimeField(auto_n... | kngeno/gis_kenya | apps/feeds/models.py | Python | mit | 2,135 |
import sys
def parse_file():
filename = sys.argv[1]
file = open(filename,"r")
data = file.read().splitlines()
seq_file = sys.argv[2]
file2 = open(seq_file,"r")
data2 = file2.read().splitlines()
i = 1
sequence=""
while i < len(data2):
sequence += data2[i]
... | mayc2/PseudoKnot_research | Centroid.py | Python | mit | 702 |
# Copyright (c) 2018, Frappe and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
class QualityReview(Document):
def validate(self):
# fetch targets from goal
if not self.reviews:
for d in frappe.get_doc('Quality Goal', self.goal).object... | mhbu50/erpnext | erpnext/quality_management/doctype/quality_review/quality_review.py | Python | gpl-3.0 | 1,684 |
import os
INPUT = "in"
OUTPUT = "out"
LOW = 0
HIGH = 1
GPIO_PATH = "/sys/class/gpio" # The root of the GPIO directories
EXPANDER = "pcf8574a" # This is the expander that is used on CHIP for the XIOs
def get_xio_base():
'''
Determines the base of the XIOs on the system by iterating through the /sys/class/gpi... | henla464/WiRoc-Python-2 | chipGPIO/chipGPIO.py | Python | gpl-3.0 | 2,567 |
from setuptools import setup, find_packages
with open('README.rst') as f:
description = f.read()
setup(
name='knitty-gritty',
version='0.0.2',
description='A tool for managing knitting machine patterns',
long_description=description,
url='https://github.com/mhallin/knitty-gritty',
author=... | mhallin/knitty-gritty | setup.py | Python | bsd-3-clause | 918 |
# -*- coding: utf-8 -*-
# Django settings for myconf project.
from settings import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Absolute path to the root of the project.
# i.e. the folder where this file is.
ROOTDIR="/home/gdetrez/Sources/MyConf/myconf/"
DATABASES = {
'default': {
'ENGINE': 'django.db.backe... | gdetrez/MyConf | fscons/development.py | Python | agpl-3.0 | 460 |
#
# Gramps - a GTK+/GNOME based genealogy program - Family Tree plugin
#
# Copyright (C) 2008,2009,2010,2014 Reinhard Mueller
# Copyright (C) 2010 lcc <lcc.mailaddress@gmail.com>
# Copyright (C) 2014 Gerald Kunzmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU... | gramps-project/addons-source | FamilyTree/FamilyTree.py | Python | gpl-2.0 | 54,078 |
#!/usr/bin/python2.7
from PySide.QtCore import *
from PySide.QtGui import *
from PySide import *
import sys
import monitor
from monitorthread import MonitorThread
from monitordata import MonitorData
class HMStandardItemModel( QStandardItemModel ):
monitor_data = None
values = None
previous_values = None
... | gary-pickens/HouseMonitor | housemonitor/qt/hm.py | Python | mit | 5,321 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansOldItalic-Regular'
native_name = ''
def glyphs(self):
chars = []
chars.append(0x0000) #uniFEFF ????
chars.append(0x0020) #uni00A0 SPACE
chars.append(0x00A0) #uni00A0 NO-BREAK SPACE
chars.appen... | davelab6/pyfontaine | fontaine/charsets/noto_chars/notosansolditalic_regular.py | Python | gpl-3.0 | 2,939 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 by Simmo Saan <simmo.saan@gmail.com>
#
# 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 l... | qguv/config | weechat/plugins/python/buffer_open.py | Python | gpl-3.0 | 11,668 |
from flask import Blueprint, request, jsonify
from geoip import geolite2
from prosoar.userconfig import get_uid_from_cookie, get_user_config_as_json
bp = Blueprint('settings', __name__)
@bp.route('/initial.js')
def initial_js():
return load(type='js')
@bp.route('/load')
def load(type='json'):
uid = get_u... | TobiasLohner/proSoar | prosoar/views/settings.py | Python | gpl-2.0 | 959 |
from celery.task import task
from celery.log import get_default_logger
from celery import group, chain, chord
from celeryconfig import config
import traceback
from helpers.parsers import parseDocument
log = get_default_logger()
def parseEnvelope(envelope, config, parsedDoc):
try:
parsedDoc.update(parse... | navnorth/LR-Data | src/tasks/parse.py | Python | apache-2.0 | 399 |
"""
Elfin data processing utilities module
"""
import inspect
import os
import sys
import code
import traceback as traceback_module
import json
import csv
import re
import numpy as np
RADII_TYPES = ['average_all', 'max_ca_dist', 'max_heavy_dist']
INF = float('inf')
TERM_TYPES = {'n', 'c'}
MOD_TYPES = {'single', 'hub'... | joy13975/elfin | elfinpy/utilities.py | Python | mit | 10,406 |
from time import time
import matplotlib.pyplot as plt
import numpy as np
plt.close("all")
start = time()
# Load the data
with open('Week2/pizza-train.json', 'r') as file:
lines = [line.split() for line in file.readlines()]
# Get request_text's
lines = [line[1:] for line in lines if line[0] == '"request_text":']... | North-Guard/BigToolsComplicatedData | Week2/exercise_2_optimized.py | Python | mit | 1,113 |
# Lint as: python3
# Copyright 2019 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Utilities for tracing tf.function inputs and outputs."""
# This file uses the fo... | google/iree | integrations/tensorflow/python_projects/iree_tf/iree/tf/support/trace_utils.py | Python | apache-2.0 | 15,437 |
import numpy as np
from numpy.testing import (assert_equal, assert_array_almost_equal,
assert_raises)
from skimage.transform._geometric import _stackcopy
from skimage.transform._geometric import GeometricTransform
from skimage.transform import (estimate_transform, matrix_transform,
... | almarklein/scikit-image | skimage/transform/tests/test_geometric.py | Python | bsd-3-clause | 7,870 |
from ..lib.transformer import Transformer
from ..lib.instruction import Instruction
import csv, os
from LatLon import LatLon
# Tube station data from http://commons.wikimedia.org/wiki/London_Underground_geographic_maps/CSV
class Tube(Transformer):
__punctuation_characters = ['.', ',', '?', '!', ';', ':', '-']
... | tomwadley/sexting-xkeyscore | sexting/transformers/tube.py | Python | isc | 2,150 |
# Copyright (c) Sebastian Scholz
# See LICENSE for details.
""" All the grant types that we support """
from enum import Enum
class GrantTypes(Enum):
""" The different grant types to request a token defined by the OAuth2 spec. """
RefreshToken = 'refresh_token'
AuthorizationCode = 'authorization_code'
... | Abestanis/TwistedOAuth2 | txoauth2/granttypes.py | Python | mit | 415 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either vers... | markovmodel/PyEMMA | pyemma/util/tests/statistics_test.py | Python | lgpl-3.0 | 1,879 |
"""
Utility functions for logging messages. Exports:
get_logger: Return a logger with a specified severity threshold.
"""
import logging
import sys
LEVELS = {
"debug": logging.DEBUG,
"info": logging.INFO,
"warning": logging.WARNING,
"error": logging.ERROR,
"critical": logging.CRITICAL
}
LOG_... | COMBINE-lab/piquant | piquant/log.py | Python | mit | 1,181 |
# -*- coding: utf-8 -*-
# copyright 2016 Camptocamp
# license agpl-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import json
from odoo.tests import common
from odoo.addons.queue_job.fields import JobEncoder, JobDecoder
class TestJson(common.TransactionCase):
def test_encoder(self):
value = ['a',... | leorochael/queue | queue_job/tests/test_json_field.py | Python | agpl-3.0 | 897 |
from app.schema_validation.definitions import uuid, datetime
post_create_user_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "POST schema for creating user",
"type": "object",
"properties": {
'email': {"type": "string"},
'name': {"type": "string"},
... | NewAcropolis/api | app/routes/users/schemas.py | Python | mit | 881 |
# -*- coding: utf-8 -*-
"""Simple functions for dealing with posts, replies, votes and subscriptions
within Redis and MongoDB
:license: AGPL v3, see LICENSE for more details
:copyright: 2014-2021 Joe Doherty
"""
# 3rd party imports
from flask import current_app as app, url_for
from jinja2.filters import do_capital... | pjuu/pjuu | pjuu/posts/backend.py | Python | agpl-3.0 | 24,772 |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP68 implementation."""
import time
from test_framework.blocktools import (
NORMAL_GBT_REQ... | fujicoin/fujicoin | test/functional/feature_bip68_sequence.py | Python | mit | 18,674 |
# -*- coding: utf-8 -*-
# Copyright 2018 Sebastian Semper, Christoph Wagner
# https://www.tu-ilmenau.de/it-ems/
#
# 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... | EMS-TU-Ilmenau/fastmat | setup.py | Python | apache-2.0 | 13,182 |
# 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
# d... | rahulunair/nova | nova/tests/functional/db/test_quota.py | Python | apache-2.0 | 12,306 |
#!/usr/local/bin/python
#Vamos a usar sentencias de escape como las comillas
mi_variable = "Este texto lleva comillas \" "
| toblerone554/TutorialPyhton | Tema1/comillas.py | Python | gpl-3.0 | 125 |
# accounts/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^my/$', views.my_view, name='accounts.my'),
url(r'^login/$', views.login_users_view, name='accounts.login'),
url(r'^signup/$', views.signup_users_view, name='accounts.signup'),
url(r'^logout/$', views.logou... | tic-ull/gedea | src/miprimeraplicacion_django/accounts/urls.py | Python | gpl-3.0 | 360 |
import unittest
import pytest
from selenium.webdriver.common.by import By
from selenium.common.exceptions import MoveTargetOutOfBoundsException
class ClickScrollingTest(unittest.TestCase):
def testClickingOnAnchorScrollsPage(self):
scrollScript = "var pageY;\
if (typeof(window.pageYOffs... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/third_party/webdriver/pylib/test/selenium/webdriver/common/click_scrolling_tests.py | Python | mit | 3,069 |
###############################################################################
#
# $Id: NsoundGimpUtils.py 494 2010-06-22 03:44:58Z weegreenblobbie $
#
# Nsound is a C++ library and Python module for audio synthesis featuring
# dynamic digital filters. Nsound lets you easily shape waveforms and write
# to disk or ... | weegreenblobbie/nsound | src/plugins/gimp/NsoundGimpUtils.py | Python | gpl-2.0 | 4,455 |
from django.utils.translation import ugettext_lazy as _
label = _('expenses')
VERSION = '0.3.0'
| alviandk/django-expense | expense/__init__.py | Python | bsd-3-clause | 97 |
"""Code to wrap some GLOO API calls."""
import numpy
import asyncio
try:
import pygloo
except ImportError:
raise ImportError("Can not import pygloo."
"Please run 'pip install pygloo' to install pygloo.")
import ray
from ray.util.collective.types import ReduceOp, torch_available
from ray.u... | pcmoritz/ray-1 | python/ray/util/collective/collective_group/gloo_util.py | Python | apache-2.0 | 8,436 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import h2o
from h2o.exceptions import H2OValueError
from tests import pyunit_utils
def rbind_check():
"""Test H2OFrame.rbind() function."""
frame1 = h2o.import_file(path=pyunit_utils.locate("smalldata/junit/cars.csv"))
nrows1 = frame1.nrow
frame2 = frame1.... | h2oai/h2o-3 | h2o-py/tests/testdir_munging/pyunit_rbind.py | Python | apache-2.0 | 1,643 |
from . import registration
from . import user
from . import test
from . import hype
from . import organize
from . import mentor
from . import judge
from .index import IndexPage
from .help import HelpPage
from .links.index import LinksPage
from .hacks.index import HacksPage
from django.shortcuts import render
def hand... | andrewsosa/hackfsu_com | api/webapp/views/__init__.py | Python | apache-2.0 | 576 |
#
# IIT Kharagpur - Hall Management System
# System to manage Halls of residences, Warden grant requests, student complaints
# hall worker attendances and salary payments
#
# MIT License
#
"""
@ authors: Madhav Datt, Avikalp Srivastava
"""
import password_validation as pv
import re
import db_rebuild as dbr
from ..wor... | madhav-datt/kgp-hms | src/database/login.py | Python | mit | 2,263 |
# Copyright 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 requ... | maheshp/novatest | nova/tests/api/openstack/compute/contrib/test_flavor_access.py | Python | apache-2.0 | 11,762 |
### this is just a simple implementationof metropolis algorithm without external mag. field 1000 M.C. steps are done at max.
from random import uniform
from math import *
import commands
J=-5.0
m=30
n=30
t=0.2
beta=1/t
d1={}
S=0
#getting an array of neighbours
d2={}
for i in range(1,m-1):
for j in range(1,n-1):
... | debsankha/bedtime-programming | monte_carlo/ribbon.py | Python | gpl-3.0 | 1,694 |
import ast
import os
import urlparse
# Import global settings to make it easier to extend settings.
from django.conf.global_settings import * # pylint: disable=W0614,W0401
import dj_database_url
#==============================================================================
# Generic Django project settings
#=======... | metabrainz/botbot-web | botbot/settings/base.py | Python | mit | 10,645 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/domain/v20180808/errorcodes.py | Python | mit | 8,078 |
#!/usr/bin/env python
# coding: utf-8
# References:
# man curl
# https://curl.haxx.se/libcurl/c/curl_easy_getinfo.html
# https://curl.haxx.se/libcurl/c/easy_getinfo_options.html
# http://blog.kenweiner.com/2014/11/http-request-timings-with-curl.html
# editted
#editted 2
from __future__ import print_function
import os... | adityachechani/ECE601-Homework-1- | httpstat.py | Python | mit | 10,683 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | ypid-bot/check_mk | web/plugins/visuals/mkeventd.py | Python | gpl-2.0 | 10,172 |
from socket import inet_aton, inet_ntoa
from struct import calcsize, pack, unpack, unpack_from
from .routing import Node
from ..messaging.payload import Payload
def encode_values(values):
return b''.join([pack('!H', len(value)) + value for value in values])
def decode_values(values_str):
values = []
in... | qstokkink/py-ipv8 | ipv8/dht/payload.py | Python | lgpl-3.0 | 7,346 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.