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 |
|---|---|---|---|---|---|
'''
Displays volume on Adafruit NeoPixel FeatherWing
'''
import gc
from time import sleep, time
import network
from config import hosts, ssid, pw
from umqtt_client import MQTTClient as umc
from machine import Pin
from neopixel import NeoPixel
with open('mqtt_id', 'r') as f:
mqtt_id = f.read().strip()
with open(... | slzatz/esp8266 | neo_volume.py | Python | mit | 1,830 |
## Script (Python) "require_login"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Login
##
login = 'login'
from Products.CMFCore.utils import getToolByName
import zope.i18nmessageid
from Products.CMFPlone.i18nl10n import u... | socialplanning/opencore | Products/OpenPlans/skins/openplans_login_patches/require_login.py | Python | gpl-3.0 | 2,059 |
# Copyright DataStax, 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 writing, softwa... | datastax/python-driver | tests/integration/datatype_utils.py | Python | apache-2.0 | 5,034 |
from django.conf import settings
from math import *
def validate_ai_script(text):
"""
Verify input AI script. False if the script contains not allowed keywords like "import", "exec"
:param text: String
:return: True/False
"""
if text.strip() == "":
return False
for line in text.spl... | Petrole/MaturePyRobots | WebPyRobot/backend/utils.py | Python | gpl-3.0 | 4,839 |
'''
Created on Mar 28, 2015
Copyright 2015, Institute for Systems Biology.
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... | isb-cgc/ISB-CGC-data-proc | data_upload/util/process_metadata_current.py | Python | apache-2.0 | 2,703 |
'''
@author: Frank
'''
import unittest
from zstackwoodpecker.engine import engine
class Test(unittest.TestCase):
def testName(self):
logfd = open('/tmp/log', 'w')
engine.execute_case('test/testcase2.py', logfd)
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.... | zstackio/zstack-woodpecker | zstackwoodpecker/test/test_engine.py | Python | apache-2.0 | 351 |
# Copyright 2015 Lukas Lalinsky
#
# 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... | lalinsky/python-phoenixdb | phoenixdb/types.py | Python | apache-2.0 | 6,740 |
#
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# BitBake Toaster Implementation
#
# Copyright (C) 2013 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# pub... | wwright2/dcim3-angstrom1 | sources/bitbake/lib/toaster/bldviewer/views.py | Python | mit | 9,287 |
#IMPORTANT: pydevd_constants must be the 1st thing defined because it'll keep a reference to the original sys._getframe
from pydevd_constants import * #@UnusedWildImport
import pydev_imports
from pydevd_comm import CMD_CHANGE_VARIABLE, \
CMD_EVALUATE_EXPRESSION, \
CMD_... | tenXer/PyDevSrc | pydevsrc/pydevd.py | Python | epl-1.0 | 55,520 |
#
# constants.py: anaconda constants
#
# Copyright (C) 2001 Red Hat, Inc. All rights reserved.
#
# 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 ... | mairin/anaconda | pyanaconda/constants.py | Python | gpl-2.0 | 5,251 |
"""Networking overhead (200 trials on 200 nodes)
In this run, we will start 100 trials and run them on 100 different nodes.
This test will thus measure the overhead that comes with network communication
and specifically log synchronization.
Cluster: cluster_100x2.yaml
Test owner: krfricke
Acceptance criteria: Shoul... | ray-project/ray | release/tune_tests/scalability_tests/workloads/test_network_overhead.py | Python | apache-2.0 | 1,303 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2008 Francisco José Rodríguez Bogado, #
# Diego Muñoz Escalante. #
# (pacoqueen@users.sourceforge.ne... | pacoqueen/ginn | ginn/formularios/utils_administracion.py | Python | gpl-2.0 | 5,324 |
# coding: utf-8
import subprocess
import os
def deploycron(filename="", content="", override=False):
"""install crontabs into the system if it's not installed.
This will not remove the other crontabs installed in the system if not
specified as override. It just merge the new one with the existing one.
... | Hawker65/deploycron | deploycron/__init__.py | Python | mit | 5,288 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | precedenceguo/mxnet | python/mxnet/gluon/nn/basic_layers.py | Python | apache-2.0 | 28,158 |
import copy
import pylab
import random
import numpy as np
from environment import Env
from keras.layers import Dense
from keras.optimizers import Adam
from keras.models import Sequential
EPISODES = 1000
# 그리드월드 예제에서의 딥살사 에이전트
class DeepSARSAgent:
def __init__(self):
self.load_model = False
# 에이전트... | rlcode/reinforcement-learning-kr | 1-grid-world/6-deep-sarsa/deep_sarsa_agent.py | Python | mit | 4,030 |
"""
File info
"""
# FIXME: No idea if this is necessary
__all__ = ["addup", "treebuilder", "treeprinter", "node"] | fourpoints/addup | __init__.py | Python | mit | 114 |
"""Entrance of Postprocess for SEIMS.
@author : Liangjun Zhu, Huiran Gao
@changelog:
- 17-08-17 - lj - redesign and rewrite the plotting program.
- 18-02-09 - lj - compatible with Python3.
"""
from __future__ import absolute_import, unicode_literals
import os
import sys
if os.path.abspath(os.pat... | lreis2415/SEIMS | seims/postprocess/main.py | Python | gpl-3.0 | 707 |
"""
Poll for market data every 1 second and print bid/ask in blue/red
"""
import sys
import threading
from citytrader.request_client import RequestClient
from citytrader.helpers import price_to_decimal
# gather user auth input and init RequestClient()
def main():
client_id = raw_input('Enter your client_id: ')
... | optionscity/city-trader-python-lib | examples/market_data_poller.py | Python | gpl-2.0 | 2,246 |
'''
This software is released under an MIT/X11 open source license.
Copyright 2012-2013 Diffeo, Inc.
'''
from __future__ import division
import os
import math
import hashlib
from itertools import ifilter, imap
try:
from collections import Counter
except ImportError:
from backport_collections import Counter
fro... | trec-kba/streamcorpus-pipeline | streamcorpus_pipeline/text_profile_signature.py | Python | mit | 1,404 |
# Copyright 2017 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import json
from .common import BaseTest, functional, Bag
from botocore.exceptions import ClientError
from c7n.exceptions import PolicyValidationError
from c7n.resources.ecr import lifecycle_rule_... | capitalone/cloud-custodian | tests/test_ecr.py | Python | apache-2.0 | 10,970 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11a1 on 2017-02-09 13:12
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lang', '0004_auto_20161222_1459'),
('trans', '0073_auto_20170209_1359'),
]
operatio... | lem9/weblate | weblate/trans/migrations/0074_auto_20170209_1412.py | Python | gpl-3.0 | 1,412 |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 25 09:48:58 2016
@author: aitor
"""
from collections import Counter
import json
import sys
from keras.models import Sequential
from keras.models import model_from_json
from keras.layers import Dense, Activation, Dropout
from keras.layers import Convolution2D, MaxPooling2... | aitoralmeida/dl_activity_recognition | cnn/old/cnn_simple_relu.py | Python | gpl-3.0 | 3,729 |
#!/usr/bin/env python
##
from __future__ import print_function
import os
import argparse
import sys
import warnings
import copy
import imp
nodes = imp.load_source('nodes', 'steps/nnet3/components.py')
nnet3_train_lib = imp.load_source('ntl', 'steps/nnet3/nnet3_train_lib.py')
chain_lib = imp.load_source('ncl', 'steps/n... | shubhujf/Compare_GRUandLSTM | KALDI.V2/steps/nnet3/lstm/make_configs.py | Python | apache-2.0 | 17,057 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-09-26 14:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import djangocms_text_ckeditor.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('c... | hrpt-se/hrpt | apps/hrptinfo/migrations/0001_initial.py | Python | agpl-3.0 | 1,028 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
from . import tests
| ddico/odoo | addons/l10n_it_edi/__init__.py | Python | agpl-3.0 | 141 |
# coding=utf-8
# This file is part of SickRage.
#
# URL: https://SickRage.GitHub.io
# Git: https://github.com/SickRage/SickRage.git
#
# SickRage 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... | Jusedawg/SickRage | tests/sickrage_tests/media/show_fan_art_tests.py | Python | gpl-3.0 | 1,573 |
from airy.core.web import *
from airy.core.db import *
from airy.core.serializers.json import JSONSerializer
def expose_method(f):
def wrapped(self, *args, **kwargs):
if f.__name__ in self.methods:
return f(self, *args, **kwargs)
else:
self.write("Method Not Available")
... | letolab/airy | airy/contrib/api/handlers.py | Python | bsd-2-clause | 4,151 |
from __future__ import absolute_import
from __future__ import with_statement
from functools import wraps
from kombu.pidbox import Mailbox
from celery.app import app_or_default
from celery.task import control
from celery.task import PingTask
from celery.utils import uuid
from celery.tests.utils import unittest
clas... | mzdaniel/oh-mainline | vendor/packages/celery/celery/tests/test_task/test_task_control.py | Python | agpl-3.0 | 4,711 |
#!/usr/bin/python -u
import numpy as np
from itdbase import Cell
import itin
def countbond(bondfile):
xcell = set_cell_from_vasp('POSCAR')
pos = xcell.get_cart_positions()
buff = []
with open(bondfile) as f:
for line in f:
buff.append(line.split())
binfo = {}
j = 0
f... | zhuligs/abinitioCafe | countbond.py | Python | gpl-3.0 | 4,211 |
# python3
# coding=utf-8
# Copyright 2020 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 ... | google/TaglessCRM | src/dags/base_dag.py | Python | apache-2.0 | 11,861 |
"""
A collection of linear classifier models.
.. autoclass:: revscoring.scoring.models.LogisticRegression
:members:
:member-order:
"""
import logging
from sklearn.linear_model import LogisticRegression as sklearn_LR
from .sklearn import ProbabilityClassifier
logger = logging.getLogger(__name__)
class Logi... | he7d3r/revscoring | revscoring/scoring/models/linear.py | Python | mit | 647 |
#!/usr/bin/env python3
import os
import subprocess
import sys
if not os.environ.get('DESTDIR'):
icon_dir = os.path.join(sys.argv[1], 'icons', 'hicolor')
# schema_dir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
print('Update icon cache...')
subprocess.call(['gtk-update-icon-cache', '-f', '-t', icon_dir])... | GNOME/atomix | meson_post_install.py | Python | gpl-2.0 | 423 |
import hnco
from hnco import function as fn
from hnco import algorithm as algo
from hnco.function import controller as ctrl
from hnco.random import Generator
Generator.set_seed()
size = 100
f = fn.OneMax(size)
c1 = ctrl.ProgressTracker(f)
c1.set_log_improvement(True)
c2 = ctrl.StopOnMaximum(c1)
a = algo.OnePlusOne... | courros/hnco | bindings/examples/progress-tracker.py | Python | lgpl-3.0 | 392 |
# -*- coding: utf-8 -*-
from flask import current_app as app, g, request, url_for
from flask.ext.restful import abort, fields, marshal
from werkzeug.exceptions import NotFound
from shiva.auth import Roles
from shiva.constants import HTTP
from shiva.exceptions import (InvalidFileTypeError, IntegrityError,
... | tooxie/shiva-server | shiva/resources/base.py | Python | mit | 17,331 |
#!/usr/bin/env python3
# Version 1.0
# Author Alexis Blanchet-Cohen
# Date: 15/06/2014
import argparse
import glob
import os
import subprocess
import util
# Read the command line arguments.
parser = argparse.ArgumentParser(description='Generate scripts to convert bedgraph files from one-based start to zero-based sta... | blancha/abcngspipelines | bischipseq/convert1StartTo0Start_with_threshold_batch.py | Python | gpl-3.0 | 2,231 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use the AWS SDK for Python (Boto3) with AWS Key Management Service (AWS KMS)
to manage key aliases.
"""
# snippet-start:[python.example_code.kms.Scenario_AliasManagement]
import logging... | awsdocs/aws-doc-sdk-examples | python/example_code/kms/alias_management.py | Python | apache-2.0 | 7,114 |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | kimasaki/compute-image-packages | google-daemon/usr/share/google/google_daemon/accounts_manager.py | Python | apache-2.0 | 4,198 |
# -*- coding: utf-8 -*-
import scrapy
class PDFItem(scrapy.Item):
file_urls = scrapy.Field()
files = scrapy.Field()
| chrisdev/barbados_stockex_scraper | barbados_stockex_scraper/items.py | Python | bsd-2-clause | 127 |
"""Tests for group models."""
# pylint: disable=invalid-name, no-self-use
from unittest import skipIf
from django.conf import settings
from django.contrib.auth.models import Group as AuthGroup
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.db.models.query im... | lpatmo/actionify_the_news | open_connect/groups/tests/test_models.py | Python | mit | 21,994 |
#
# replcode.py
# By Joel Gould
# joelg@alum.mit.edu
# http://www.gouldhome.com/
#
# This subroutine takes a string, which may have embedded Python code, and
# executes that embedded code, returning the resulting string. It is useful
# for things like dynamically producing webpages.
#
# We first execute any code i... | ActiveState/code | recipes/Python/52217_Replace_embedded_Pythcode_string_results/recipe-52217.py | Python | mit | 5,534 |
import xbmcgui, xbmcplugin
import urllib
import sys
# xbmc-hockey-streams
# author: craig mcnicholas, swedemon
# contact: craig@designdotworks.co.uk, zergcollision@gmail.com
addonId = 'plugin.video.xbmc-hockey-streams-frodo'
dataPath = 'special://profile/addon_data/' + addonId
# Represents an enumeration for applica... | actionbronson/xbmc-hockey-streams | source/plugin.video.xbmc-hockey-streams-frodo/utils.py | Python | gpl-2.0 | 4,628 |
# Copyright (c) 2014 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | yuewko/neutron | neutron/tests/functional/agent/linux/test_iptables.py | Python | apache-2.0 | 6,946 |
import os
import pytest
from eg import config
from eg import substitute
from mock import patch
# Support python 2 and 3
try:
import ConfigParser
except ImportError:
from configparser import ConfigParser
PATH_EGRC_WITH_DATA = os.path.join(
'test',
'assets',
'egrc_withdata'
)
PATH_EGRC_NO_DATA = o... | scorphus/eg | test/config_test.py | Python | mit | 21,317 |
revision = '1b8378b8914'
down_revision = '55c008192aa'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('person',
sa.Column('romania_curata', sa.Text(), nullable=True))
def downgrade():
op.drop_column('person', 'romania_curata')
| mgax/mptracker | alembic/versions/1b8378b8914_person_romania_curat.py | Python | mit | 281 |
"""Append module search paths for third-party packages to sys.path.
****************************************************************
* This module is automatically imported during initialization. *
****************************************************************
In earlier versions of Python (up to 1.5a3), scri... | carvalhomb/tsmells | guess/src/Lib/site.py | Python | gpl-2.0 | 8,373 |
'''
Created on May 2, 2012
@package: superdesk posts
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor
Contains the SQL alchemy meta for post type API.
'''
from ..api.type import PostType
from sqlalchemy.dialects.mysql.base import INTEGER
from sqlalchemy.s... | superdesk/Live-Blog | plugins/superdesk-post/superdesk/post/meta/type.py | Python | agpl-3.0 | 898 |
# Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
# This library 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
# versi... | golismero/golismero | thirdparty_libs/num2words/lang_EN_GB.py | Python | gpl-2.0 | 1,930 |
import numpy as np
from new_feature_set import NewFeatureSet
from sklearn.metrics import log_loss
from sklearn.model_selection import cross_val_score
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import get_scorer
class Evaluator:
de... | pplonski/gafe | gafe/evaluator.py | Python | apache-2.0 | 844 |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
import json
import urllib.parse
import aiohttp
from aiohttp import web
from foglamp.common import utils
from foglamp.common import logger
from foglamp.common.service_record import ServiceRecord
from foglamp.common.storage_cli... | foglamp/FogLAMP | python/foglamp/services/core/api/notification.py | Python | apache-2.0 | 23,568 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/envisage/initialization/initializer.py | Python | apache-2.0 | 11,331 |
import collections
import numpy as np
from guesswhat.statistics.abstract_plotter import *
import seaborn as sns
import pandas as pd
class SuccessArea(AbstractPlotter):
def __init__(self, path, games, logger, suffix):
super(SuccessArea, self).__init__(path, self.__class__.__name__, suffix)
status... | GuessWhatGame/guesswhat | src/guesswhat/statistics/success_area.py | Python | apache-2.0 | 2,720 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='... | codefisher/djangopress | djangopress/accounts/migrations/0002_auto_20140927_1229.py | Python | mit | 610 |
import pyb
p = pyb.Pin(8)
p.init(pyb.Pin.OUT_PP,pyb.Pin.PULL_NONE)
print(p)
while True:
#p.value(True)
p.high()
print("value:"+str(p.value()))
pyb.delay(1000)
#p.value(False)
p.low()
print("value:"+str(p.value()))
pyb.delay(1000)
| martinribelotta/uPyIDE | share/uPyIDE/snipplet/Main_gpios.py | Python | gpl-3.0 | 244 |
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# 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 applicabl... | sebrandon1/neutron | neutron/db/l3_hascheduler_db.py | Python | apache-2.0 | 4,750 |
# Copyright 2009 Shikhar Bhushan
#
# 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... | travelping/ncclient | ncclient/operations/session.py | Python | apache-2.0 | 1,368 |
# encoding = utf-8
import importlib
import copy
import logging
import os
import sys
import json
import tempfile
from solnlib.packages.splunklib import modularinput as smi
from solnlib.log import Logs
from solnlib.modular_input import checkpointer
from solnlib import utils as sutils
from splunktaucclib.global_config i... | PaloAltoNetworks-BD/SplunkforPaloAltoNetworks | Splunk_TA_paloalto/bin/splunk_ta_paloalto/aob_py3/modinput_wrapper/base_modinput.py | Python | isc | 21,425 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src/solutions/common/models/participation.py | Python | apache-2.0 | 971 |
from discord.ext import commands
from clembot.core.logs import Logger
class RaidLevelConverter(commands.Converter):
level_alias_map = {
'MEGA': 'M',
'EX': 'E'
}
label_map = {
'M' : 'mega',
'E' : 'ex'
}
@classmethod
def to_level(cls, argument) -> str:
... | TrainingB/Clembot | clembot/exts/pkmn/raid_boss.py | Python | gpl-3.0 | 5,091 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#raise主动抛出异常
raise IOError, "file not exit" | zhangyage/Python-oldboy | day04/exceptions/Raise.py | Python | apache-2.0 | 105 |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2014 Daniele Simonetti
#
# 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.
#
... | OpenNingia/l5rcm-data-access | l5rdal/perk.py | Python | lgpl-3.0 | 4,184 |
# coding: utf-8
import struct
import pytest
from pandas.compat import OrderedDict, u
from pandas import compat
from pandas.io.msgpack import Packer, Unpacker, packb, unpackb
class TestPack(object):
def check(self, data, use_list=False):
re = unpackb(packb(data), use_list=use_list)
assert re ... | GuessWhoSamFoo/pandas | pandas/tests/io/msgpack/test_pack.py | Python | bsd-3-clause | 5,296 |
from sqlalchemy import create_engine, MetaData
from sqlalchemy.orm import scoped_session, create_session
engine = None
metadata = MetaData()
db_session = scoped_session(
lambda: create_session(autocommit=False, autoflush=False, bind=engine))
def init_engine(uri):
global engine
engine = create_engine(uri... | myblt/myblt-website | database.py | Python | gpl-2.0 | 434 |
def DoDDL(con):
con.query("use tiaraboom")
con.query("""create reference table if not exists sources(
user_id bigint not null,
source_id bigint auto_increment,
source blob default null,
primary key(source_id) using hash)""")
c... | jvictor0/TiaraBoom | sharat/sharat_ddl.py | Python | mit | 2,217 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = [
'ecreall_dace',
'pyramid_layout',
'substanced',
'pillow'
]
setup(na... | ecreall/pontus | setup.py | Python | agpl-3.0 | 1,701 |
from dbt.exceptions import CompilationException
from dbt.contracts.graph.manifest import Manifest
from dbt.contracts.files import ParseFileType
from test.integration.base import DBTIntegrationTest, use_profile, normalize, get_manifest
import shutil
import os
class TestDocs(DBTIntegrationTest):
@property
def ... | analyst-collective/dbt | test/integration/068_partial_parsing_tests/test_pp_docs.py | Python | apache-2.0 | 5,212 |
from pytest import mark
from intervals import IntInterval
class TestArithmeticOperators(object):
@mark.parametrize(('first', 'second', 'result'), (
(IntInterval([1, 3]), IntInterval([1, 2]), [2, 5]),
(IntInterval([1, 3]), 1, [2, 4]),
(1, IntInterval([1, 3]), [2, 4]),
([1, 2], IntI... | kvesteri/intervals | tests/interval/test_arithmetic.py | Python | bsd-3-clause | 2,203 |
import os
from dummy.collectors.generic import PassFailCollector
from dummy.statistics.generic import CountEngine
TEMP_DIR = '.tmp' # directory for temp files
TESTS_DIR = 'tests' # directory with all the tests
TEST_OUTPUT_DIR = os.path.join( TEMP_DIR, 'logs' )
TARGET_DIR = 'results' # Store results in this directory
S... | ElessarWebb/dummy | docs/code/example_dummy_config.py | Python | mit | 1,006 |
"""
get aggregate and cluster information of asphaltene molecules from .lammpstrj file.
"""
import numpy
import pp
import gc
from datetime import datetime
import matplotlib.pyplot as plt
a, b, c = 86.62, 86.62, 86.62
NProcess = 16
stride = 10
dirName = r"F:\simulations\asphaltenes\production\longtime\ath... | riddlezyc/geolab | src/structure/aggregateClusterAnalysis.py | Python | gpl-3.0 | 5,696 |
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_install_requires():
with open('requirements.txt', 'r') as f:
return [line.strip() for line in f]
def get_test_requires():
with open('test-requirements.txt', 'r') as f:
... | yangl1996/libpagure | setup.py | Python | gpl-2.0 | 1,365 |
#! /usr/bin/env python
from collections import OrderedDict
from codonutils import translate_codon
from data_reader import (
CONSENSUS, any_fasta_reader)
MUTINS = 0
MUTDEL = 1
FSINS = 2
FSDEL = 3
def build_mutation(pos, cons, codon, indel_type=-1, indel=None):
codon = codon if indel_type != MUTDEL else ''
... | hivdb/gag-gp41 | scripts/lanl_reader.py | Python | cc0-1.0 | 4,425 |
import functools
from multiprocessing.pool import ThreadPool
from avocado.models import DataView
from avocado.formatters import FormatterMismatchError, registry as formatters
from cStringIO import StringIO
class BaseExporter(object):
"Base class for all exporters"
short_name = 'base'
file_extension = 'txt... | murphyke/avocado | avocado/export/_base.py | Python | bsd-2-clause | 7,956 |
#coding: utf-8
"""
this file for define params of program
"""
G_DEBUG = True #调试阶段为True 正式部署至北京服务器为False
# =====================================================================================================================
if G_DEBUG: # 测试版
End = 0
# 主域名
G_DOMAIN = 'http://... | hupeng/Blog | public_define/pub_define.py | Python | gpl-2.0 | 837 |
import json
import logging
import random
import time
from datetime import date, datetime, timedelta
from django.conf import settings
from django.contrib import auth
from django.contrib import messages
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.contenttypes.models import ContentType
fr... | brittanystoroz/kitsune | kitsune/questions/views.py | Python | bsd-3-clause | 69,523 |
import gzip
import shutil
import pathlib
import subprocess
from urllib.request import urlretrieve
from clldutils.db import DB
from clldutils.path import md5
import attr
@attr.s
class Release:
tag = attr.ib()
version = attr.ib()
cdstar_oid = attr.ib()
sql_dump_md5 = attr.ib()
sql_dump_url = attr.i... | clld/glottolog3 | glottolog3/releases.py | Python | mit | 1,597 |
import operator
# A slightly efficient superset of primes.
def PrimesPlus():
yield 2
yield 3
i = 5
while True:
yield i
if i % 6 == 1:
i += 2
i += 2
# Returns a dict d with n = product p ^ d[p]
def GetPrimeDecomp(n):
d = {}
primes = PrimesPlus()
for p in primes:
while n % p == 0:
... | mre/the-coding-interview | problems/euler/12/triangle_alt.py | Python | mit | 1,258 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | iwm911/plaso | plaso/parsers/olecf_plugins/summary.py | Python | apache-2.0 | 14,885 |
__author__ = 'guillaumediallo-mulliez'
| Guitoof/qnao | python/__init__.py | Python | gpl-3.0 | 39 |
from datetime import timedelta
import socket
import t
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
import logging
import tempfile
import shutil
import os
from gunicorn.config import Config
from gunicorn.instrument.statsd import Statsd
class TestException(Exception):
... | ccl0326/gunicorn | tests/test_010-statsd.py | Python | mit | 4,144 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('head', '0009_auto_20150417_1709'),
]
operations = [
migrations.AddField(
model_name='org',
name='col... | ayys/bloodData | head/migrations/0010_org_color.py | Python | gpl-3.0 | 448 |
import shlex
import collections
import os
from string import find
from string import split
"""
TODO: Syntax extensions
1. Enumerated parameters split by ',' sign placed inside square brackets.
2. Regions doesn't generate all values when created, but operates with min/max ranges.
3. Single value parameters interprets l... | nucleron/IDE | yaplcconfig/yaplcparser.py | Python | gpl-3.0 | 20,172 |
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2020)
#
# This file is part of ciecplib.
#
# ciecplib 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 ... | duncanmmacleod/ligo.org | ciecplib/sessions.py | Python | gpl-3.0 | 1,712 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import urllib
def get_addon():
pass
def get_translation(key):
translation = {'30000': 'Recherche',
'30001': 'Recherche :',
'30100': 'Télécharger',
'30110': 'Information',
... | sputnick-dev/weboob | contrib/plugin.video.videoobmc/resources/lib/test/common_test.py | Python | agpl-3.0 | 2,860 |
from shared_memory import SharedMemory
def print_session(key_id):
#memory = SharedMemory
print(SharedMemory.get(key_id)) | xmnlab/minilab | memcache/printing.py | Python | gpl-3.0 | 130 |
#*****************************************************************************
#
# Linux and OSX version of Audiovideocours
# Using Python 2.7 coming with OS X Lion
#
# (c) Universite de Strasbourg 2006-2014
# Conception and development : schnellf [AT] unistra.fr
#---
# This program is free softwa... | unistra/avc-client | avcOsxLinux.py | Python | gpl-2.0 | 107,248 |
# -*- coding: utf-8 -*-
"""
Fixtures factories.
"""
from __future__ import unicode_literals
import factory
from modoboa.core.factories import PermissionFactory, UserFactory
from . import models
class DomainFactory(PermissionFactory):
"""Factory to create Domains."""
class Meta:
model = models.Do... | tonioo/modoboa | modoboa/admin/factories.py | Python | isc | 3,016 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'ExternalAccount.type'
db.alter_column('users_externalaccount', 'type', self.gf('django.db... | justinpotts/mozillians | mozillians/users/migrations/0042_auto__chg_field_externalaccount_type.py | Python | bsd-3-clause | 12,259 |
from base import *
from urusan import Urusan
class Unit(Base, base):
__tablename__ ='units'
__table_args__ = {'extend_existing':True,
'schema' :'apbd','autoload':True}
@classmethod
def get_by_kode(cls,kode):
return DBSession.query(cls).filter_by(kode=kode).first()
... | aagusti/sp2d | docs/ref/unit.py | Python | mit | 1,276 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_regressors
---------------
Tests for the `regressors` module.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import pandas as pd
import u... | nsh87/regressors | tests/test_regressors.py | Python | isc | 9,685 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 Lice... | Pakoach/Sick-Beard | sickbeard/search.py | Python | gpl-3.0 | 28,256 |
from django.utils.html import escape
from wagtail.images.formats import register_image_format, \
unregister_image_format, Format
from wagtail.images.models import SourceImageIOError
class FullWidthImgFormat(Format):
def image_to_editor_html(self, image, alt_text, extra_attributes=None):
if extra_attr... | PARINetwork/pari | article/image_formats.py | Python | bsd-3-clause | 2,575 |
# -*- coding: utf-8 -*-
################################################
###### Copyright (c) 2016, Alexandre Popoff
###
import numpy as np
from .categoryaction import CatObject,CatMorphism,MonoidAction
class Noll_Monoid(MonoidAction):
"""Defines the Noll monoid acting on the set of the twelve pitch cl... | AlexPof/opycleid | opycleid/musicmonoids.py | Python | bsd-3-clause | 19,122 |
'''OpenGL extension MESA.ycbcr_texture
This module customises the behaviour of the
OpenGL.raw.GL.MESA.ycbcr_texture to provide a more
Python-friendly API
Overview (from the spec)
This extension supports texture images stored in the YCbCr format.
There is no support for converting YCbCr images to RGB or vice ver... | D4wN/brickv | src/build_data/windows/OpenGL/GL/MESA/ycbcr_texture.py | Python | gpl-2.0 | 1,306 |
# !/usr/bin/env python
import rospy
from flexbe_core import EventState, Logger
'''
Created on 21.09.2017
@author: Philippe La Madeleine
'''
class SetRosParam(EventState):
'''
Store a value in the ros parameter server for later use.
-- ParamName string The desired value.
># Value ob... | WalkingMachine/sara_behaviors | sara_flexbe_states/src/sara_flexbe_states/SetRosParam.py | Python | bsd-3-clause | 917 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
numbers = client.available_p... | teoreteetik/api-snippets | rest/available-phone-numbers/local-basic-example-3/local-get-basic-example-3.6.x.py | Python | mit | 528 |
from simple_model import *
| grollins/foldkin | foldkin/simple/__init__.py | Python | bsd-2-clause | 27 |
#!/usr/bin/env python
#
# Copyright 2014 Institute for Theoretical Information Technology,
# RWTH Aachen University
# www.ti.rwth-aachen.de
#
# This 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 S... | rwth-ti/gr-ofdm | python/ofdm/ofdm_receiver.py | Python | gpl-3.0 | 10,092 |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unitte... | cliffano/swaggy-jenkins | clients/python-legacy/generated/test/test_string_parameter_value.py | Python | mit | 1,534 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-02 00:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('images', '0001_initial'),
]
operations = [
mig... | antonow/concept-to-clinic | interface/backend/images/migrations/0002_imageseries_patient_id.py | Python | mit | 546 |
import unittest
from troposphere import GetAtt, Template, Join
from troposphere.awslambda import Code, Function
class TestAWSLambda(unittest.TestCase):
def test_exclusive(self):
lambda_func = Function(
"AMIIDLookup",
Handler="index.handler",
Role=GetAtt("LambdaExecution... | WeAreCloudar/troposphere | tests/test_awslambda.py | Python | bsd-2-clause | 1,508 |
## Something goes here
# Define submodules
__all__ = ['lib']
import bittrader
import bittrader.lib
from bittrader.api import API
from bittrader.bot import bot
from bittrader.lib import *
| potterzot/bit-trader | bittrader/__init__.py | Python | mit | 189 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.