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 |
|---|---|---|---|---|---|
from __future__ import absolute_import
import six
from sentry.api.serializers import Serializer, register
from sentry.models import EventAttachment
@register(EventAttachment)
class EventAttachmentSerializer(Serializer):
def serialize(self, obj, attrs, user):
return {
"id": six.text_type(obj.... | beeftornado/sentry | src/sentry/api/serializers/models/eventattachment.py | Python | bsd-3-clause | 557 |
#!/usr/bin/env python
# encoding: utf-8
"""
##Posts
- `Id`
- `PostTypeId`
1. Question
2. Answer
3. Orphaned tag wiki
4. Tag wiki excerpt
5. Tag wiki
6. Moderator nomination
7. "Wiki placeholder" (seems to only be the [election description](http://stackoverflow.com/posts/8041931/body))
8. Privilege wiki
- `Accep... | davidlowryduda/SE-DataDump-DataViz | xmlparser.py | Python | gpl-3.0 | 2,652 |
import json
import logging
from analyticsclient.exceptions import ClientError, NotFoundError
from ddt import ddt
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.translation import ugettext_lazy as _
import httpretty
from mock import patch... | rue89-tech/edx-analytics-dashboard | analytics_dashboard/courses/tests/test_views/test_performance.py | Python | agpl-3.0 | 19,162 |
import six
from pubnub import utils
from pubnub.endpoints.endpoint import Endpoint
from pubnub.errors import PNERR_CHANNELS_MISSING, PNERR_GROUP_MISSING
from pubnub.exceptions import PubNubException
from pubnub.enums import HttpMethod, PNOperationType
from pubnub.models.consumer.channel_group import PNChannelGroupsAdd... | Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/pubnub/endpoints/channel_groups/add_channel_to_channel_group.py | Python | gpl-2.0 | 2,158 |
"""
Django settings for RobHome project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os... | burzillibus/RobHome | RobHome/settings.py | Python | mit | 4,113 |
"""Cache one or more files on all edge nodes."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
import click
@click.command()
@click.argument('account_id')
@click.argument('content_url', nargs=-1)
@environment.pass_env
def cli(env, account_id, content_url):
... | cloudify-cosmo/softlayer-python | SoftLayer/CLI/cdn/load.py | Python | mit | 468 |
#simply fibonacci recursive
#with dynamic programming
import timeit
s = 15;
def recursive(n):
if n < 3:
return n
return recursive(n-1)+recursive(n-2)
def climbStair(n):#python recursive generally is slower: 76s with DP
''' return nth fibonacci number
'''
seen = {1:1, 2:2} #initial condition for fibonacci
... | dramaticlly/Python4Interview | fiboDP.py | Python | mit | 1,452 |
import os
import numpy as np
import pandas as pd
import yaml
from typing import Collection
from .. import Dict
from pathlib import Path
from .general import (
remove_apostrophes,
construct_nesting_tree,
linear_utility_from_spec,
explicit_value_parameters,
apply_coefficients,
clean_values,
simple_simulate_data,
... | jpn--/larch | larch/util/activitysim/tour_mode_choice.py | Python | gpl-3.0 | 2,597 |
import pypuppetdb
import re
import datetime
class PuppetDB(object):
def __init__(self, puppetdb_host='puppetdb-prod', puppet_api_version=2):
self.pdb = pypuppetdb.connect(host=puppetdb_host, api_version=puppet_api_version)
super(PuppetDB, self).__init__()
def find_nodes(self, match_string):
... | nerd0/operator | common/puppetdb.py | Python | mit | 686 |
#!/usr/bin/env python3
# (C) Copyright 2014, Google Inc.
# (C) Copyright 2018, James R Barlow
# 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
# Unl... | jbarlow83/tesseract | src/training/tesstrain.py | Python | apache-2.0 | 4,301 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from api.api import entry_router
urlpatterns = patterns('',
url(r'^api/v1/', include(entry_router.urls)),
url(r'^api-explorer/', include('rest_framework_swagger.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| TangentMicroServices/AnalyticsService | analyticsservice/urls.py | Python | mit | 311 |
import unittest
from katas.kyu_7.satisfying_numbers import smallest
class SatisfyingNumbersTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(smallest(1), 1)
def test_equals_2(self):
self.assertEqual(smallest(2), 2)
def test_equals_3(self):
self.assertEqual(sma... | the-zebulan/CodeWars | tests/kyu_7_tests/test_satisfying_numbers.py | Python | mit | 845 |
from __future__ import unicode_literals
from slackapp import app
import json
import mock
@mock.patch('slackapp.SlackMessage')
def test_message(mock_message):
data = {
'message' : 'alpha',
'username' : 'bravo@esss.com.br',
'room' : 'delta',
}
data = json.dumps(data)
tester = a... | Kaniabi/gir | gir/_tests/pytest_slack.py | Python | gpl-2.0 | 655 |
import parmed as pmd
import pytest
from foyer import Forcefield
from foyer.tests.utils import get_fn
from foyer.utils.io import has_mbuild
@pytest.mark.timeout(1)
def test_fullerene():
fullerene = pmd.load_file(get_fn('fullerene.pdb'), structure=True)
forcefield = Forcefield(get_fn('fullerene.xml'))
forc... | iModels/foyer | foyer/tests/test_performance.py | Python | mit | 928 |
"""
Unit tests for conductor's fileresource module
"""
import os
from datetime import datetime
from calendar import monthrange
from nose.tools import eq_
from nose.plugins.skip import SkipTest
import mock
import conductor.fileresource
from conductor.resourcemover import LocalMover
class TestResourceSearchPath(obje... | conductorproject/conductor | tests/testfileresource.py | Python | agpl-3.0 | 4,852 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
#
# This program is free software: you c... | udayinfy/openerp-7.0 | gap_analysis_project/gap_analysis_project.py | Python | agpl-3.0 | 13,460 |
# stdlib
from pprint import pprint
import inspect
import os
import sys
# datadog
from config import get_checksd_path, get_confd_path
from util import get_os
def run_check(name, path=None):
"""
Test custom checks on Windows.
"""
# Read the config file
confd_path = path or os.path.join(get_confd_p... | huhongbo/dd-agent | utils/debug.py | Python | bsd-3-clause | 1,725 |
"""Test class for Host Group UI
:Requirement: Hostgroup
:CaseAutomation: Automated
:CaseComponent: HostGroup
:CaseLevel: Integration
:Assignee: okhatavk
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from fauxfactory import gen_string
from nailgun import entities
from robottelo.con... | lpramuk/robottelo | tests/foreman/ui/test_hostgroup.py | Python | gpl-3.0 | 6,794 |
#!/usr/bin/env python
import ctypes as ct
from ctypes import byref
import os
amberhome = os.environ['AMBERHOME']
libsaxs_dir = os.path.join(amberhome, "lib", "libsaxs.so")
plib = ct.cdll.LoadLibrary(libsaxs_dir)
print (plib)
| hainm/pysaxs | tests/template_libsaxs.py | Python | gpl-3.0 | 226 |
"""
homeassistant.components.automation.state
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Offers state listening automation rules.
For more details about this automation rule, please refer to the documentation
at https://home-assistant.io/components/automation/#state-trigger
"""
import logging
from homeassistant.helper... | nevercast/home-assistant | homeassistant/components/automation/state.py | Python | mit | 1,885 |
"""
We are running our http server which will host the twitter app.
After authentication, we get some twitter stream.
"""
import sys
from wrap2 import Twitter
import urlparse
import BaseHTTPServer
import webbrowser
from pprint import pprint
from itertools import islice
REDIRECT_URL = 'http://127.0.0.1:8080/'
networ... | paylogic/wrap2 | wrap2/examples/twitterlogin.py | Python | mit | 2,010 |
#!/usr/bin/env python
#=============================================================================
#
# File Name : Main.py
# Author : Pekeinfo <pekeinfo@gmaill.com>
# Creation Date : Jul 2014
#
#
#
#=============================================================================
#
# PROD... | pekeinfo/PeidSignaturenToYara | main.py | Python | bsd-3-clause | 2,915 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-12-25 06:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('RankList', '0002_auto_20161225_0607'),
]
operations = [
migrations.AlterFiel... | swjtuacmer/Ranker | Ranker/RankList/migrations/0003_auto_20161225_0612.py | Python | mit | 1,141 |
#!/usr/bin/env python2
# Copyright (C) 2014 Johannes Schwab
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This pr... | ddorian1/BitWeb | getPages.py | Python | gpl-3.0 | 28,569 |
# -*- coding: utf-8
""" RUR-PLE: Roberge's Used Robot - a Python Learning Environment
dialogs.py - dialogs, messages and exceptions used to communicate
with user.
Version 0.8.7
Author: Andre Roberge Copyright 2005
andre.roberge@gmail.com
"""
import os
import wx
from translation imp... | tectronics/rur-ple | rur_py/dialogs.py | Python | gpl-2.0 | 12,108 |
import getpass
import os
import pymysql
import pymysql.cursors
def connection(wiki,
defaults_file = os.path.expanduser("~/.my.cnf"),
user = getpass.getuser()):
return pymysql.connect(
host="analytics-store.eqiad.wmnet", #TODO: hard coded
database=wiki,
user=user,
read_default... | MuhammadShuaib/mwmetrics | mwmetrics/database.py | Python | mit | 387 |
#!/usr/bin/env python
# coding: utf-8
#
# __main__.py - Main driver for i2py.netdb.
from .netdb import inspect
def print_entry(ent):
print (ent)
if __name__ == '__main__':
inspect(hook=print_entry)
| chris-barry/i2py | i2py/netdb/__main__.py | Python | mit | 209 |
import sys
import imaplib
import modules.python_require_min_pyversion # checks for py >= 3.4, which we need for newer IMAP TLS support
import modules.match_emails as match_emails
from modules.settings.get_config import get_config
from modules.settings.default_counters_and_timers import create_default_timers, create_de... | TarquinQ/email-rule-enforcer | email-rule-enforcer/email_rule_enforcer.py | Python | gpl-3.0 | 4,280 |
"""Custom middlewares for the project."""
from __future__ import absolute_import
import re
from django.conf import settings
from django.core.mail import mail_managers
from django.http import HttpResponseRedirect
from django.utils.encoding import force_text
class AjaxRedirectMiddleware(object):
"""
Middleware... | bitmazk/django-libs | django_libs/middleware.py | Python | mit | 5,362 |
'''
This program is to normalize the feature vectors of the given matrices.
Note: feature file contains numbers of words per line that are described in the following format
word [space] freq1 freq2 freq3 ...
@usage:
Parameter list is described as following:
@param1: (N) number of files to normalize
@param2, ... | emvecchi/mss | src/utils/normalize/normalize_vectors.py | Python | apache-2.0 | 1,203 |
# Copyright(C) 2011,2012,2013,2014 by Abe developers.
# Copyright (c) 2010 Gavin Andresen
# This program 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, or (at your o... | Max-Coin/maxcoin-abe | Abe/util.py | Python | agpl-3.0 | 5,906 |
"""IF-ELSE constructs."""
from .stmt import HDLStatement
from .scope import HDLScope
from .expr import HDLExpression
from .signal import HDLSignal, HDLSignalSlice
class HDLIfElse(HDLStatement):
"""If-Else statement."""
def __init__(self, condition, if_scope=None, else_scope=None, **kwargs):
"""Initi... | brunosmmm/hdltools | hdltools/abshdl/ifelse.py | Python | mit | 3,201 |
# Copyright 2015 - Mirantis, 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 ag... | dennybaa/mistral | mistral/utils/javascript.py | Python | apache-2.0 | 1,500 |
"""
.. moduleauthor:: Edwin Tye <Edwin.Tye@phe.gov.uk>
To place everything about estimating the parameters of an ode model
under square loss in one single module. Focus on the standard local
method which means obtaining the gradient and Hessian.
"""
#__all__ = [] # don't really want to export this
... | etyephe/pygom | pygom/loss/base_loss.py | Python | gpl-2.0 | 60,283 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
http://integrals.wolfram.com/index.jsp
"""
from sympy import *
u, v = symbols('u v', real=True, positive=True)
y0, y1 = symbols('y0 y1', real=True, positive=True)
h0, h1 = symbols('h0 h1', real=True, positive=True)
a = Symbol('a', real=True, positive=True)
sigma = Sym... | heavywatal/edal | analysis/algebra.py | Python | mit | 1,564 |
import gevent.monkey; gevent.monkey.patch_all()
import handlers
import crons
import gevent.wsgi
def main():
http = gevent.wsgi.WSGIServer(('', 13429), handlers.app)
http.serve_forever()
if __name__ == '__main__': main()
| neuront/evetools | main.py | Python | mit | 230 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2011, Nicolas Clairon
# 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 abov... | klothe/mongokit | tests/test_migration.py | Python | bsd-3-clause | 15,671 |
#!/usr/bin/env python
# coding: utf-8
import commands
import json
import os
import time
defget_cpu_temp():
tempFile=open("/sys/class/thermal/thermal_zone0/temp")
cpu_temp=tempFile.read()
tempFile.close()
return float(cpu_temp)/1000
# Uncomment the next line if you want the temp in Fahrenheit
#... | masonyang/test | linux_temp.py | Python | gpl-3.0 | 868 |
from countershape import Page
pages = [
Page("anticache.html", "Anticache"),
Page("clientreplay.html", "Client-side replay"),
Page("filters.html", "Filter expressions"),
Page("upstreamproxy.html", "Upstream proxy mode"),
Page("setheaders.html", "Set Headers"),
Page("serverreplay.html", "Server-... | imiyoo2010/mitmproxy | doc-src/features/index.py | Python | mit | 649 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Tag.slug'
db.add_column('tagman_tag', 'slug',
self.gf('django.db.model... | Rethought/tagman | src/tagman/migrations/0002_auto__add_field_tag_slug__add_field_taggroup_slug.py | Python | bsd-3-clause | 1,925 |
"""anyconfig configobj backend module.
"""
from __future__ import absolute_import
from .configobj_ import Parser
__version__ = "0.1.4"
__all__ = ["Parser", ]
# vim:sw=4:ts=4:et:
| ssato/python-anyconfig-configobj-backend | src/anyconfig_configobj_backend/__init__.py | Python | mit | 180 |
import json
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.shortcuts import get_object_or_404
from .decorators import api_view
from .models import ProposalData, IRCLogLine
from pycon.models import (PyConTalkProposal, PyConTutorialProposal,
PyConLightningTalk... | njl/pycon | pycon/pycon_api/views.py | Python | bsd-3-clause | 17,433 |
# -*- coding: utf-8 -*-
"""ANT FS
A robust framework for transferring files wirelessly between devices.
Not implemented.
"""
##############################################################################
#
# Copyright (c) 2011, Martín Raúl Villalba
#
# Permission is hereby granted, free of charge, to any person obta... | mch/python-ant | src/ant/fs/__init__.py | Python | mit | 1,406 |
from amquery.core.distance import FFP_JSD, WEIGHTED_UNIFRAC
from amquery.core.preprocessing import KmerCounter, DummyPreprocessor
class Factory:
@staticmethod
def create(config):
"""
:param config: Config
:return: Preprocessor
"""
method = config.get('distance', 'metho... | nromashchenko/amquery | amquery/core/preprocessing/factory/_factory.py | Python | mit | 541 |
# Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from flask.ext.wtf import Form
from origae import utils
from origae.utils import subclass
@subclass
class ConfigForm(Form):
"""
A form used to display the network output as an image
"""
channe... | winnerineast/Origae-6 | origae/extensions/view/imageOutput/forms.py | Python | gpl-3.0 | 1,551 |
import re
from share.transform.chain import *
import share.transform.chain.links as tools
from share.transform.chain.utils import format_address
PROJECT_BASE_URL = 'https://projectreporter.nih.gov/project_info_description.cfm?aid={}'
FOA_BASE_URL = 'https://grants.nih.gov/grants/guide/pa-files/{}.html'
def filter_... | laurenbarker/SHARE | share/transformers/gov_nih.py | Python | apache-2.0 | 10,944 |
# -*- coding: utf-8 -*-
"""Python client for InfluxDB."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import gzip
import itertools
import io
import json
import random
import socket
import struct
im... | influxdb/influxdb-python | influxdb/client.py | Python | mit | 45,150 |
default_app_config = 'omero_mapr.apps.MaprAppConfig'
| aleksandra-tarkowska/omero-mapr | omero_mapr/__init__.py | Python | agpl-3.0 | 53 |
# coding: utf-8
from django.contrib.auth.models import Permission
from django.utils.translation import ugettext as _
from rest_framework import serializers
from rest_framework.fields import empty
from rest_framework.relations import HyperlinkedIdentityField
from rest_framework.reverse import reverse
from kpi.models.as... | kobotoolbox/kpi | kpi/serializers/v2/permission.py | Python | agpl-3.0 | 4,613 |
import unittest
import importlib
#source: http://stackoverflow.com/a/11158224/5343977
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
import ant_colony as module
class TestAntColonyUpdat... | kiran4399/beagleboat | com/opt/ant/test/test_ant_colony_update_pheromones.py | Python | mit | 12,095 |
#!/usr/bin/env python
from __future__ import print_function, unicode_literals
import os
import platform
import sys
from optparse import OptionParser
from random import choice
options = None
class SiteOptions(object):
copy_media = platform.system() == "Windows"
def create_settings():
if not os.path.exist... | sgallagher/reviewboard | contrib/internal/prepare-dev.py | Python | mit | 5,245 |
""" Contains the current version of transition which is used in setup.py and can also be used
to determine transitions's version during runtime.
"""
__version__ = '0.6.3'
| Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/transitions/version.py | Python | gpl-2.0 | 176 |
#! /usr/bin/env python
"""
This script produces the stacks for emission line luminosity limited samples.
python convert_stack_2_qmost_template.py
cp /data43s/SDSS/stacks/X_AGN/*stitched*
"""
### import modules used below
import os
import numpy as np
import astropy
from astropy.table import Table
from astropy.io i... | JohanComparat/pySU | galaxy/bin_eBOSS_ELG/convert_stack_2_qmost_template.py | Python | cc0-1.0 | 7,183 |
###
# Copyright (c) 2004, Jeremiah Fincher
# 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 conditi... | leamas/supybot-regexrelay | plugin.py | Python | bsd-3-clause | 3,346 |
"""
Телефонен указател
Задачата е да се напишат функции, които работят като телефонен указател.
Телефонният указател трябва да се съхранява във файл.
Телефоните се представят като речник с две полете:
- `name` - име на човек
- `phone` - телефоне номер
Например:
{
'name': 'Ivan',
'phone': '... | YAtOff/python0-reloaded | projects/hard/phonebook/phonebook.py | Python | mit | 5,283 |
#
# This file is part of Bakefile (http://bakefile.org)
#
# Copyright (C) 2008-2013 Vaclav Slavik
#
# 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... | vslavik/bakefile | src/bkl/dumper.py | Python | mit | 4,479 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This progam (as part of SHEAR) searches adapter sequences
and generates an adapter file for use with SHEAR/Scythe.
"""
import sys
import os
import argparse
import re
import gzip
_LICENSE = """
SHEAR: Simple Handler for Error and Adapter Removal
James B. Pease
http://... | jbpease/shear | adapt.py | Python | gpl-3.0 | 13,208 |
# Copyright (c) 2017 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from pycroft.model.base import IntegerIdModel
from sqlalchemy import Column, func, LargeBinary
from pycroft.mod... | agdsn/pycroft | pycroft/model/webstorage.py | Python | apache-2.0 | 732 |
import sys, os
import vecrec
## General
project = u'vecrec'
copyright = u'2015, Kale Kundert'
version = vecrec.__version__
release = vecrec.__version__
master_doc = 'index'
source_suffix = '.rst'
templates_path = ['templates']
exclude_patterns = ['build']
default_role = 'any'
pygments_style = 'sphinx'
## Extensions... | kxgames/vecrec | docs/conf.py | Python | mit | 857 |
import sys, os, re
arguments_count = len(sys.argv)
if(arguments_count > 3):
TESTS_PATH = sys.argv[3]
elif(arguments_count == 1):
sys.exit("pyhton prepare_task INPUT_FILE TASK_NUMBER TESTS_DIR (optional)")
FILE_PATH = sys.argv[1]
TASK_NUMBER = sys.argv[2]
TESTS_DIR = "../testing"
COMMENT = "/**\n * \n * Solution ... | ILIYANGERMANOV/fmi-programming | up_homework_3/ready_for_submission/prepare_task.py | Python | gpl-3.0 | 1,387 |
import time
import unittest
from datetime import date, datetime
from django.core.exceptions import FieldError
from django.db import connection, models
from django.test import SimpleTestCase, TestCase, override_settings
from django.test.utils import register_lookup
from django.utils import timezone
from .models import... | theo-l/django | tests/custom_lookups/tests.py | Python | bsd-3-clause | 24,898 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
determine_ext,
)
class GolemIE(InfoExtractor):
_VALID_URL = r'^https?://video\.golem\.de/.+?/(?P<id>.+?)/'
_TEST = {
'url':... | oskar456/youtube-dl | youtube_dl/extractor/golem.py | Python | unlicense | 2,209 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# 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... | cyberark-bizdev/ansible | lib/ansible/modules/cloud/vmware/vmware_host_dns_facts.py | Python | gpl-3.0 | 4,010 |
from ludicrous.GeneratedLevel import GeneratedLevel
import random,math
__copying__="""
Written by Thomas Hori
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/."""
c... | thomas-hori/Repuge-NG | prelevula/SimpleDungeonLevel.py | Python | mpl-2.0 | 6,565 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Classified.visits'
db.add_column('main_classifieds', 'visits',
self.gf... | joni2back/classijango | src/main/migrations/0002_add_field_Classified_visits.py | Python | mit | 8,780 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... | pmghalvorsen/gramps_branch | gramps/test/test/test_util_test.py | Python | gpl-2.0 | 7,365 |
from dask.local import get_sync
from dask.threaded import get as get_threaded
from dask.callbacks import Callback
from dask.utils_test import add
def test_start_callback():
flag = [False]
class MyCallback(Callback):
def _start(self, dsk):
flag[0] = True
with MyCallback():
get... | ContinuumIO/dask | dask/tests/test_callbacks.py | Python | bsd-3-clause | 2,534 |
""" A component that designates a wire. """
from graph import Node, Edge
from constraint import Constraint
class Wire(object):
""" Wire component """
def __init__(self, graph, node_a=None, node_b=None, edge_i=None):
""" Initializes a wire with two nodes. Current goes from
A to B. If nodes /... | ThatSnail/impede | impede-app/server/py/wire.py | Python | mit | 2,414 |
"""
Support for the Daikin HVAC.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.daikin/
"""
import logging
import re
import voluptuous as vol
from homeassistant.components.climate import (
ATTR_CURRENT_TEMPERATURE, ATTR_FAN_MODE, ATTR_OPERA... | PetePriority/home-assistant | homeassistant/components/daikin/climate.py | Python | apache-2.0 | 8,393 |
import logging
import sys
import time
import traceback
from weakref import WeakValueDictionary
import bs4
from selenium import webdriver
from app.services import slack
from app.utils import db
class BaseScraper(object):
""" Abstract class for implementing a datasource. """
_instances = WeakValueDictionary... | remysaissy/paris-immo-finder | app/scrapers/base_scraper.py | Python | gpl-3.0 | 6,157 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | jcftang/ansible-modules-extras | cloud/amazon/ec2_asg_facts.py | Python | gpl-3.0 | 11,503 |
#!/opt/google/gepython/Python-2.7.5/bin/python
#
# Copyright 2017 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 re... | iparanza/earthenterprise | earth_enterprise/src/support/set_geecheck_config.py | Python | apache-2.0 | 1,176 |
#!/usr/bin/env python3
"""Unit tests for the keyword only argument specified in PEP 3102."""
__author__ = "Jiwon Seo"
__email__ = "seojiwon at gmail dot com"
import unittest
from test.support import run_unittest
def posonly_sum(pos_arg1, *arg, **kwarg):
return pos_arg1 + sum(arg) + sum(kwarg.values()... | theheros/kbengine | kbe/res/scripts/common/Lib/test/test_keywordonlyarg.py | Python | lgpl-3.0 | 6,536 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-container | google/cloud/container_v1beta1/services/cluster_manager/async_client.py | Python | apache-2.0 | 176,664 |
# Only import from .form_handlers module to ensure backwards compatibility.
# Importing from .form_wizard_handlers module should be done explicitly.
from .form_handlers import *
| mansonul/events | events/contrib/plugins/form_handlers/db_store/urls/__init__.py | Python | mit | 178 |
import sys
def main():
n = 0
sizeTot = 0.0
timeTot = 0.0
for line in sys.stdin:
if "Finished in " in line:
n += 1
timeTot += float(line.split()[4])
print n
if "Size" in line:
sizeTot += float(line.split()[3])
print "AvgSize: %lf" % (... | henrycg/prio | eval/recover.py | Python | isc | 392 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | stackforge/solum | solum/i18n.py | Python | apache-2.0 | 830 |
from unittest import TestCase, main
from test_utils import *
import tempfile, os
from dirmanager import DirManager
class TestDirManager(TestSetup):
def test_found_entry(self):
dirManager = DirManager()
dirManager.add_directory(test_dir)
ans = dirManager.found_entry(dot)
self.assert... | cristianowa/restplayer | tests/test_dirmanager.py | Python | mit | 2,045 |
"""
Creating standalone Django apps is a PITA because you're not in a project, so
you don't have a settings.py file. I can never remember to define
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
automatically.
"""
import functools
import os
from fabric.api import local as _local
NAME = os.pa... | ConsumerAffairs/django-affect | fabfile.py | Python | bsd-3-clause | 1,542 |
import sys
import numpy
from beampy import String
from beampy import Product
from beampy import ProductData
from beampy import ProductIO
from beampy import ProductUtils
if len(sys.argv) != 2:
print("usage: %s <file>" % sys.argv[0]);
sys.exit(1)
# Uncomment if you receive errors of type com.sun.media.jai.uti... | bcdev/beam | beam-python/src/main/resources/beampy-examples/beampy_flh.py | Python | gpl-3.0 | 1,866 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... | WoLpH/EventGhost | eg/WinApi/Dynamic/Mmsystem.py | Python | gpl-2.0 | 11,993 |
import sys
import json
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_import as h2i, h2o_args
#
# This is intended to be the simplest possible RF example.
# Look at sandbox/commands.log for REST API requests to H2O.
#
print "--------------------------------------------------------------------------------... | h2oai/h2o | py/testdir_single_jvm/rf_simple_example.py | Python | apache-2.0 | 1,659 |
#!/usr/local/bin/python3
from pipeline import experiment, pupil
import logging
import datajoint as dj
## database logging code
logging.basicConfig(level=logging.ERROR)
logging.getLogger('datajoint.connection').setLevel(logging.DEBUG)
if hasattr(dj.connection, 'query_log_max_length'):
dj.connection.query_log_max_l... | cajal/pipeline | python/scripts/populate-mcl-pupil-minion.py | Python | lgpl-3.0 | 434 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
i_gensigset.py
--------------
Date : March 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
*********************************... | AsgerPetersen/QGIS | python/plugins/processing/algs/grass7/ext/i_gensigset.py | Python | gpl-2.0 | 1,955 |
import sys, string, os, re
from distutils.core import setup
# we need to ask the user information about his cell
if len(sys.argv) == 2 :
if sys.argv[1] == "install" :
print "Configuration of afspy-module..."
doModify=raw_input("Do you want to modify the config file afs/etc/afspy.cfg ? [y/N]")
... | openafs-contrib/afspy | setup.py | Python | bsd-2-clause | 7,520 |
from models import *
def create_ap_data(
router_mac=Mac('11:12:13:14:15:16'),
device_mac=Mac('A1:A2:A3:A4:A5:A6'),
created_at=Time(1),
rssis={ '1': RSSI(-20) },
signal=Signal(channel=2, band='2.4')
):
return APData(
router_mac=router_mac,
device_mac=devi... | maveron58/indiana | test/factory.py | Python | mit | 1,012 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010-2015, 2degrees Limited.
# All Rights Reserved.
#
# This file is part of django-wsgi <https://github.com/2degrees/django-wsgi/>,
# which is subject to the provisions of the BSD at
# <http://dev.2... | 2degrees/twod.wsgi | django_wsgi/exc.py | Python | bsd-3-clause | 1,134 |
# -*- coding: utf-8 -*-
import cStringIO
import contextlib
import datetime
import hashlib
import inspect
import itertools
import logging
import math
import mimetypes
import unicodedata
import os
import re
import urlparse
from PIL import Image
from sys import maxint
import werkzeug
# optional python-slugify import (ht... | fdvarela/odoo8 | addons/website/models/website.py | Python | agpl-3.0 | 32,846 |
# -*- coding: utf-8 -*-
##Copyright (C) [2003] [Jürgen Hamel, D-32584 Löhne]
##This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
##published by the Free Software Foundation; either version 3 of the License, or (at your option) any later versio... | CuonDeveloper/cuon | cuon_client/CUON/cuon/Garden/SingleHibernation.py | Python | gpl-3.0 | 2,517 |
import os
from importlib import import_module
from django.apps import apps
from django.db.migrations.loader import MigrationLoader
from django.db.migrations.serializer import serializer_factory
from django.db.models import ForeignKey, ManyToManyField
from django.utils.inspect import get_func_args
from django.utils.mod... | moodpulse/l2 | reports/management/mw.py | Python | mit | 8,901 |
from django.db import models
from django.contrib import admin
from django.conf import settings
from rest_framework import serializers
from cms.models.Base import BaseModel
from cms.models.Game import Game
from cms.utils.Utils import getUploadPath
class Affiliation(BaseModel):
name = models.CharField(max_length=32, d... | tehdiplomat/hidden-role-games | masq/cms/models/Affiliation.py | Python | mit | 1,103 |
#!/usr/bin/env python
oosmos_dir = '../../..'
import sys
sys.path.append(oosmos_dir)
import oosmos
prt_c = oosmos_dir+'/Classes/prt.c'
threadyieldtest_c = oosmos_dir+'/Classes/Tests/threadyieldtest.c'
oosmos_c = oosmos_dir+'/Source/oosmos.c'
oosmos.cLinux.Compile(oosmos_dir, 'main', ['../Window... | oosmos/oosmos | Examples/ThreadYield/Linux/bld.py | Python | gpl-2.0 | 366 |
# 5x7 font data, all ASCII printable char, starts at ASCII 0x20.
# From http://www.solorb.com/elect/hamcirc/tonewriter/fontprint.py
# fontprint - define a 5x7 font and print it.
#
# March 5, 2013 G. Forrest Cook
# Released under the GPLv3 license.
# Note: Characters are sideways
fonttable = [
0x00, 0x00, 0x00, 0x00,... | kwurst/generate-perceptron-data | fonttable.py | Python | gpl-3.0 | 3,176 |
"""Perform unconstrained or constrained optimisation."""
from equadratures.basis import Basis
from equadratures.poly import Poly
from equadratures.parameter import Parameter
from scipy import optimize
import numpy as np
from scipy.special import comb, factorial
import warnings
warnings.filterwarnings('ignore')
... | psesh/Effective-Quadratures | equadratures/optimisation.py | Python | mit | 25,773 |
from django.http import HttpResponse, HttpResponseRedirect, get_host
from django.shortcuts import render_to_response as render
from django.template import RequestContext
from django.conf import settings
import md5, re, time, urllib
from openid.consumer.consumer import Consumer, \
SUCCESS, CANCEL, FAILURE, SETUP_NE... | pombreda/django-hotclub | apps/local_apps/django_openidconsumer/views.py | Python | mit | 6,422 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013-2014 Bryan Hundven
#
# This file is part of pyfastboot.
#
# pyfastboot 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 y... | bhundven/pyfastboot | fastboot/reboot.py | Python | gpl-2.0 | 1,541 |
#
# 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... | airbnb/airflow | airflow/providers/google/cloud/hooks/functions.py | Python | apache-2.0 | 10,095 |
"""
Base class for all controlunit implementations
"""
import re
from raspyrfm_client.device_implementations.controlunit.actions import Action
from raspyrfm_client.device_implementations.controlunit.controlunit_constants import ControlUnitModel
from raspyrfm_client.device_implementations.manufacturer_constants import... | markusressel/raspyrfm-client | raspyrfm_client/device_implementations/controlunit/base.py | Python | gpl-3.0 | 2,659 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | dennisobrien/bokeh | bokeh/command/subcommands/svg.py | Python | bsd-3-clause | 5,146 |
# pylint: disable=too-few-public-methods, no-self-use, unused-argument
# This evaluator here is just an ugly hack to work with perplexity runner
from neuralmonkey.evaluators.evaluator import Evaluator
class AverageEvaluator(Evaluator[float]):
"""Just average the numeric output of a runner."""
def score_insta... | ufal/neuralmonkey | neuralmonkey/evaluators/average.py | Python | bsd-3-clause | 403 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.