code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
"""
IAudioEndpointVolumeCallback.OnNotify() example.
The OnNotify() callback method gets called on volume change.
"""
from __future__ import print_function
from ctypes import POINTER, cast
from comtypes import CLSCTX_ALL, COMObject
from pycaw.pycaw import (AudioUtilities, IAudioEndpointVolume,
... | AndreMiras/pycaw | examples/volume_callback_example.py | Python | mit | 950 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
class SelectionTracker(object):
""" Tracks a player's active selection as an input into other plugins.
In some situations selection tracking isn't perfect. The plugin will
detect these situa... | BlackVegetable/starcraft-oracle | sc2reader-master/sc2reader/engine/plugins/selection.py | Python | mit | 3,813 |
import re
from vint.linting.config.config_source import ConfigSource
from vint.ast.node_type import NodeType
CONFIG_COMMENT_PATTERN = re.compile(r'^\s*vint:\s*')
POLICY_SWITCH_PATTERN = re.compile(r'[-\+]\S+')
class ConfigCommentSource(ConfigSource):
""" A class for ConfigCommentSourcees.
This class provide ... | RianFuro/vint | vint/linting/config/config_comment_source.py | Python | mit | 1,825 |
import os
import githubloc.util as util
config_file = '.githubloc.ini'
home = os.path.expanduser('~')
config_file_with_path = os.path.join(home, config_file)
util.check_if_not_create(config_file_with_path, 'config/githubloc.ini')
config = util.parse_config(config_file_with_path)
conf = {
'token': os.path.expand... | z/github-loc | githubloc/config.py | Python | mit | 345 |
#!/usr/bin/python
LIMIT = 999
def sumDivisibleBy(step):
p = LIMIT // step
return step * (p * (p + 1)) // 2
print(sumDivisibleBy(3) + sumDivisibleBy(5) - sumDivisibleBy(15))
| cifvts/PyEuler | euler001.py | Python | mit | 185 |
# # # # #
# network.py
#
# This file is used to serve up
# RESTful links that can be
# consumed by a frontend system
#
# University of Illinois/NCSA Open Source License
# Copyright (c) 2015 Information Trust Institute
# All rights reserved.
#
# Developed by:
#
# Information Trust Institute
# University of Illinois
# ht... | GridProtectionAlliance/ARMORE | source/webServer/domains/network.py | Python | mit | 2,712 |
__author__ = 'tauren'
from flask import abort
from flask_restful import Resource
from flask.ext.restful import fields, marshal, reqparse
from flask_login import current_user
from models import User, db
user_fields = {
'username': fields.String,
'id': fields.Integer,
'uri': fields.Url('user')
}... | taurenk/Flask-Angular-TaskList | backend/app/user_api.py | Python | mit | 1,159 |
#!/usr/bin/gdb --eval-command=python
# vim: set filetype=python:
import sys
import gdb
gdb.execute("file " + sys.argv[1])
t = gdb.Type(sys.argv[0])
print("sizeof " + str(sys.argv[0]) + " = " + str(t.sizeof()))
end
| daniel-noland/config | root/home/dnoland/.bin/gdb.py | Python | mit | 214 |
#Copyright(c) 2016, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("Rev... | dimven/SpringNodes | py/FamilyInstance.ByHostAndPoint.py | Python | mit | 1,222 |
"""MSAView - Disopred support.
Copyright (c) 2011 Joel Hedlund.
Contact: Joel Hedlund <yohell@ifm.liu.se>
MSAView is a modular, configurable and extensible package for analysing and
visualising multiple sequence alignments and sequence features.
This package provides support for parsing dispored result files (mus... | yohell/msaview | msaview_plugin_disopred/__init__.py | Python | mit | 4,493 |
from unittest import TestCase
import pickle
from abl.util import (
Bunch,
)
class Derived(Bunch):
pass
class TestBunch(TestCase):
def test_as_dict(self):
bunch = Bunch(a='a', b='b')
assert bunch == dict(a='a', b='b')
def test_as_obj(self):
bunch = Bunch(a='a', b='b')
... | AbletonAG/abl.util | test/test_bunch.py | Python | mit | 1,113 |
"""Working day tools
"""
import warnings
import ephem
import pytz
from calendar import monthrange
from datetime import date, timedelta, datetime
from math import pi
from dateutil import easter
from lunardate import LunarDate
from calverter import Calverter
MON, TUE, WED, THU, FRI, SAT, SUN = range(7)
class Calenda... | shinriyo/workalendar | workalendar/core.py | Python | mit | 17,530 |
import usb.core
class hellousb(object):
def __init__(self):
self.HELLO = 0
self.SET_VALS = 1
self.GET_VALS = 2
self.PRINT_VALS = 3
self.dev = usb.core.find(idVendor = 0x6666, idProduct = 0x0003)
if self.dev is None:
raise ValueError('no USB de... | redfern314/amazedFirmware | bootloader/software/hellousb.py | Python | mit | 1,389 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-18 13:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('climatemodels', '0046_auto_20170117_1034'),
]
operations = [
migrations.Alt... | bruecksen/isimip | isi_mip/climatemodels/migrations/0047_auto_20170118_1428.py | Python | mit | 45,674 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models_py3.py | Python | mit | 48,388 |
#!/usr/bin/env python
"""Runs integration tests."""
import argparse
import os
import platform
import sys
script_dir = os.path.dirname(os.path.realpath(__file__))
helpers_dir = os.path.join(script_dir, 'helpers')
docker_dir = os.path.join(helpers_dir, 'bamboos', 'docker')
sys.path.insert(0, docker_dir)
from environme... | onedata/oneclient | ct_run.py | Python | mit | 2,877 |
class Comp1Plugin(object):
def __init__(self):
self.version = '1.4'
class Comp2Plugin(object):
def __init__(self):
self.version = '1.4'
| DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.test/src/openmdao/test/plugins/foo2/foo.py | Python | mit | 162 |
"""Climatecontrol extension for using pydantic schemas as source."""
from typing import Generic, Mapping, Type, TypeVar
from pydantic import BaseModel
from climatecontrol.core import Climate as BaseClimate
from climatecontrol.core import SettingsItem as BaseSettingsItem
from climatecontrol.fragment import FragmentPa... | daviskirk/climatecontrol | climatecontrol/ext/pydantic.py | Python | mit | 2,447 |
#!/usr/bin/env python
"""
Your task is as follows:
- read the provided Excel file
- find and return the min, max and average values for the COAST region
- find and return the time value for the min and max entries
- the time values should be returned as Python tuples
Please see the test function for the expected retur... | Collumbus/Data_Wrangling_with_MongoDB-Udacity | Lesson_01_Data_Extraction_Fundamentals/readxls.py | Python | mit | 2,998 |
#!/usr/bin/env python3
from AbstractAPIReader import AbstractAPIReader
from Smartvel import Smartvel
from smartvel_auth import TOKEN
class APIReaderSmartvel(AbstractAPIReader):
def __init__(self, token=TOKEN, endpoint='events'):
self._token = token
self._endpoint = endpoint
def get_iterable... | Pysellus/streaming-api-test | api-reader/APIReaderSmartvel.py | Python | mit | 381 |
from urllib.request import urlopen
html = urlopen("http://127.0.0.1:9090/cam.mjpg")
print(html) | SachinKonan/Windows-RPI-Vision-Framework | HttpServer/check.py | Python | mit | 95 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impo... | docusign/docusign-python-client | test/test_oauth.py | Python | mit | 5,587 |
"""
GENERATE DOC: [MAJORS] csv/tsv for R processing
"""
import os, sys
import pymongo
from pymongo import MongoClient
import json
import ipdb
BASE_DIR = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__))) )
counts_dir = os.path.join(BASE_DIR,'dataR/counts')
ne_counts = os.path.join(counts_d... | ronaldahmed/labor-market-demand-analysis | preprocessing/doc_majors_map.py | Python | mit | 1,522 |
import logging
from subprocess import CalledProcessError
import tarfile
"""
Handles deployment of an installed problem.
Deploying a problem means creating one or more instances, which are each
templated with flags, the shell server URL, etc., and assigned a port
(if required for their problem type).
Flags and assign... | picoCTF/picoCTF | picoCTF-shell/hacksport/deploy.py | Python | mit | 40,196 |
import os
import ast
import six
from .ModelComponents import ComponentBase
_comps_name = '__components'
class ExprsToAssigns(ast.NodeTransformer):
"""
Walks the Abstract Syntax Tree from the parsed model file, and transforms
bare expressions into augmented assignments that are tacked on to the end
of... | mmechtley/psfMC | psfMC/model_parser.py | Python | mit | 2,467 |
#!/usr/bin/python
def hits_basement(input_string):
floor = 0
position = 1
for char in input_string:
floor += 1 if char == "(" else -1
if floor == -1:
return position
position += 1
if __name__=="__main__":
input_string = open("input.txt").read()
print hits... | mnestis/advent2015 | 01/part2.py | Python | mit | 344 |
from .check import assert_type
from .predicates import (
eq,
is_predicate,
Predicate,
AndPredicate,
OrPredicate,
NotPredicate,
)
from .relations import (
is_relation,
Main,
Relation,
AndRelation,
OrRelation,
NotRelation
)
from .rule import (
is_rule,
Production,
... | bureaucratic-labs/yargy | yargy/api.py | Python | mit | 1,590 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# Meta-info
Author: Nelson Brochado
Created: 03/09/2015
Updated: 07/03/2018
# Description
# TODO
- Add description.
- Add complexity analysis.
- Add documentation to functions.
"""
__all__ = ["recursive_subset_sum", "bottom_up_subset_sum"]
from pprint import p... | nbro/ands | ands/algorithms/dp/subset_sum.py | Python | mit | 3,075 |
import csv
import json
import numpy as np
import pandas as pd
def read_delim(filepath):
"""
Reads delimited file (auto-detects delimiter + header). Returns list.
:param filepath: (str) location of delimited file
:return: (list) list of records w/o header
"""
f = open(filepath, 'r')
diale... | FordyceLab/AcqPack | acqpack/utils.py | Python | mit | 6,206 |
#!/usr/bin/env python
import fileinput
from pylab import *
for line in fileinput.input():
print line
| arturocastro/portable-performance | previous_work/PURE-C/timings/plot.py | Python | mit | 107 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from .validators import is_item_iterable
def coerce_sequence_of_tuple(sequence):
"""Make sure all items of a sequence are of type tuple.
Parameters
----------
sequence : sequence
A se... | compas-dev/compas | src/compas/data/coercion.py | Python | mit | 1,742 |
'''
×¢ÒâÏß³ÌÖ§³ÖÄ£¿éÊÇ¿ÉÑ¡µÄ, ÓпÉÄÜÔÚһЩ Python ½âÊÍÆ÷Öв»¿ÉÓÃ.
Ö´ÐÐ Python ³ÌÐòµÄʱºò, Êǰ´ÕÕ´ÓÖ÷Ä£¿é¶¥¶ËÏòÏÂÖ´ÐеÄ.
Ñ»·ÓÃÓÚÖØ¸´Ö´Ðв¿·Ö´úÂë, º¯ÊýºÍ·½·¨»á½«¿ØÖÆÁÙÊ±ÒÆ½»µ½³ÌÐòµÄÁíÒ»²¿·Ö.
ͨ¹ýÏß³Ì, ÄãµÄ³ÌÐò¿ÉÒÔÔÚͬʱ´¦Àí¶à¸öÈÎÎñ. ÿ¸öÏ̶߳¼ÓÐËü×Ô¼ºµÄ¿ØÖÆÁ÷.
ËùÒÔÄã¿ÉÒÔÔÚÒ»¸öÏß³ÌÀï´ÓÎļþ¶ÁÈ¡Êý¾Ý, Áí¸öÏòÆÁÄ»Êä³öÄÚÈÝ.
Î... | iamweilee/pylearn | threading-example-1.py | Python | mit | 2,573 |
# test_ptypes.py
# Copyright (c) 2013-2016 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0103,C0111,W0108
# Standard library imports
import sys
import numpy
# Putil imports
import putil.ptypes
from putil.test import AE, AI
###
# Global variables
###
emsg = lambda msg: (
'[START CONTRACT MSG:... | pmacosta/putil | tests/test_ptypes.py | Python | mit | 9,287 |
__author__ = 'yuxiang'
import os
import datasets
import datasets.rgbd_scenes
import datasets.imdb
import numpy as np
import subprocess
import cPickle
class rgbd_scenes(datasets.imdb):
def __init__(self, image_set, rgbd_scenes_path=None):
datasets.imdb.__init__(self, 'rgbd_scenes_' + image_set)
sel... | yuxng/Deep_ISM | ISM/lib/datasets/rgbd_scenes.py | Python | mit | 4,957 |
question_type = 'input_output'
source_language = 'C'
parameter_list = [
['$stdin0','int'],['$stdin1','int'],['$stdout0','int']
]
tuple_list = [
['min_io_forward_', [1,2,None], [4,9,None]],
['min_io_backward_', [None,None,1], [None,None,6]],
]
global_code_template = '''\
d #include <stdio.h>
x #include <stdio.h... | stryder199/RyarkAssignments | Assignment2/ttt/cseet_paper/min_io.py | Python | mit | 614 |
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office365.sharepoint.base_entity_collection import BaseEntityCollection
from office365.sharepoint.webs.web import Web
class WebCollection(BaseEntityCollection):
"""Web collection"""
def __init__(self, context, resource_p... | vgrem/Office365-REST-Python-Client | office365/sharepoint/webs/web_collection.py | Python | mit | 1,240 |
"""
Module containing weather data classes and data structures.
"""
import json
import xml.etree.ElementTree as ET
from pyowm.webapi25.xsd.xmlnsconfig import (
WEATHER_XMLNS_PREFIX, WEATHER_XMLNS_URL)
from pyowm.utils import timeformatutils, temputils, xmlutils
class Weather(object):
"""
A class encapsul... | LukasBoersma/pyowm | pyowm/webapi25/weather.py | Python | mit | 18,912 |
from pydata import Data, h5todata
import numpy as np
import os
import h5py
def test_Data(tmpdir):
o = Data(x=np.ones(3), y=np.ones(3), a=5, b='hh')
assert o.b=='hh'
assert o['a']==5
o.append(np.ones(5),np.ones(5))
o.save(os.path.join(tmpdir, 'test.txt'))
o.save(os.path.join(tmpdir, 'test.h5'))
... | NS2LPS/pyslave | test/pydata/test_datadict.py | Python | mit | 574 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/operations/_kql_script_operations.py | Python | mit | 24,579 |
from display import *
from draw import *
from shading import Light
screen = new_screen()
#light = Light()
#light.set_constant('ambient', RED, 1)
#light.set_constant('ambient', GREEN, 1)
#light.set_constant('ambient', BLUE, 1)
#light.set_constant('diffuse', RED, 1)
#light.set_constant('diffuse', GREEN, 1)
#light.set_c... | aidan-fitz/turban-potoo | test.py | Python | mit | 1,019 |
from atom.views import ActionMessageMixin, ActionView
from braces.views import LoginRequiredMixin, StaffuserRequiredMixin, UserFormKwargsMixin
from dal import autocomplete
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.urls import reverse
from django.utils.translation import ugettext_lazy as... | watchdogpolska/poradnia | poradnia/users/views.py | Python | mit | 4,703 |
"""Services for ScreenLogic integration."""
import logging
from screenlogicpy import ScreenLogicError
import voluptuous as vol
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv
from homeassi... | rohitranjan1991/home-assistant | homeassistant/components/screenlogic/services.py | Python | mit | 3,148 |
import click
from textkit.utils import output, read_tokens
@click.command()
@click.argument('tokens', type=click.File('r'), default=click.open_file('-'))
@click.option('-m', '--minimum', default=3,
help='Minimum length of token to not filter.', show_default=True)
def filterlengths(minimum, tokens):
... | learntextvis/textkit | textkit/filter/filter_lengths.py | Python | mit | 491 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "easybank.settings")
application = get_wsgi_application()
| kaiocesar/easy-bank | easybank/wsgi.py | Python | mit | 169 |
# Copyright (c) 2013 Daniel Gill
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, d... | dwgill/dspell | dspell/corpus.py | Python | mit | 1,947 |
#!/usr/bin/env python
import csv
import sys
from EPPs.common import StepEPP
class GenerateHamiltonInputUPL(StepEPP):
"""Generate a CSV containing the necessary information to batch up to 9 User Prepared Library receipt plates into
one DCT plate. The Hamilton requires input and output plate containers and well... | EdinburghGenomics/clarity_scripts | scripts/generate_hamilton_input_UPL.py | Python | mit | 4,957 |
#!/usr/bin/env python
import paramiko
from datetime import datetime
#hostname='192.168.0.102'
hostname='172.28.102.250'
username='root'
password='abc'
#port=22
if __name__=='__main__':
paramiko.util.log_to_file('paramiko.log')
s=paramiko.SSHClient()
#s.load_system_host_keys()
... | kinddevil/aatest | python/mik.py | Python | mit | 831 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
# 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
La función main() d... | cursoweb/python-archivos | Merlo-Joaquin/wordcount.py | Python | mit | 2,864 |
__author__ = 'sondredyvik'
class ConstraintNet:
def __init__(self):
self.constraints = {}
def add_constraint(self,key,constraint):
if key in self.constraints:
self.constraints[key].append(constraint)
else:
self.constraints[key] = [constraint]
| pmitche/it3105-aiprogramming | project1/common/constraintnet.py | Python | mit | 304 |
import os
import shutil
from .settings import PACKAGE_DEPENDENCIES
from .utils import resolve_dependencies
def install_dependencies(directory):
resolve_dependencies(path_to_run_npm_install_in=directory)
def uninstall_dependencies(directory):
path_to_dependencies = os.path.join(directory, 'node_modules')
... | markfinger/django-node | django_node/package_dependent.py | Python | mit | 1,133 |
from sympy.logic.boolalg import *
import equibel as eb
def test_global_completion_cardinality():
G = eb.star_graph(3)
G.add_formula(1, 'p')
G.add_formula(2, 'p')
G.add_formula(3, '~p')
R_semantic = eb.global_completion(G, method=eb.SEMANTIC, opt_type=eb.CARDINALITY, simplify=True)
assert(R_se... | asteroidhouse/equibel | tests/completion_tests.py | Python | mit | 2,605 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/scons-time/help/options.py | Python | mit | 2,071 |
import unittest
from katas.kyu_6.longest_2_character_substring import substring
class SubstringTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(substring(''), '')
def test_equals_2(self):
self.assertEqual(substring('a'), 'a')
def test_equals_3(self):
self.ass... | the-zebulan/CodeWars | tests/kyu_6_tests/test_longest_2_character_substring.py | Python | mit | 1,191 |
from celery import Celery
from celery.decorators import periodic_task
from celery.schedules import crontab
import datetime
import requests
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
app = Celery('tasks', backend='redis://localhost:6379/0', broker='redis://localhost:6379/0')
LAST_... | ryankanno/hitraffic-alert | tasks.py | Python | mit | 2,052 |
class SubmitConfig:
def __init__(self,
exec_before_submit: str = None,
exec_after_submit: str = None,
submit_filename: str = None
):
self.exec_before_submit = exec_before_submit
self.exec_after_submit = exec_after_submit
se... | kyuridenamida/atcoder-tools | atcodertools/config/submit_config.py | Python | mit | 357 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-15 16:12
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateM... | Alt90/Student_progress_bar | achievement/migrations/0001_initial.py | Python | mit | 819 |
#!/usr/bin/env python
#--------Include modules---------------
from copy import copy
import rospy
from visualization_msgs.msg import Marker
from std_msgs.msg import String
from geometry_msgs.msg import Point
from nav_msgs.msg import OccupancyGrid
import actionlib_msgs.msg
from move_base_msgs.msg import MoveBaseAction,... | hasauino/multi_kobuki_gazebo | scripts/tot_r1.py | Python | mit | 2,113 |
# Copyright (c) 2018, Michael Boyle
# See LICENSE file for details: <https://github.com/moble/scri/blob/master/LICENSE>
"""Submodule for operating on LVC-format waveform files"""
from .. import __version__
from .file_io import read_from_h5
| moble/scri | scri/LVC/__init__.py | Python | mit | 242 |
from functools import reduce
from lisp.environment import default
from lisp.parser import parse
from lisp.evaluator import evaluate_expression, NIL
def compose(*fs):
"""
Helper for convinient function composition.
Example:
f(g(t(args))) <-> compose(f, g, t)(args)
"""
def compose2(f, g):
... | begor/lisp | lisp/interpreter.py | Python | mit | 640 |
import io
import sys
import threading
import wave
from pynput import keyboard
from pynput.keyboard import Key, Controller
from .RawInput import RawInput
from ..components import _BaseComponent
class KeyManager:
def __init__(self, queues):
self.activated = False
self.listener = None
self.... | ava-project/AVA | ava/input/KeyManager.py | Python | mit | 1,876 |
"""
Creates list of Objective-C or Swift specific method parameter names and types.
"""
class Parameter(object):
def __init__(self, name):
self.name = name
@staticmethod
def has_id_field(request_object):
return request_object and reduce(lambda x, y: x or y.name == 'id', request_object.fie... | yeti/signals | signals/generators/base/base_parameters.py | Python | mit | 332 |
import theano.tensor as T
import numpy as np
from cuboid.bricks import Flattener, FilterPool, Dropout, BatchNormalization
from cuboid.bricks import Convolutional, LeakyRectifier, BrickSequence
from blocks.bricks.conv import MaxPooling
from blocks.bricks import Linear, Softmax
from blocks.initialization import Isotrop... | lukemetz/MLFun | DistCifar10/model.py | Python | mit | 1,811 |
def do(i):
return i+2 | pombredanne/straight.plugin | test-packages/package-test-plugins/testplugin/foo/__init__.py | Python | mit | 25 |
import pytest
from astropy import units as u
from astropy.tests.helper import assert_quantity_allclose
from poliastro.atmosphere import COESA76
from poliastro.atmosphere.coesa76 import p_coeff, rho_coeff
coesa76 = COESA76()
def test_outside_altitude_range_coesa76():
with pytest.raises(ValueError) as excinfo:
... | Juanlu001/poliastro | tests/tests_atmosphere/test_coesa76.py | Python | mit | 4,896 |
"""jomlak URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | ihash/jomlak | jomlak/urls.py | Python | mit | 1,199 |
from pythonforandroid.recipe import PythonRecipe
class Asn1cryptoRecipe(PythonRecipe):
name = 'asn1crypto'
version = '0.23.0'
url = 'https://pypi.python.org/packages/31/53/8bca924b30cb79d6d70dbab6a99e8731d1e4dd3b090b7f3d8412a8d8ffbc/asn1crypto-0.23.0.tar.gz#md5=97d54665c397b72b165768398dfdd876'
depend... | wexi/python-for-android | pythonforandroid/recipes/asn1crypto/__init__.py | Python | mit | 426 |
# -*- coding: utf-8 -*-
# © 2015 Nedas Žilinskas <nedas.zilinskas@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Variant Pictures",
"category": "Website",
"summary": "Shows picture of the product variant instead of plain color",
"version": "8.0.1.0",
"des... | nedaszilinskas/Odoo-CMS-Variant-Pictures | website_sale_variant_pictures/__openerp__.py | Python | mit | 783 |
"""
@brief test log(time=3s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder
from pymyinstall.packaged import small_set
from pymyinstall.win_installer.win_batch import create_win_batches
class TestBatch(unittest.TestCase):
def test_batc... | sdpython/pymyinstall | _unittests/ut_win_installer/test_batch.py | Python | mit | 881 |
import copy
import framework.transf_visitor as tvisitor
import framework.visitor
import lan
import lan.ast_buildingblock as ast_bb
class MyError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Transformation():
""" Apply trans... | dikujepsen/OpenTran | v2.0/framework/unused/transformation.py | Python | mit | 21,029 |
from setuptools import setup, find_packages
setup(
name='aiida-phonon',
version='0.1',
description='AiiDA plugin for running phonon calculations using phonopy',
url='https://github.com/abelcarreras/aiida_extensions',
author='Abel Carreras',
author_email='abelcarreras@gmail.com',
license='MI... | abelcarreras/aiida_extensions | setup.py | Python | mit | 2,089 |
# -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
CSRF_ENABLED = True
SECRET_KEY = 'UsTd+_P&kv#jdQ!3Oc.Kb$yd,ey/B2i-aM8em'
SITE_NAME = 'basilinna'
MYSQL_DB = 'basilinna'
MYSQL_USER = 'root'
MYSQL_PASSWD = 'root'
MYSQL_HOST = 'localhost'
MYSQL_POST = 3306
basedir = os.path.abspa... | allotory/basilinna | config.py | Python | mit | 850 |
import concurrent.futures
import secrets
from enum import Enum
from ipaddress import ip_address
from typing import Tuple, Set, Dict, Callable
from urllib import parse
import pytz
import urllib3
from CommonServerUserPython import * # noqa
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-impo... | demisto/content | Packs/QRadar/Integrations/QRadar_v3/QRadar_v3.py | Python | mit | 164,136 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-servicebus/azure/mgmt/servicebus/models/resource.py | Python | mit | 1,296 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/effective_network_security_group_list_result.py | Python | mit | 1,426 |
"""setup.py"""
from setuptools import setup
with open("README.md") as readme_file:
README = readme_file.read()
test_requirements = ["mock", "pytest", "responses", "testfixtures", "requests", "pyzmq"]
# Async requirements
test_requirements.extend(["pytest-asyncio", "aiohttp", "tornado", "websockets"])
setup(
... | bcb/jsonrpcclient | setup.py | Python | mit | 1,595 |
"""
Module containing a collection of detector functions used by the
Measurement Control.
"""
import traceback
import numpy as np
from copy import deepcopy
import time
from string import ascii_uppercase
from pycqed.analysis import analysis_toolbox as a_tools
from pycqed.utilities.timer import Timer
from qcodes.instrume... | QudevETH/PycQED_py3 | pycqed/measurement/detector_functions.py | Python | mit | 79,958 |
import os
import json
from io import open
__all__ = ['get']
parent_dir = os.path.dirname(__file__)
data_dir = 'json/'
cache = {}
def get(name):
if name not in cache:
with open(os.path.join(parent_dir, data_dir, "%s.json" % name), encoding='utf-8') as f:
cache[name] = json.load(f)
retur... | OnroerendErfgoed/language-tags | language_tags/data/__init__.py | Python | mit | 334 |
import glob
import os
import tempfile
import urllib.parse
import plugin
import pluginconf
import requests
import telepot
util = plugin.get("util")
ERROR_USER_UNKNOWN = ("I don't know you, but I'll tell you something. "
"Sometimes, I use words that I don't "
"know to make ... | alobbs/autome | plugins/telegram.py | Python | mit | 5,837 |
## image quickie!
## install PIL (Python Imaging Library) first. Supercool lib
import Image ## from Pil !
fImageOrig = "C:\\evil1.jpg"
im = Image.open(fImageOrig)
print im.size, im.mode
width, height = im.size
## get pixel list
lpix = list(im.getdata())
def getEvenOdd(lpix, width, height):
return getPixels(lp... | tdl/python-challenge | l12_imageEvilReal.py | Python | mit | 3,202 |
class Solution:
def partition(self, s: str) -> List[List[str]]:
palindrome = [[False]*len(s) for _ in range(len(s))]
for j in range(len(s)):
for i in range(j + 1):
if s[i] == s[j] and (j - i < 2 or palindrome[i+1][j-1]):
palindrome[i][j] = True
... | jiadaizhao/LeetCode | 0101-0200/0131-Palindrome Partitioning/0131-Palindrome Partitioning.py | Python | mit | 711 |
from test_utils import testCaseSetUp
from test_utils import testCaseTearDown
from test_utils import getUnitTestUserEmail
from src.models import Host
from src.models import Link
from src.models import UserHasLink
from src.memcache_utils import MemCacheKeyGen
from src.error_message import ErrorMessages
import urllib2
i... | cloud-io/CloudUp | tests/test_my_views.py | Python | mit | 8,048 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-11-29 11:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.contrib.taggit
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
... | CT-Data-Collaborative/ctdata-wagtail-cms | ctdata/migrations/0040_auto_20161129_1118.py | Python | mit | 1,900 |
import pytest
def raising_checker(value, system):
from snovault.auditor import AuditFailure
if not value.get('checker1'):
raise AuditFailure('testchecker', 'Missing checker1')
def returning_checker(value, system):
from snovault.auditor import AuditFailure
if not value.get('checker1'):
... | T2DREAM/t2dream-portal | src/encoded/tests/test_auditor.py | Python | mit | 4,492 |
from LSFEventType import LSFEventType
__author__ = 'pascal'
from urllib import urlopen
import time
from threading import Thread
from glob import glob
class LSFFetcher:
_overview_url = ''
_event_urls = []
simultaneous_threads = 10
def add_overview_url(self, overview_url):
self._overview_url ... | pascalweiss/LSFEventScraper | LSFFetcher.py | Python | mit | 2,374 |
from flask_dance.consumer import OAuth2ConsumerBlueprint
from functools import partial
from flask.globals import LocalProxy, _lookup_app_object
from flask import _app_ctx_stack as stack
__maintainer__ = "Michael Abrahamsen <support@conveyor.dev>"
def make_digitalocean_blueprint(
client_id=None,
client_secr... | singingwolfboy/flask-dance | flask_dance/contrib/digitalocean.py | Python | mit | 3,527 |
PORT = "3000"
LENGTH_PORT = 5
TTL = "2"
LENGTH_TTL = 2
ERROR_PKT = "0000"
LIST_PKT = []
LENGTH_PKTID = 16
LENGTH_FILENAME = 100
LENGTH_QUERY = 20
LENGTH_SECTION_IPV4 = 3
LENGTH_SECTION_IPV6 = 4
LENGTH_PACK = 1024
LENGTH_NCHUNK = 5
LENGTH_NCHUNKS = 6
LENGTH_HEADER = 10
CODE_QUERY = "QUER"
CODE_ANSWER_QUERY = "AQ... | tommasoberlose/p2p_gnutella | Constant.py | Python | mit | 610 |
country_lookup = {
24: "afago",
108: "afbdi",
204: "afben",
854: "afbfa",
72: "afbwa",
140: "afcaf",
384: "afciv",
120: "afcmr",
180: "afcod",
178: "afcog",
174: "afcom",
132: "afcpv",
262: "afdji",
12: "afdza",
818: "afegy",
232: "aferi",
732: "afesh"... | DataViva/dataviva-scripts | scripts/comtrade/helpers/__init__.py | Python | mit | 5,331 |
from mifiel import Base
class Certificate(Base):
def __init__(self, client):
Base.__init__(self, client, 'keys')
| Mifiel/python-api-client | mifiel/certificate.py | Python | mit | 120 |
def foo(tom):
fred = 0
for bill in range(1,tom+1):
barney = bill
fred = fred + barney
return fred
| robin1885/algorithms-exercises-using-python | source-code-from-author-book/Listings-for-Second-Edition/listing_2_2.py | Python | mit | 123 |
from random import randrange
MAX_K =16
DEFAULT_K = 8
def hash(word):
wordStr = str(word)
assert len(wordStr) <= MAX_K
value = 0
for n, ch in enumerate(wordStr):
value += ord(ch) * 128 ** n
#value += 2 * ord(ch) ** n
return value
class BloomFilter(object):
allchars ... | timasjov/famous-algorithms | hashing/BloomFilter.py | Python | mit | 1,098 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : RobertDing
# E-mail : robertdingx@gmail.com
# Date : 15/08/29 02:24:28
# Desc : fetch video
#
from __future__ import absolute_import, division, with_statement
| robertding/vo | vo/dl/__init__.py | Python | mit | 242 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Simple agent which chooses a random label.
Chooses from the label candidates if they are available. If candidates ar... | facebookresearch/ParlAI | parlai/agents/random_candidate/random_candidate.py | Python | mit | 2,698 |
import numpy as np
from itertools import product
from learning.model_free import Problem
from learning.model_free import sarsa
from learning.model_free import qlearning
from learning.model_free import mc_value_iteration
from learning.model_free import sarsa_lambda
from learning.model_free import q_lambda
# from learn... | paulorauber/rl | examples/blackjack.py | Python | mit | 5,813 |
import datetime
DEFAULT_SETTINGS = {
'SIGNATURE_TIMEOUT': datetime.timedelta(seconds=1.5)
}
| sunscrapers/djamazing | djamazing/settings.py | Python | mit | 98 |
#!/usr/bin/env python
# pykvm
# https://github.com/JonathonReinhart/pykvm
# (C) 2015 Jonathon Reinhart
import sys
import os, os.path
import mmap
import struct
import pykvm
from pykvm.exitreason import *
def dump_extensions(kvm):
for ext, sup in kvm.get_extensions():
print '{:<40}: {}'.format(ext, sup)
... | JonathonReinhart/pykvm | test.py | Python | mit | 3,324 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ===------------------------------* Python *------------------------------===
# THIS FILE IS GENERATED BY INVAR. DO NOT EDIT !!!
# ===------------------------------------------------------------------------===
try:
from cStringIO import StringIO
except:
... | struqt/invar | invar-example/target/generated-sources/example/python/TestDbMemberEntry.py | Python | mit | 4,050 |
from django.conf import settings
from django.utils import timezone
from rest_framework import authentication
from rest_framework import exceptions
import datetime
import jwt
from .models import User
def generate_jwt(user):
payload = {
'user': user.pk,
'exp': timezone.now() + datetime.timedelta... | Jwpe/alexandria-server | alexandria_server/permissions/authentication.py | Python | mit | 2,060 |
import numpy as np
import pdb
#from dtree import *
import model
def main():
# detree = DTree(np.zeros(3), [1., 2., 3.])
#
# inputs = [0.2, 0.6, 0.1]
# print detree.infer(inputs)
# detree.feedback(inputs, 1)
# pdb.set_trace()
# cuts = detree.save()
# print cuts
# detree.feedback(inputs, 0)
... | tianrui/FlappyClone | test_dtree.py | Python | mit | 440 |
import sys, os, re, time, resource, gc
import ujson, boto
import boto.s3.connection
from collections import defaultdict
access_key = os.environ["AWS_ACCESS_KEY"]
secret_key = os.environ["AWS_SECRET_KEY"]
def key_iterator(key):
"""
Iterator for line by line, for going through the whole contents of a key
""... | jvictor0/TweetTracker | src/TwitterRank/CheckGraph.py | Python | mit | 1,247 |
#!/usr/bin/env python2
import os
import sys
import json
import yaml
def main():
with open(sys.argv[1], 'rb') as f:
known_issues = yaml.safe_load(f.read())
skipstrings = [
'passed in strict mode',
'passed in non-strict mode',
'failed in strict mode as expected',
'failed... | svaarala/duktape | util/filter_test262_log.py | Python | mit | 3,455 |