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 |
|---|---|---|---|---|---|
'''
Created on 19 Feb 2013
@author: samgeen
'''
import Simulation
import Settings
from Hamu.Utils.Directory import Directory
class Simulations(object):
'''
A class that manages simulations with cached data
'''
def __init__(self):
'''
Constructor
'''
# Set up director... | samgeen/Hamu | SimData/Simulations.py | Python | mit | 1,448 |
from flask.ext.wtf import Form
from wtforms import RadioField
from wtforms import StringField
from wtforms import SubmitField
from wtforms.validators import DataRequired
class QuestionForm(Form):
answer = RadioField('Answer', choices=[('yes', 'Yes'), ('no', 'No')],
validators=[DataRequired... | StephenHesperus/favorite-programming-language | app/main/forms.py | Python | mit | 981 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-07-02 06:15
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
def migrate_win_to_ssh_protocol(apps, schema_editor):
asset_model = apps.get_model("assets", "Asset")
db_alias = schema_editor.... | jumpserver/jumpserver | apps/assets/migrations/0017_auto_20180702_1415.py | Python | gpl-3.0 | 2,702 |
"""
Closures channels module for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import logging
_LOGGER = logging.getLogger(__name__)
| jnewland/home-assistant | homeassistant/components/zha/core/channels/closures.py | Python | apache-2.0 | 234 |
# -*- 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):
# Adding field 'MapTimeFrame.nodes_added'
db.add_column(u'map_maptimefram... | michaelbrooks/twitter-feels | twitter_feels/apps/map/migrations/0002_auto__add_field_maptimeframe_nodes_added__add_field_maptimeframe_chunk.py | Python | mit | 6,971 |
import click
from utils.api_config import update_config
from utils.jenkins import setCredential, startJob
from extensions.multiaccount.core import deploy_core_service
featureName = "MultiAccount"
@click.command()
@click.option(
"--regions",
"-r",
help=('Specify AWS regions you wish to apply on the new ... | tmobile/jazz-installer | features/extensions/multiaccount/install.py | Python | apache-2.0 | 2,976 |
# 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 = "AC850685e1d9b8c09dae0b938923dc0d42"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
fax = client.fax.v1.faxes.cr... | teoreteetik/api-snippets | fax/sip-send/example-3/example-3.6.x.py | Python | mit | 503 |
import os
import sys
import imp
from idlelib.TreeWidget import TreeItem
from idlelib.ClassBrowser import ClassBrowser, ModuleBrowserTreeItem
from idlelib.PyShell import PyShellFileList
class PathBrowser(ClassBrowser):
def __init__(self, flist, _htest=False):
"""
_htest - bool, chang... | j5shi/Thruster | pylibs/idlelib/PathBrowser.py | Python | gpl-2.0 | 3,069 |
#imports
import sys
sys.path.insert(0, "../")
sys.path.insert(0, "./")
import globalsettings
# functions which are called by function handlers are placed in the MenuFunc_Base class
class MenuFunc_Base:
def myFunction1():
if (globalsettings.DEBUGFLAG >= 1):
print("This is myFunction1")
def myFunction2():
if ... | jpuk/rpi-128x64-oled-menusystem | myFunctions.py | Python | lgpl-2.1 | 581 |
#!/usr/bin/env python
"""
outputs the frozen packages
"""
import sys
import os
import argparse
import subprocess
parser = argparse.ArgumentParser(description=__doc__.strip())
parser.add_argument('--venv', default='requirements/temporary_venv')
parser.add_argument(
"--template", default="requirements/template.txt",)... | jdemon519/cfme_tests | requirements/freeze.py | Python | gpl-2.0 | 901 |
import lb_loader
import pandas as pd
import simtk.openmm.app as app
import numpy as np
import simtk.openmm as mm
from simtk import unit as u
from openmmtools import hmc_integrators, testsystems
sysname = "ljbox"
collision_rate = 1.0 / u.picoseconds
system, positions, groups, temperature, timestep = lb_loader.load(sys... | kyleabeauchamp/HMCNotes | code/correctness/old/test_anderson_velocity_verlet.py | Python | gpl-2.0 | 1,367 |
from .pytest import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'filmfest',
'USER': 'postgres',
}
}
| kinaklub/next.filmfest.by | filmfest/settings/pytest_pg.py | Python | unlicense | 187 |
#!/usr/bin/env python
"""
Computations create a new value for each :class:`.Row` in a :class:`.Table`.
When used with :meth:`.Table.compute` these new values become a new column.
For instance, the :class:`.PercentChange` computation takes two column names as
arguments and computes the percentage change between them fo... | onyxfish/agate | agate/computations/__init__.py | Python | mit | 1,133 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timers.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| lnhubbell/Timers | backend/manage.py | Python | mit | 249 |
import clr, sys
from mathUtils import MathUtils
#引用示例
clr.AddReference('ZyGames.Framework');
clr.AddReference('ZyGames.Framework.Common');
clr.AddReference('ZyGames.Framework.Game');
clr.AddReference('ZyGames.Tianjiexing.BLL');
clr.AddReference('ZyGames.Tianjiexing.Model');
clr.AddReference('ZyGames.Tianji... | wenhulove333/ScutServer | Sample/Koudai/Server/src/ZyGames.Tianjiexing.Server/Script/PyScript/Action/action1312.py | Python | mit | 6,031 |
'''
@author: Frank
'''
import unittest
from zstacklib.utils import linux
class Test(unittest.TestCase):
def testName(self):
linux.create_vlan_eth('eth0', 11, '10.1.1.1', '255.255.255.0')
linux.create_vlan_eth('eth0', 100, '10.3.3.3', '255.255.255.0')
if __name__ == "__main__":
#import sys... | live4thee/zstack-utility | zstacklib/zstacklib/test/test_create_vlan_eth.py | Python | apache-2.0 | 373 |
import gettext
import os
gettext.install('nova')
from nova import utils
def setup(app):
rootdir = os.path.abspath(app.srcdir + '/..')
print "**Autodocumenting from %s" % rootdir
os.chdir(rootdir)
rv = utils.execute('./generate_autodoc_index.sh')
print rv[0]
| nii-cloud/dodai-compute | doc/ext/nova_autodoc.py | Python | apache-2.0 | 281 |
"""Mayavi/traits GUI for setting MRI fiducials"""
# Authors: Christian Brodbeck <christianbrodbeck@nyu.edu>
#
# License: BSD (3-clause)
from glob import glob
import os
from ..externals.six.moves import map
# allow import without traits
try:
from mayavi.core.ui.mayavi_scene import MayaviScene
from mayavi.tool... | effigies/mne-python | mne/gui/_fiducials_gui.py | Python | bsd-3-clause | 16,311 |
from .measurement import Measurement
from .timer import Timer
from .version import __version__
timer = Timer()
| logicabrity/aeon | aeon/__init__.py | Python | mit | 112 |
# -*- coding: utf-8 -*-
"""
oauthlib.oauth1.rfc5849
~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for signing and checking OAuth 1.0 RFC 5849 requests.
"""
from __future__ import absolute_import, unicode_literals
from . import SIGNATURE_METHODS, utils
class RequestValidator(object):
""... | google/contentbox | third_party/oauthlib/oauth1/rfc5849/request_validator.py | Python | apache-2.0 | 28,693 |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from . import bigquery
from . import sql
| okfn/datapackage-storage-py | examples/storages/__init__.py | Python | mit | 216 |
import torch
from torch.optim.optimizer import Optimizer, required
_available = False
try:
from pcl_embedding_bag import bf16_update
_available = True
except ImportError as e:
#print(e)
pass
def is_available():
return _available
class SplitSGD(Optimizer):
r"""Implements low precision stochast... | hfp/libxsmm | samples/deeplearning/sparse_training/dlrm/split_sgd.py | Python | bsd-3-clause | 3,392 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | konstruktoid/ansible-upstream | lib/ansible/modules/network/junos/junos_linkagg.py | Python | gpl-3.0 | 10,827 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... | KhronosGroup/COLLADA-CTS | StandardDataSets/collada/asset/contributor/one_contributor/one_contributor.py | Python | mit | 4,073 |
from numpy.random import randn
import numpy as np
import matplotlib.pyplot as plt
# ----------------------------------------------------------------------
# Numpy ndarray: multidimensional array object
data = randn(2, 3)
print(data)
print(data * 10)
print(data + data)
print(data.shape)
print(data.dtype)
# Creating n... | jenfly/python-practice | pydata-book/numpy_basics.py | Python | mit | 8,461 |
#
# tests/test_service_manager.py - unit test for the service manager.
#
# Copyright (c) 2018 SingularityNET
#
# Distributed under the MIT software license, see LICENSE file.
#
import logging
import pytest
from examples import multi_agent_adapter
from sn_agent import ontology
from sn_agent.log import setup_logging
f... | singnet/singnet | agent/tests/test_service_manager.py | Python | mit | 3,864 |
# coding: utf-8
from django.db.models import Q
from django.views import generic
# from django.views.generic.dates import (YearArchiveView, MonthArchiveView,
# DayArchiveView)
from esperancanordeste.context_processors import EnterpriseExtraContext
from esperancanordeste.catalog.... | klebercode/esperancanordeste | esperancanordeste/catalog/views.py | Python | mit | 2,030 |
# stdlib
from contextlib import contextmanager
from random import random, randrange
import os
import subprocess
import sys
import time
import unittest
import urllib as url
# 3p
from mock import patch
from nose.plugins.attrib import attr
# project
# needed because of the subprocess calls
sys.path.append(os.getcwd())
f... | takus/dd-agent | tests/core/test_watchdog.py | Python | bsd-3-clause | 5,895 |
# Copyright 2015 HuaWei Technologies.
#
# 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 ... | noironetworks/neutron | neutron/extensions/timestamp.py | Python | apache-2.0 | 1,852 |
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from ...sipmessaging import SIPHeaderField
from ...sipmessaging import classproperty
class PPreferredIdentitySIPHeaderField(SIPHeaderField):
# noinspection PyNestedDecorators
@classproperty
@classmethod
def c... | bobjects/BobStack | bobstack/sipmessaging/concreteheaderfields/pPreferredIdentitySIPHeaderField.py | Python | apache-2.0 | 685 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Method collection to obtain optical system information
This module contains a method collection to obtain information, and analyze
optical systems
'''
__all__=["intersection", "nearest_points", "chief_ray_search", "pupil_location",
"paraxial_location", "find... | ramezquitao/pyoptools | pyoptools/raytrace/calc/calc.py | Python | gpl-3.0 | 25,857 |
# Copyright (c) 2016 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 impl... | candlepin/subscription-manager | src/rhsmlib/facts/collection.py | Python | gpl-2.0 | 2,910 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0013_urlconfrevision'),
]
operations = [
migrations.CreateModel(
name='News',
fields=[
... | febsn/djangocms-copilot | copilot/migrations/0001_initial.py | Python | mit | 605 |
# 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... | MayankGo/ec2-api | ec2api/tests/functional/ssh.py | Python | apache-2.0 | 6,284 |
#!/usr/bin/env python3
# Copyright © 2012-13 Qtrac Ltd. All rights reserved.
# This program or module 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)... | nwiizo/workspace_2017 | pipng/whatsnew-c.py | Python | mit | 3,481 |
# Copyright (c) 2010 Christopher Rebert <code@rebertia.com>
#
# 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, mod... | cvrebert/TritonScraper | src/triton_scraper/bookstore.py | Python | mit | 6,532 |
# Copyright (c) 2010, Trevor Bekolay
# 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 ... | tbekolay/behaviour-tool | BehaviourTool.py | Python | bsd-3-clause | 1,649 |
# -----------------------------------------------------------------------------
# @author:
# Tingwu Wang
# @brief:
# The environment wrapper
# -----------------------------------------------------------------------------
import init_path
from config.config import get_config
import os
# os.environ['DISAB... | WilsonWangTHU/neural_graph_evolution | env/test_fish.py | Python | mit | 1,964 |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
import django.views
from OMRS import views
from OMRS import omrsfunctions
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', '... | omiltoro/testkenyacap | openMRScap/urls.py | Python | apache-2.0 | 2,620 |
#
# 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 us... | wtanaka/beam | sdks/python/apache_beam/options/pipeline_options_validator_test.py | Python | apache-2.0 | 11,275 |
from .base_infant_scheduled_modeladmin import BaseInfantScheduleModelAdmin
from .infant_birth_admin import InfantBirthAdmin
from .infant_birth_data_admin import InfantBirthDataAdmin
from .infant_birth_arv_admin import InfantBirthArvAdmin
from .infant_death_report_admin import InfantDeathReportAdmin
from .infant_off_stu... | TshepangRas/tshilo-dikotla | td_infant/admin/__init__.py | Python | gpl-2.0 | 1,727 |
# Copyright 2015 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... | dhalleine/tensorflow | tensorflow/python/training/saver.py | Python | apache-2.0 | 56,216 |
#============================
# Python Interface
#============================
from __future__ import absolute_import, division, print_function
from os.path import join, realpath, dirname
import utool as ut
import cv2
import random
import numpy as np
import ctypes as C
import detecttools.ctypes_interface as ctypes_inte... | bluemellophone/pybing | pybing/pybing_helpers.py | Python | bsd-3-clause | 5,425 |
from django.core.management.base import BaseCommand
from optparse import make_option
# Python 2.3 doesn't have sorted()
try:
sorted
except NameError:
from django.utils.itercompat import sorted
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--option_a','-a', actio... | weigj/django-multidb | tests/regressiontests/admin_scripts/management/commands/base_command.py | Python | bsd-3-clause | 774 |
from classes.Feature import *
from classes.Extension import *
import bisect
def translateType(t, name):
if name in [ "GL_TRUE", "GL_FALSE" ]:
return "GLboolean"
return { "u" : "GLuint", "ull" : "GLuint64" }.get(t, "GLenum")
# https://docs.python.org/2/library/bisect.html
def find_le(a, x):
'... | j-o/glbinding | source/codegeneration/scripts/classes/Enum.py | Python | mit | 10,589 |
# -*- coding: utf-8 -*-
import os
import logging
import sys
from django.utils import timezone
from website import settings
def format_now():
return timezone.now().isoformat()
def add_file_logger(logger, script_name, suffix=None):
_, name = os.path.split(script_name)
name = name.rstrip('c')
if suf... | TomBaxter/osf.io | scripts/utils.py | Python | apache-2.0 | 1,576 |
import math
def add(a, b):
return (a + b)
add(3, 4)
def sub(a, b):
return (a - b)
sub(5, 3)
def mul(a, b):
return (a * b)
mul(4, 4)
def div(a, b):
return (a / b)
div(2, 3)
def hours_from_second(a):
return (a/3600)
hours_from_second(86400)
def circle_area(a):
return (math.pi*(a**2))
circle_area(5)
de... | Naja2445-cmis/naja2445-cmis-cs2 | functions.py | Python | cc0-1.0 | 1,478 |
# -*- coding: utf-8 -*-
import unittest
import sys
sys.path.append(u'../ftplugin')
from datetime import date
from datetime import datetime
from orgmode.plugins.Date import Date
class DateTestCase(unittest.TestCase):
u"""Tests all the functionality of the Date plugin.
Also see:
http://orgmode.org/manual/The-dat... | j-a-m-l/.dot | vim/bundle/vim-orgmode/tests/test_plugin_date.py | Python | mit | 5,504 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2013 Roberto Alsina and others.
# 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 t... | kotnik/nikola | nikola/plugins/command_version.py | Python | mit | 1,573 |
import test_config
import pyautogui
#saves a savestate
def save(components):
response = 'There was a problem saving @' + components['sender'] + ". Either you aren't allowed to do that or you gave invalid arguments."
slot = int(''.join(i for i in components['arguments'] if i.isdigit()))
if slot not in test_config.v... | Metruption/IRC-Bot | src/cmds/save.py | Python | gpl-3.0 | 676 |
# Copyright 2013 - Rackspace
#
# 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,... | openstack/solum | solum/api/controllers/v1/datamodel/component.py | Python | apache-2.0 | 3,377 |
import codecs
import json
import os
import random
import re
from cloudbot import hook
@hook.on_start()
def shuffle_deck(bot):
global gnomecards
with codecs.open(os.path.join(bot.data_dir, "gnomecards.json"), encoding="utf-8") as f:
gnomecards = json.load(f)
@hook.command('cah')
def CAHwhitecard(tex... | weylin/CloudBot | plugins/gnomeagainsthumanity.py | Python | gpl-3.0 | 808 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import libs.boxes.cython_bbox as cython_bbox
import libs.configs.config_v1 as cfg
from libs.boxes.bbox_transform import bbox_transform, bbox_transform_inv, clip_boxes
from libs.logs.log impo... | CharlesShang/FastMaskRCNN | libs/layers/roi.py | Python | apache-2.0 | 6,976 |
from vk_app.utils.utils import *
| lycantropos/VKApp | vk_app/utils/__init__.py | Python | gpl-3.0 | 33 |
# coding: utf-8
# IPython (or Jupyter) notebooks are good for illustrative purposes. It allows to document the process and save the results which are easy to publish.
#
# ### Hello World Example
# In[1]:
print "Hello World!"
| shameeriqbal/pandas-tutorial | notebooks/1.hello_world.py | Python | mit | 231 |
default_app_config = 'gro_api.resources.apps.ResourcesConfig'
| OpenAgInitiative/gro-api | gro_api/resources/__init__.py | Python | gpl-2.0 | 62 |
# Copyright 2015 - Yahoo! 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 agree... | jay-lau/magnum | magnum/servicegroup/magnum_service_periodic.py | Python | apache-2.0 | 2,139 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetDirectMessages
# Retrieves the 20 most recent direct messages sent to the authenticating user.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version ... | jordanemedlock/psychtruths | temboo/core/Library/Twitter/DirectMessages/GetDirectMessages.py | Python | apache-2.0 | 6,443 |
from typing import List
from .genomic_interval import GenomicInterval
from lhc.binf.sequence.reverse_complement import reverse_complement
class NestedGenomicInterval(GenomicInterval):
def __init__(self, start, stop, *, chromosome=None, strand='+', data=None):
super().__init__(start, stop, chromosome=chro... | childsish/lhc-python | lhc/binf/genomic_coordinate/nested_genomic_interval.py | Python | gpl-2.0 | 3,398 |
# -*- coding: utf-8 -*-
""" GUI definition.
Copyright (c) Karol Będkowski, 2013
This file is part of wxGTD
Licence: GPLv2+
"""
| KarolBedkowski/wxgtd | wxgtd/gui/__init__.py | Python | gpl-2.0 | 130 |
# 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 agreed to in... | openstack/rally | rally/common/yamlutils.py | Python | apache-2.0 | 888 |
import pandas as pd
import re
import nltk
from bs4 import BeautifulSoup
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.ensemble import RandomForestClassifier
def review_to_words(raw_review):
# 1. Remove HTML
review_text = BeautifulSoup(raw_review, "html").g... | hkhpub/kagglepy | popcorn/src/bagofwords.py | Python | mit | 3,858 |
"""Support for Homekit motion sensors."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OCCUPANCY,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_SMOKE,
Bi... | sdague/home-assistant | homeassistant/components/homekit_controller/binary_sensor.py | Python | apache-2.0 | 4,775 |
from collections import namedtuple
from ...constants import MODEL_SCHEMA, MODEL_NAMESPACE
ProjectInfo = namedtuple("ProjectInfo", ["id"])
SolutionInfo = namedtuple("SolutionInfo", ["id", "projects"])
class SolutionInfoLoader:
def __init__(self, xmlroot):
self.__xmlroot = xmlroot
if not ... | umlfri/umlfri2 | umlfri2/datalayer/loaders/solution/solutioninfoloader.py | Python | gpl-3.0 | 734 |
import string,nltk
from nltk.corpus import stopwords
from nltk.stem.porter import *
def tokenizeAndStemStrings(text):
# turn text to tokens
tokens = nltk.word_tokenize(text)
# remove stop words
tokens_no_sw = [word for word in tokens if not word in stopwords.words('english')]
# stem ... | ryanmdavis/BioTechTopics | BTT_functions.py | Python | mit | 997 |
from setuptools import find_packages, setup
DESCRIPTION = 'App Engine backends for Django-nonrel'
LONG_DESCRIPTION = None
try:
LONG_DESCRIPTION = open('README.rst').read()
except:
pass
setup(name='djangoappengine',
version='1.4.0',
packages=find_packages(exclude=['docs']),
install_requires... | jerod2000/djangoappengine | setup.py | Python | bsd-3-clause | 1,119 |
import pytest
from cryptotik import Hitbtc
from decimal import Decimal
from cryptotik.exceptions import APIError
private = pytest.mark.skipif(
not pytest.config.getoption("--apikey"),
reason="needs --apikey option to run."
)
hit = Hitbtc(pytest.config.getoption("--apikey"),
pytest.config.getoptio... | peerchemist/cryptotik | test/hitbtc_test.py | Python | bsd-3-clause | 2,363 |
from conch.analysis.formants import FormantTrackFunction
import librosa
from conch.analysis.segments import FileSegment, SignalSegment
def test_formants_praat(base_filenames):
for f in base_filenames:
wavpath = f + '.wav'
func = FormantTrackFunction(time_step=0.01,
... | mmcauliffe/python-acoustic-similarity | tests/test_analysis_formants.py | Python | mit | 580 |
"""Utilities for with-statement contexts. See PEP 343."""
import abc
import sys
import _collections_abc
from collections import deque
from functools import wraps
__all__ = ["asynccontextmanager", "contextmanager", "closing", "nullcontext",
"AbstractContextManager", "AbstractAsyncContextManager",
... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/contextlib.py | Python | gpl-2.0 | 23,774 |
from Const import *
from DownloadFile import DownloadFile
from threading import Lock
class DownloadFileList:
def __init__(self):
self.downloadFileList = []
self.completedFileList = []
self.downloadFileListLock = None
self.completedFileListLock = None
def setLock(self):
self.downloadFileListLock = Loc... | phamngochai/lrg | DownloadFileList.py | Python | gpl-3.0 | 4,928 |
import operator
from django.db.backends.base.features import BaseDatabaseFeatures
from django.utils.functional import cached_property
class DatabaseFeatures(BaseDatabaseFeatures):
empty_fetchmany_value = ()
allows_group_by_pk = True
related_fields_match_type = True
# MySQL doesn't support sliced subq... | theo-l/django | django/db/backends/mysql/features.py | Python | bsd-3-clause | 6,495 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_network_interface.py | Python | mit | 1,217 |
##import ConfigParser
##NOTE: Files must have an empty line at the end
endline = '\t}\n\n'
#Armor Types: - "CombatClassDefend"
#------------
armortypes = {}
armortypes['Flesh'] = 'DOTA_COMBAT_CLASS_DEFEND_SOFT'
armortypes['small'] = 'DOTA_COMBAT_CLASS_DEFEND_WEAK'
armortypes['medium'] = 'DOTA_COMBAT_CLASS_DEFEND_BAS... | nob8/SDMD-Renewed | content/dota_addons/sdmd/panorama/images/spellicons/KVUP-master/KVUP.py | Python | apache-2.0 | 19,425 |
from django.dispatch import Signal
resource_limit_update_succeeded = Signal(providing_args=['order_item'])
resource_limit_update_failed = Signal(providing_args=['order_item', 'error_message'])
resource_plan_switch_succeeded = Signal(providing_args=['instance'])
resource_creation_succeeded = Signal(providing_args=['ins... | opennode/nodeconductor-assembly-waldur | src/waldur_mastermind/marketplace/signals.py | Python | mit | 395 |
#encoding:utf-8
subreddit = 'Awwducational'
t_channel = '@Awwducational'
def send_post(submission, r2t):
return r2t.send_simple(submission,
gif='{title}\n\n{self_text}',
img='{title}\n\n{self_text}',
album=False,
text=False,
other=False
)
| Fillll/reddit2telegram | reddit2telegram/channels/awwducational/app.py | Python | mit | 287 |
# Copyright (c) 2012 NTT DOCOMO, INC.
# Copyright (c) 2011 University of Southern California / ISI
# 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
#
# ... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/virt/baremetal/fake.py | Python | gpl-2.0 | 2,285 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
from . import ircnotice
class InvalidCTCPNotice(Exception): pass
class CTCPNotice(ircnotice.IRCNotice):
def __init__(self, message):
super().__init__(message)
self.ctcpify()
def ctcpify(self):
"""Special initialisation f... | IjonTichy/TichyBot | src/objects/ctcpnotice.py | Python | bsd-3-clause | 868 |
from ethereum.tools import tester
from ethereum.tools.tester import TransactionFailed
from pytest import fixture, raises, mark
from utils import longToHexString, EtherDelta, TokenDelta, PrintGasUsed
from reporting_utils import generateFees, proceedToNextRound, proceedToFork, finalizeFork, getExpectedFees
def test_rede... | AugurProject/augur-core | tests/reporting/test_universe_redeem.py | Python | gpl-3.0 | 6,263 |
from __future__ import division
import datetime
import os
import time
import threading
from pulsar.client.util import filter_destination_params
from pulsar.managers import ManagerProxy
from pulsar.managers import status
from pulsar.managers.util.retry import RetryActionExecutor
from .staging import preprocess
from .s... | ssorgatem/pulsar | pulsar/managers/stateful.py | Python | apache-2.0 | 12,343 |
# -*- coding: utf-8 -*-
"""
Test levels
"""
import datetime
from django import test
from factories import ProgramFactory, LevelFactory, LevelTierFactory
class TestLevelProperties(test.TestCase):
"""
Test the get_level_depth method on the Level model to assure that the depth calculation is correct.
"""
... | mercycorps/TolaActivity | indicators/tests/test_levels.py | Python | apache-2.0 | 3,265 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from google.appengine.ext import ndb
from dashboard.common import testing_common
from dashboard.common import utils
from dashboard.models i... | sahiljain/catapult | dashboard/dashboard/models/alert_test.py | Python | bsd-3-clause | 3,846 |
#!/usr/bin/python
#coding=utf-8
"""****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), t... | Gamesjiazhi/rwproject | undeadClient2D/frameworks/cocos2d-x/tools/cocos2d-console/plugins/project_new/ui.py | Python | apache-2.0 | 10,269 |
import random
from datetime import datetime
from multiprocessing import Pool
import numpy as np
from scipy.optimize import minimize
def worker_func(args):
self = args[0]
m = args[1]
k = args[2]
r = args[3]
return (self.eval_func(m, k, r) -
self.eval_func(m, k, self.rt) -
... | ndt93/tetris | scripts/agent3.py | Python | mit | 5,234 |
from twisted.internet import reactor
from stratum.event_handler import GenericEventHandler
from jobs import Job
import utils
import version as _version
import stratum_listener
import stratum.logger
log = stratum.logger.get_logger('proxy')
class ClientMiningService(GenericEventHandler):
job_registry = None # Ref... | oxagast/hashnet | stratum-mining-proxy/mining_libs/client_service.py | Python | gpl-2.0 | 4,418 |
#!/usr/bin/env python
"""Earth Engine OAuth2 helper functions for generating client tokens.
Typical use-case consists of:
1. Calling 'get_authorization_url'
2. Using a browser to access the output URL and copy the generated OAuth2 code
3. Calling 'request_token' to request a token using that code and the OAuth API
4. ... | Servir-Mekong/ecodash | lib/ee/oauth.py | Python | gpl-3.0 | 2,314 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='CardGenerator',
fields=[
('id', models.AutoFiel... | jillson/chrononaut | combat/migrations/0001_initial.py | Python | gpl-3.0 | 647 |
from quark_runtime import *
def factorial(n):
if ((n) == (0)):
return 1
else:
return (n) * (factorial((n) - (1)))
def call_main(): import sys; main(_List(sys.argv[1:]))
def main(args):
_println(factorial(1));
_println(factorial(2));
_println(factorial(3));
_println(factorial... | bozzzzo/quark | quarkc/test/emit/expected/py/factorial/factorial/__init__.py | Python | apache-2.0 | 495 |
""" Project Euler, problem 11
Largest product in a grid
https://projecteuler.net/problem=11
"""
# Store all the inputs in a 20 by 20 matrix
mat = []
# Prompt for input
file = open('Problem11Input.txt', 'r').readlines()
# We get a 20 by 20 grid as input, so use split to store input into the array
for i in range(0, l... | ruar18/competitive-programming | project-euler/p11.py | Python | mit | 1,896 |
# -*- coding: utf-8 -*-
#
# This file is part of pypuppetdbquery.
# Copyright © 2016 Chris Boot <bootc@bootc.net>
#
# 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.or... | bootc/pypuppetdbquery | examples/fact_contents.py | Python | apache-2.0 | 1,056 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and comp... | superpolock/googleclass | basic/wordcount.py | Python | apache-2.0 | 2,619 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including... | parapente/beets | test/testall.py | Python | mit | 1,521 |
#! /usr/bin/env python
"""
This script can be used to produce a standalone executable from
arbitrary Python code. You supply the name of the starting Python
file to import, and this script attempts to generate an executable
that will produce the same results as "python startfile.py".
This script is actually a wrapp... | Wilee999/panda3d | direct/src/showutil/pfreeze.py | Python | bsd-3-clause | 4,090 |
pyg = 'ay'
| vpstudios/Codecademy-Exercise-Answers | Language Skills/Python/Unit 3/2-PygLatin/PygLatin PART2/7-Ay B C.py | Python | mit | 11 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | timlinux/geonode | geonode/maps/admin.py | Python | gpl-3.0 | 2,205 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC 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
#... | tylertian/Openstack | openstack F/horizon/horizon/dashboards/nova/networks/tests.py | Python | apache-2.0 | 32,726 |
#!/usr/env python
class Flyable:
def fly(self):
pass
class Quackable(object):
def quack(self):
pass
class ReadHeadDuckFly(Flyable):
def fly(self):
print "I am a readheadduck, I can fly"
class ReadHeadDuckQack(Quackable):
def quack(self):
print "I am a readheadduck,Dc... | sahikaru/DP | chapter1/strategymode.py | Python | gpl-2.0 | 1,364 |
from os.path import join as pjoin
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 0
_version_minor = 1
_version_micro = '' # use '' for first of series, number for 1 and above
_version_extra = 'dev'
#_version_extra = '' # Uncomment this for full releases
# Construct ful... | dunkenj/smpy | dist/astro-smpy-0.1.dev/smpy/version.py | Python | mit | 2,693 |
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
def execute(filters=None):
data = []
parents = {
"Product Bundle Item": "Product Bundle",
"BOM Explosion Item": "BOM... | mahabuber/erpnext | erpnext/stock/report/bom_search/bom_search.py | Python | agpl-3.0 | 1,083 |
"""
Core snippets models
@author: Faraz Masood Khan faraz@fanaticlab.com
@copyright: Copyright (c) 2013 FanaticLab
"""
import re
import datetime
from django.db import models, connection, transaction
from django.db.models import F
from django.template.defaultfilters import slugify
from codehunkit import memoize
from... | mysteryjeans/codehunkit | codehunkit/app/models/snippets.py | Python | gpl-2.0 | 29,275 |
# -*- coding: utf-8 -*-
import scrapy
import json
import re
from datetime import date
from locations.items import GeojsonPointItem
class GapSpider(scrapy.Spider):
name = "gap"
allowed_domains = ["www.gap.com"]
gap_url = 'http://www.gap.com/products/store-locations.jsp'
store_url = 'http://www.gap.co... | iandees/all-the-places | locations/spiders/gap.py | Python | mit | 4,628 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.