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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
import json
import optparse
import os
import subprocess
import sys
import tempfile
CHUNK_SIZE = 2**20
DEFAULT_DATA_TABLE_NAME = "bowtie_indexes"
def get_id_name( params, dbkey, fasta_description=None):
# TODO: ensure sequence_id is unique and does not already appear in location file
se... | nturaga/tools-iuc | data_managers/data_manager_bowtie_index_builder/data_manager/bowtie_index_builder.py | Python | mit | 4,124 |
"""
WSGI config for bjjweb project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bjjweb.settings")
from django.core.wsg... | coffenbacher/bjj | bjjweb/wsgi.py | Python | agpl-3.0 | 387 |
class Solution(object):
def maxProduct(self, nums):
max_value = -200000000
"""
:type nums: List[int]
:rtype: int
"""
for i in range(1, len(nums) + 1):
for j in range(len(nums) - i + 1):
try_value = self.get_value(nums[j:j + i])
... | kingno21/practice | problems/que007/solution.py | Python | mit | 2,830 |
# -*- coding: utf-8 -*-
import pytest
from repocket.rules import compile_rules, Rule
from repocket.main import PocketItem
def test_single_rule():
item1 = PocketItem(1, 'http://google.com', [], 'Google')
item2 = PocketItem(2, 'http://github.com', [], 'Github')
rule = Rule('.*google\.com', ['google'])
... | lensvol/repocket | tests/test_rules.py | Python | mit | 857 |
#!/usr/bin/python2.7
# coding:utf-8
# Copyright 2015 Google 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 app... | clobrano/personfinder | tests/test_full_text_search.py | Python | apache-2.0 | 12,016 |
import sys
import subprocess
import textwrap
import decimal
from . import constants
from . import utils
from . import argparse_utils
def zpool_command(args):
context = vars(args)
effective_image_count = constants.ZPOOL_TYPES[args.type](args.count)
context['image_size'] = args.size / effective_image_count
... | WoLpH/zfs-utils-osx | zfs_utils_osx/zpool.py | Python | bsd-3-clause | 3,142 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Message Queue Receiver
@author: Bin Zhang
@email: sjtuzb@gmail.com
'''
import datetime
import json
import urllib
import urllib2
import paho.mqtt.client as mqtt
from config import *
# Called when the broker responds to our connection request.
def on_con... | 87boy/mqpp | paho/receiver.py | Python | gpl-2.0 | 1,915 |
import cherrystrap
import orielpy
from cherrystrap import logger, formatter
from orielpy import common
# parse_qsl moved to urlparse module in v2.6
try:
from urllib.parse import parse_qsl #@UnusedImport
except:
from cgi import parse_qsl #@Reimport
import oauth2 as oauth
import twitter
class T... | theguardian/OrielPy | orielpy/notifiers/tweet.py | Python | gpl-2.0 | 4,510 |
#
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
#
"""
This helper script is used to dynamically update configs to named.
o For backward compatibility we read the named configurable
params from contrail-dns.conf and build contrail-named-base.conf
o Alternatively user can create/update contrail-nam... | eonpatapon/contrail-controller | src/dns/applynamedconfig.py | Python | apache-2.0 | 5,723 |
import logging
import typing
from typing import List, Iterable, Optional
from binascii import hexlify
from torba.client.basescript import BaseInputScript, BaseOutputScript
from torba.client.baseaccount import BaseAccount
from torba.client.constants import COIN, NULL_HASH32
from torba.client.bcd_data_stream import BCDa... | lbryio/lbry | torba/torba/client/basetransaction.py | Python | mit | 18,514 |
import io
import os.path
import nose.tools as nt
from IPython.utils import openpy
mydir = os.path.dirname(__file__)
nonascii_path = os.path.join(mydir, "../../core/tests/nonascii.py")
def test_detect_encoding():
with open(nonascii_path, "rb") as f:
enc, lines = openpy.detect_encoding(f.readline)
nt.... | sserrot/champion_relationships | venv/Lib/site-packages/IPython/utils/tests/test_openpy.py | Python | mit | 1,271 |
#!/usr/bin/env python
#
# Copyright (C) 2014 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 you... | verbalsaintmars/vsd_brand_new | .ycm_extra_conf.py | Python | mit | 5,280 |
import twitter
import glob
import random
class Tweety( object ):
def signIn(self):
df = open('./twitter/login.dat', 'r')
self.creds = {}
for line in df:
l = line.split()
self.creds[l[0]] = l[1]
self.tweeter = twitter.Api(consumer_key=self.creds["ckey"],
... | SPIE-hack-day-2014/labrador-retweeter | tweetHandler.py | Python | gpl-2.0 | 2,364 |
"""Optional dependencies for DAL."""
| yourlabs/django-autocomplete-light | src/__init__.py | Python | mit | 37 |
# -*- coding: utf-8 -*-
#
# 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
#... | owlabs/incubator-airflow | tests/contrib/sensors/test_sqs_sensor.py | Python | apache-2.0 | 4,201 |
#!/usr/bin/env python
'''
This sample demonstrates Canny edge detection.
Usage:
edge.py [<video source>]
Trackbars control edge thresholds.
'''
# Python 2/3 compatibility
from __future__ import print_function
import cv2
import numpy as np
# relative module
import video
# built-in module
import sys
if __na... | makelove/OpenCV-Python-Tutorial | 官方samples/edge.py | Python | mit | 1,130 |
"""!
@brief Unit-tests for Hysteresis Oscillatory Network.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
import unittest;
from pyclustering.nnet.hysteresis import hysteresis_network;
from pyclustering.nnet import *;
from pyclustering.utils import ext... | annoviko/pyclustering | pyclustering/nnet/tests/unit/ut_hysteresis.py | Python | gpl-3.0 | 3,547 |
#
# Copyright 2007-2014 Charles du Jeu - Abstrium SAS <team (at) pyd.io>
# This file is part of Pydio.
#
# Pydio 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 yo... | andrewleech/pydio-sync | src/pydio/ui/web_api.py | Python | gpl-3.0 | 22,015 |
"""The prezzibenzina component."""
| fbradyirl/home-assistant | homeassistant/components/prezzibenzina/__init__.py | Python | apache-2.0 | 35 |
from django.contrib import admin
from .models import Channel, Video, Podcast, Pod
import logging
log = logging.getLogger(__name__)
# Register your models here.
def update_channel(modeladmin, request, queryset):
log.info('admin: update_channel called ')
for n in queryset:
log.info("query : "+ str(n))
u... | eponsko/you2rss | you2rss/admin.py | Python | gpl-3.0 | 1,748 |
from stream_framework.feeds.aggregated_feed.base import AggregatedFeed
from stream_framework.serializers.aggregated_activity_serializer import \
NotificationSerializer
from stream_framework.storage.redis.timeline_storage import RedisTimelineStorage
import copy
import json
import logging
logger = logging.getLogger(... | nikolay-saskovets/Feedly | stream_framework/feeds/aggregated_feed/notification_feed.py | Python | bsd-3-clause | 5,626 |
from __future__ import division
from pylab import *
from sklearn import datasets
from sklearn import svm
#import cv2
def svmTest():
def sk_learn():
data = datasets.load_digits()
N_test = int(1050)
x_train = data['data'][:-N_test]
y_train = data['target'][:-N_test]
x_test ... | shyamalschandra/swix | python_testing/testing.py | Python | mit | 1,865 |
"""
This module hosts all the extension functions and classes created via SDK.
The function :py:func:`ext_import` is used to import a toolkit module (shared library)
into the workspace. The shared library can be directly imported
from a remote source, e.g. http, s3, or hdfs.
The imported module will be under namespace... | ypkang/Dato-Core | src/unity/python/graphlab/extensions.py | Python | agpl-3.0 | 27,795 |
import itertools
unique_character = '$'
def z_algorithm_detail(super_str, pat_size):
z_score_arr = [0] * len(super_str)
l, r = 0, 0
def get_match_num(begin_0, begin_1):
match_num = 0
while super_str[begin_0 + match_num] == super_str[begin_1 + match_num]:
match_num += 1
... | YcheLanguageStudio/PythonStudy | bioinformatics/string_matching/z_algorithm.py | Python | mit | 2,932 |
"""
dirsrv_sysconfig - file ``/etc/sysconfig/dirsrv``
=================================================
This module provides the ``DirsrvSysconfig`` class parser, for reading the
options in the ``/etc/sysconfig/dirsrv`` file.
Sample input::
# how many seconds to wait for the startpid file to show
# up before... | PaulWay/insights-core | insights/parsers/dirsrv_sysconfig.py | Python | apache-2.0 | 1,126 |
class TortillaException(Exception):
def __init__(self, **keys):
super().__init__(self.message % keys)
class ConfigKeyNotFound(TortillaException):
message = ("The requested key '%(key)s' does not exist in the "
"application configuration")
class ConfigConflict(TortillaException):
m... | Cerberus98/tortilla | tortilla/exception.py | Python | apache-2.0 | 1,482 |
# -*- coding: utf-8 -*-
import re
from django import forms
from django.forms.util import ErrorList
from django.utils.translation import ugettext_lazy as _
from molly.conf import applications
from molly.geolocation import geocode, reverse_geocode
METHOD_CHOICES = (
('html5', 'HTML5'),
('html5request', 'HTML5 ... | mollyproject/mollyproject | molly/geolocation/forms.py | Python | apache-2.0 | 4,202 |
#!/usr/bin/env python3
# Copyright 2017 Donour Sizemore
#
# This file is part of RacePi
#
# RacePi 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, version 2.
#
# RacePi is distributed in the hope that it will ... | donour/racepi | python/utilities/stn11xx_monitor.py | Python | gpl-2.0 | 1,692 |
# Copyright 2013 by Kamil Koziara. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""
I/O operations for gene annotation files.
"""
from __future__ import ... | arkatebi/SwissProt-stats | Ontology/IO/GoaIO.py | Python | gpl-3.0 | 8,540 |
#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivault import hashiwrapper
ANSIBLE_METADATA = {'status': ['stableinterface']... | TerryHowe/ansible-modules-hashivault | ansible/modules/hashivault/hashivault_approle_role_secret_get.py | Python | mit | 2,303 |
from __future__ import absolute_import
from . import ir as I
from .walk import IRWalker, propigate_location
class EvaluateCompileTime(IRWalker):
descend_into_functions = True
def __init__(self, eval_ir):
super(EvaluateCompileTime, self).__init__()
self.eval_ir = eval_ir
def visit_compi... | matthagy/Jamenson | jamenson/compiler/preeval.py | Python | apache-2.0 | 564 |
#!/usr/bin/env python
"""models.py
Udacity conference server-side Python App Engine data & ProtoRPC models
$Id: models.py,v 1.1 2014/05/24 22:01:10 wesc Exp $
created/forked from conferences.py by wesc on 2014 may 24
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
import httplib
import endpoints
from protor... | rumblefish2494/FSWD-P4 | models.py | Python | apache-2.0 | 5,280 |
#!/usr/bin/env python
import argparse
import bullet_cartpole
import collections
import datetime
import gym
import json
import numpy as np
import replay_memory
import signal
import sys
import tensorflow as tf
import time
import util
np.set_printoptions(precision=5, threshold=10000, suppress=True, linewidth=10000)
pars... | matpalm/cartpoleplusplus | naf_cartpole.py | Python | mit | 22,487 |
# Copyright (C) 2016, University of Notre Dame
# All rights reserved
import website
from django.test.testcases import TestCase
from django.test.utils import override_settings
class GetSiteUrlTest(TestCase):
@override_settings(SITE_URL="https://om.vecnet.org/")
def test_1(self):
self.assertEqual(websi... | vecnet/om | website/tests/test_get_site_url.py | Python | mpl-2.0 | 833 |
import unittest
import os
import sys
import time
import os.path as op
from functools import partial
from kivy.clock import Clock
main_path = op.dirname(op.dirname(op.abspath(__file__)))
sys.path.append(main_path)
from messanger import Messanger
class Test(unittest.TestCase):
# sleep function that catches `dt` f... | Abraxos/hermes | hermes-native/tests/test_select_transition.py | Python | gpl-3.0 | 1,249 |
from mongoengine.errors import OperationError
from mongoengine.queryset.base import (BaseQuerySet, CASCADE, DENY, DO_NOTHING,
NULLIFY, PULL)
__all__ = ('QuerySet', 'QuerySetNoCache', 'DO_NOTHING', 'NULLIFY', 'CASCADE',
'DENY', 'PULL')
# The maximum number of items to ... | MakerReduxCorp/mongoengine | mongoengine/queryset/queryset.py | Python | mit | 6,389 |
"""
Component to interface with binary sensors.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor/
"""
import logging
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.entity import Entity
from hom... | aoakeson/home-assistant | homeassistant/components/binary_sensor/__init__.py | Python | mit | 2,527 |
import logging, time, re, os, tempfile, ConfigParser
import threading
import xml.dom.minidom
from autotest.client.shared import error, iso9660
from autotest.client import utils
from virttest import virt_vm, utils_misc, utils_disk
from virttest import kvm_monitor, remote, syslog_server
from virttest import http_server
... | ldoktor/virt-test | tests/unattended_install.py | Python | gpl-2.0 | 35,594 |
# -*- coding: utf-8 -*-
# vim: set ts=4
# Copyright 2016 Rémi Duraffort
# This file is part of ReactOBus.
#
# ReactOBus is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, ... | ivoire/ReactOBus | tests/test_outputs.py | Python | agpl-3.0 | 3,604 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pywb.cdx.cdxobject import CDXObject, IDXObject, CDXException
from pytest import raises
def test_empty_cdxobject():
x = CDXObject(b'')
assert len(x) == 0
def test_invalid_cdx_format():
with raises(CDXException):
x = CDXObject(b'a b c')
def _make... | pombredanne/pywb | pywb/cdx/test/test_cdxobject.py | Python | gpl-3.0 | 1,455 |
"""
THIS IS NOT OUR CODE!!!
"""
import itertools
from card import Card
class LookupTable(object):
"""
Number of Distinct Hand Values:
Straight Flush 10
Four of a Kind 156 [(13 choose 2) * (2 choose 1)]
Full Houses 156 [(13 choose 2) * (2 choose 1)]
Flush 1277 ... | simonbw/poker-player | lookup.py | Python | mit | 8,924 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: messagepath/v1/visibility_rules.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf imp... | tomer8007/kik-bot-api-unofficial | kik_unofficial/protobuf/messagepath/v1/visibility_rules_pb2.py | Python | mit | 5,997 |
#!/usr/bin/python
# Copyright (c) 2017 Ansible Project
# 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',
'status': ['pre... | Lujeni/ansible | lib/ansible/modules/cloud/amazon/aws_direct_connect_virtual_interface.py | Python | gpl-3.0 | 17,347 |
import datetime
import ddt
import pytz
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
from django.test import RequestFactory
from opaque_keys.edx.keys import CourseKey
from openedx.core.lib.courses import course_image_url
from rest_framework.test import APIClient
from xmo... | jolyonb/edx-platform | cms/djangoapps/api/v1/tests/test_views/test_course_runs.py | Python | agpl-3.0 | 15,167 |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from hidespines import *
import sys
from scipy.interpolate import interp1d
sys.path.append('../../code')
import ld as LD
def make(sol, ot, tol, label):
err = np.zeros(len(sol))
it = np.zeros(len(sol))
for i in range(len(sol)):
... | smsolivier/VEF | tex/paper/coarse.py | Python | mit | 1,371 |
# -*- coding: utf-8 -*-
"""Test XML parsing in XBlocks."""
import re
import StringIO
import textwrap
import unittest
from xblock.core import XBlock
from xblock.fields import Scope, String, Integer
from xblock.test.tools import blocks_are_equivalent
from xblock.test.toy_runtime import ToyRuntime
# XBlock classes to u... | IONISx/XBlock | xblock/test/test_parsing.py | Python | agpl-3.0 | 6,043 |
class BinaryCode:
def decode(self, message):
zero_string = self.decode_message(message, 0)
one_string = self.decode_message(message, 1)
return(zero_string, one_string)
def decode_message(self, message, init):
decode_string = ""
p0 = init
q = message[0]
p1 = int(q) - p0
decode_string = decode_string... | mikefeneley/topcoder | src/SRM-144/binarycode.py | Python | mit | 641 |
# -----------------------------------------------------------------------------
# description
#
# a very basic working version of commands to generate a tokenized word
# list and associated nltk text class for further nlp resulting in a
# sorted list of the most frequently occurring phrases found in the cs
# rep's me... | alankruppa/asapp-cp | challenge_data_model.py | Python | gpl-2.0 | 4,154 |
"""
WSGI config for joaozenos project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "joaozenos.settings")
from django.co... | joaozenos/joaozenos-python | joaozenos/wsgi.py | Python | mit | 484 |
"""
Define command names and prove command/code mappings
"""
from collections import ChainMap
__all__ = [
'nibble_commands',
'byte_commands',
'sysex_commands',
'command_lookup',
'command_names',
]
INPUT, OUTPUT, ANALOG, \
PWM, SERVO, I2C, ONEWIRE, \
STEPPER, ENCODER = range(0, 9)
# do not combine... | bitcraft/firmata_aio | firmata_aio/protocol/commands.py | Python | gpl-3.0 | 1,998 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2018 CERN.
#
# Zenodo 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 v... | slint/zenodo | zenodo/modules/stats/config.py | Python | gpl-2.0 | 1,482 |
'''
@author: FangSun
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.primarystorage_operations as ps_ops
import random
_config_ = {
'timeout' : 3000,
'noparallel' : True
... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/multiPrimaryStorage/test_one_ps_disabled.py | Python | apache-2.0 | 4,290 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
class Model(object):
"""Defines an abstract network model for use with RLlib.
Models convert input tensors to a number of output features. These features
can then be inter... | alanamarzoev/ray | python/ray/rllib/models/model.py | Python | apache-2.0 | 1,961 |
# -*- coding: utf-8 -*-
import json
from datetime import datetime
import sqlalchemy as sa
from aiopg.sa.result import ResultProxy
from .db import TLE, insert_tle
from .log import logger
from .utils import audit, send_pg_notify
__all__ = (
'get_tle_dt',
'nasa',
'space_track',
)
@audit(logger=logger)
asy... | nkoshell/tle-storage-service | tle_storage_service/tle.py | Python | mit | 3,997 |
import requests
from bitfinex.bitfinex_config import DEFAULT
from bitfinex.ticker import Ticker
__author__ = 'Gengyu Shi'
URL_PREFIX = DEFAULT.url_prefix
def ticker(symbol):
return Ticker(requests.get(URL_PREFIX + "/pubticker/" + symbol, verify=True).json())
DEFAULT.url_prefix
| shigengyu/bitfinex-python | bitfinex/rest_api.py | Python | mit | 289 |
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# (c) 2005 Ian Bicking, Clark C. Evans and contributors
# This module is part of the Python Paste Project and is released under
# the MIT License: http... | kaldonis/ft-event-manager | src/lib/paste/fileapp.py | Python | gpl-2.0 | 13,617 |
# -*- coding: utf-8 -*-
"""
Tests of neo.io.brainwaredamio
"""
# needed for python 3 compatibility
from __future__ import absolute_import, division, print_function
import os.path
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
import numpy as np
import quantities as pq
from... | CINPLA/expipe-dev | python-neo/neo/test/iotest/test_brainwaredamio.py | Python | gpl-3.0 | 5,709 |
from . import client, aioclient, parse
__all__ = [
'client',
'aioclient',
'parse'
]
| danking/hail | hail/python/hailtop/batch_client/__init__.py | Python | mit | 97 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | rahulunair/nova | nova/tests/unit/api/openstack/compute/test_image_metadata.py | Python | apache-2.0 | 17,106 |
import bpy
from bpy_extras.io_utils import ExportHelper, ImportHelper
import json
from . import utils
from .utils import MultiCamContext
from .multicam_fade import MultiCamFaderProperties
class MultiCamExport(bpy.types.Operator, ExportHelper, MultiCamContext):
bl_idname = 'sequencer.export_multicam'
bl_label... | nocarryr/blender-scripts | multicam_tools/multicam_import_export.py | Python | gpl-2.0 | 2,843 |
import os
import sys
import logging
import inspect
from inspect import getmembers, isfunction
from commands import command
import handlers
logger = logging.getLogger(__name__)
class tracker:
def __init__(self):
self.bot = None
self.list = []
self.reset()
def set_bot(self, bot):
... | ravrahn/HangoutsBot | hangupsbot/plugins/__init__.py | Python | gpl-3.0 | 11,524 |
# GNU LESSER GENERAL PUBLIC LICENSE
import io
import json as lib_json
from base64 import b64encode
try:
import bottle
except ImportError:
print("you don't have bottle installed")
try:
from urlparse import urlparse
from urllib import urlencode
except ImportError:
from urllib.parse import urlparse, urlen... | keredson/boddle | boddle.py | Python | lgpl-2.1 | 2,662 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Defect thermodynamics, such as defect phase diagrams, etc.
"""
import logging
from itertools import chain
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
from monty.json impor... | gmatteo/pymatgen | pymatgen/analysis/defects/thermodynamics.py | Python | mit | 30,749 |
"""Tankerkoenig sensor integration."""
import logging
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_LATITUDE, ATTR_LONGITUDE
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .const import DOMAIN, NAME
_LOGGER = log... | nkgilley/home-assistant | homeassistant/components/tankerkoenig/sensor.py | Python | apache-2.0 | 5,069 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/sblk_path16.py | Python | apache-2.0 | 1,953 |
# stdlib
from unittest import TestCase
import socket
import threading
import Queue
from collections import defaultdict
# 3p
import mock
# project
from dogstatsd import mapto_v6, get_socket_address
from dogstatsd import Server, init
from utils.net import IPV6_V6ONLY, IPPROTO_IPV6
class TestFunctions(TestCase):
d... | indeedops/dd-agent | tests/core/test_dogstatsd.py | Python | bsd-3-clause | 4,325 |
import website_sale_available_fake_models
import controllers
| odoousers2014/website-addons | website_sale_available_fake/__init__.py | Python | lgpl-3.0 | 61 |
# Test case from bug #1506850
#"When threading is enabled, the interpreter will infinitely wait on a mutex the second
# time this type of extended method is called. Attached is an example
# program that waits on the mutex to be unlocked."
from director_extend import *
class MyObject(SpObject):
def __init__(self... | DGA-MI-SSI/YaCo | deps/swig-3.0.7/Examples/test-suite/python/director_extend_runme.py | Python | gpl-3.0 | 579 |
# READ THE INSTRUCTIONS BELOW BEFORE YOU ASK QUESTIONS
# Arena game mode written by Yourself
# A game of team survival. The last team standing scores a point.
# A map that uses arena needs to be modified to have a starting area for
# each team. A starting area is enclosed and has a gate on it. Each block of a
# gate... | iamgreaser/pycubed | feature_server/scripts/arena.py | Python | gpl-3.0 | 21,329 |
#
# Copyright (c) 2015 Open-RnD Sp. z o.o.
#
# 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, publ... | open-rnd/ros3d-dev-controller | ros3ddevcontroller/param/__init__.py | Python | mit | 1,203 |
"""
Methods for shutting up a dhcp server on your lan intelligently (and optionally resotre it)
Copyright (C) 2015 Bram Staps (Glasswall B.V.)
This file is part of Dhcpgag.
Dhcpgag is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publ... | bram-glasswall/dhcpgag | pktgen.py | Python | gpl-3.0 | 3,063 |
#!/usr/bin/python
# coding: utf-8
class Solution(object):
def diffWaysToCompute(self, input):
"""
:type input: str
:rtype: List[int]
"""
res = []
for i in range(len(input)):
c = input[i]
if c == "+" or c == "-" or c == "*":
lef... | Lanceolata/code-problems | python/leetcode_medium/Question_123_Different_Ways_to_Add_Parentheses.py | Python | mit | 1,443 |
# -*- coding: utf-8 -*-
# Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Stock picking filter lot",
"summary": "In picking out lots' selection, "
"filter lots based on their location",
"version": "11.0.1.0.0",
... | Domatix/stock-logistics-workflow | stock_picking_filter_lot/__manifest__.py | Python | agpl-3.0 | 767 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Prints the lowest locally available SDK version greater than or equal to a
given minimum sdk version to standard output.
Usage:... | biblerule/UMCTelnetHub | tools/mac/find_sdk.py | Python | mit | 3,430 |
#!/usr/bin/env python
'''
usage: alter.py my.pdf
Creates alter.my.pdf
Demonstrates making a slight alteration to a preexisting PDF file.
'''
import sys
import os
import find_pdfrw
from pdfrw import PdfReader, PdfWriter
inpfn, = sys.argv[1:]
outfn = 'alter.' + os.path.basename(inpfn)
trailer = PdfReader(inpfn)... | kulbirsaini/pdfrw-fork | examples/alter.py | Python | mit | 433 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Validators
"""
from functools import partial
from rebulk.validators import chars_before, chars_after, chars_surround
from . import seps
seps_before = partial(chars_before, seps)
seps_after = partial(chars_after, seps)
seps_surround = partial(chars_surround, seps)
de... | Thraxis/pymedusa | lib/guessit/rules/common/validators.py | Python | gpl-3.0 | 558 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | diogocs1/comps | web/addons/mrp/wizard/mrp_product_produce.py | Python | apache-2.0 | 6,090 |
# ===============================================================================
# Copyright 2014 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/licens... | USGSDenverPychron/pychron | pychron/external_pipette/tasks/external_pipette_plugin.py | Python | apache-2.0 | 2,745 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011-2015 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# -----------------------------------------------------------------------------
''... | bitforks/freetype-py | freetype/ft_enums/__init__.py | Python | bsd-3-clause | 5,410 |
#!/usr/bin/env python
import os
import socket
import subprocess
def run_gae ():
mydir = os.path.dirname(__file__)
basedir = os.path.join(mydir, '..')
os.chdir(basedir)
kwargs = {
'host': socket.getfqdn(),
'sdk': '~/lib/google_appengine/'
}
cmd = "{sdk}dev_appserver.py --enable_sendmail --host {... | pizzapanther/HoverMom | scripts/start_gae.py | Python | mit | 492 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for Student's Profile Page.
"""
from contextlib import contextmanager
from datetime import datetime
from unittest import skip
from nose.plugins.attrib import attr
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.commo... | Stanford-Online/edx-platform | common/test/acceptance/tests/lms/test_learner_profile.py | Python | agpl-3.0 | 30,572 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# 7 i TRIA
# Copyright (C) 2011 - 2012 7 i TRIA <http://www.7itria.cat>
# Avanzosc - Avanced Open Source Consulting
# Copyright (C) 2011 - 2012 Avanzosc <http://www.avanzosc.com>
#
# This program is... | avanzosc/avanzosc6.1 | l10n_es_devolucion_remesas/invoice.py | Python | agpl-3.0 | 2,919 |
from unicodedata import category
from django.core.management.base import BaseCommand, CommandError
from workflows.models import Category, AbstractWidget, AbstractInput, AbstractOutput, AbstractOption
from django.core import serializers
from optparse import make_option
import uuid
import os
import sys
from djang... | xflows/textflows | workflows/management/commands/export_all.py | Python | mit | 1,124 |
# -*- coding: utf-8 -*-
#
import ftplib
import os
import re
import shutil
import tarfile
import time
from pathlib import Path
from subprocess import call
from socket import gaierror
import paramiko
from paramiko.ssh_exception import SSHException, AuthenticationException
import requests
from django.conf import setting... | reellz/django-statify | statify/views.py | Python | bsd-3-clause | 12,635 |
#!/usr/bin/env python
from unittest import TestCase, main
from qiime.parallel.merge_otus import mergetree, mergeorder, \
initial_nodes_to_merge, initial_has_dependencies, job_complete, \
torque_job, local_job, start_job, JobError, reset_internal_count
import os
__author__ = "Daniel McDonald"
__copyright__ = "... | wasade/qiime | tests/test_parallel/test_merge_otus.py | Python | gpl-2.0 | 4,310 |
# -*- coding: utf-8 -*-
import scrapy
import re
import urllib.request
from scrapy.http import Request
from spider_jd_phone.items import SpiderJdPhoneItem
class JdPhoneSpider(scrapy.Spider):
name = 'jd_phone'
allowed_domains = ['jd.com']
str_keyword = '手机京东自营'
encode_keyword = urllib.request.quote(str_... | jinzekid/codehub | python/py3_6venv/spider_jd_phone/spider_jd_phone/spiders/jd_phone.py | Python | gpl-3.0 | 3,028 |
#Every X seconds, check if the minecaft server is running? [Default: 60]
sleepTime=5
#Enable AutoSave? ("save-all") [Default: true]
autoSave=True
#AutoSave Every X seconds? [Default = 300 (5 minutes)]
saveX=300
#Full path to server start script (Must CD to server directory and start java)
startScript="/home/user/mcs... | gsanders5/RavenWrapper | config.py | Python | mit | 572 |
from cmio import MaterialVisitor | esetomo/mio | script/pymio/material/material_visitor.py | Python | gpl-3.0 | 32 |
#!/usr/bin/python
# coding: utf-8
'''
File: tiger_release_aug07.corrected.16012013_patch.py
Author: Oliver Zscheyge
Description:
Fixes wrong morph values in the TIGER corpus:
tiger_release_aug07.corrected.16012013.xml
Also converts XML file to utf-8 encoding.
'''
import codecs
import fileinput
TIGER_... | ooz/Confopy | confopy/localization/de/corpus_de/tiger_release_aug07.corrected.16012013_patch.py | Python | mit | 2,377 |
#!/usr/bin/env python
import EnvConfig
EnvConfig.Script().main()
| ocordes/arctic | cmake/scripts/env.py | Python | lgpl-3.0 | 65 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0002_question_test_field'),
]
operations = [
migrations.RemoveField(
model_name='question',
... | kiriakosv/movie-recommendator | moviesite/polls/migrations/0003_remove_question_test_field.py | Python | mit | 357 |
import socket
import config
class ResourceManager(object):
map = {}
def is_locked(self, resource):
"""Check if a resource is being held.
"""
return resource in self.map and self.map[resource]
def peak_holder(self, resource):
"""Peak who is the holder of a given resource.... | lucasdavid/distributed-systems | projects/6/sync-server/sync_server.py | Python | mit | 3,850 |
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses... | onecloud/neutron | neutron/db/vpn/vpn_db.py | Python | apache-2.0 | 32,188 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | aqt/jax/wmt_mlperf/hparams_configs/experimental/minimal_model_bfloat16.py | Python | apache-2.0 | 1,214 |
#ADDER
def adder(no, runningtotal):
if no == "":
return runningtotal
else:
runningtotal = float(no) + runningtotal
no = raw_input("Running total: " + str(runningtotal) + "\nNext number: ")
return adder(no, runningtotal)
#BIGGEST
def biggest(BIG):
#Here, previousno is basic... | bomin2406-cmis/bomin2406-cmis-cs2 | practice.py | Python | cc0-1.0 | 813 |
import os
from unittest import mock
from django.core import mail
from conductor.tests import TestCase
from conductor.vendor import tasks
from conductor.vendor.models import PromptSchool
@mock.patch("conductor.vendor.tasks.requests")
class TestScanPrompt(TestCase):
def test_creates_prompt_school(self, mock_reque... | mblayman/lcp | conductor/vendor/tests/test_tasks.py | Python | bsd-2-clause | 1,776 |
from __future__ import division
from __future__ import print_function
from past.utils import old_div
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
try: # redirect python output
from StringIO import StringIO # for... | h2oai/h2o-3 | h2o-py/tests/testdir_algos/glm/pyunit_PUBDEV_8072_remove_collinear_columns.py | Python | apache-2.0 | 2,430 |
from thefuck.specific.git import git_support
@git_support
def match(command):
return (' rm ' in command.script and
'error: the following file has changes staged in the index' in command.output and
'use --cached to keep the file, or -f to force removal' in command.output)
@git_support
def... | SimenB/thefuck | thefuck/rules/git_rm_staged.py | Python | mit | 629 |
"""
Suppose you have a matrix in the form of a 2 dimensional array. Write a method to read the rows of the matrix
alternatively from right to left, left to right so on and return them as a 1 dimensional array.
for eg:
1 2 3
4 5 6
7 8 9
e.x. 1 2 3 6 5 4 7 8 9
R... | MFry/pyAlgoDataStructures | microsoft/alternate_printing_matrix.py | Python | mit | 1,059 |
import errno
import codecs
import os.path
class NamespaceNotFound(LookupError):
pass
class Source(object):
def __init__(self, name, content, modified_time, file_path):
self.name = name
self.content = content
self.modified_time = modified_time
self.file_path = file_path
cla... | vmagamedov/kinko | kinko/loaders.py | Python | bsd-3-clause | 2,177 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.