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 |
|---|---|---|---|---|---|
"""Tests for 1-Wire sensor platform."""
from unittest.mock import MagicMock, patch
import pytest
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.config_validation import ens... | aronsky/home-assistant | tests/components/onewire/test_sensor.py | Python | apache-2.0 | 3,318 |
# -*- coding: utf-8 -*
from django.views.generic.edit import CreateView
from person.models import Person
from person.forms import PersonForm
from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout
from django.shortcuts import render_to_response, redirect
from django.template import Req... | ramonsaraiva/sgce | sgce/person/views.py | Python | mit | 1,162 |
import os
from .input import VaspInput
__author__ = "Guillermo Avendano-Franco"
__copyright__ = "Copyright 2016"
__version__ = "0.1"
__maintainer__ = "Guillermo Avendano-Franco"
__email__ = "gtux.gaf@gmail.com"
__status__ = "Development"
__date__ = "May 13, 2016"
def read_incar(filename='INCAR'):
"""
Load t... | MaterialsDiscovery/PyChemia | pychemia/code/vasp/incar.py | Python | mit | 1,272 |
import json
import os
from Bio import Entrez
from six import StringIO
Entrez.tool = "GalaxyEutils_1_0"
BATCH_SIZE = 200
class Client(object):
def __init__(self, history_file=None, user_email=None, admin_email=None):
self.using_history = False
if user_email is not None and admin_email is not No... | bimbam23/tools-iuc | tools/ncbi_entrez_eutils/eutils.py | Python | mit | 4,080 |
#!/usr/bin/env python
import sys
import threading
import urlparse
import urllib2
import BaseHTTPServer
import unittest
import hashlib
from test import test_support
# Loopback http server infrastructure
class LoopbackHttpServer(BaseHTTPServer.HTTPServer):
"""HTTP server w/ a few modifications that make it useful ... | mancoast/CPythonPyc_test | cpython/254_test_urllib2_localnet.py | Python | gpl-3.0 | 10,390 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-07 09:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('transaction', '0001_initial'),
]
operations = [
migrations.AlterField(
... | pythonvietnam/nms | apps/transaction/migrations/0002_auto_20160607_0949.py | Python | mit | 477 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typi... | Azure/azure-sdk-for-python | sdk/storage/azure-storage-blob/azure/storage/blob/_shared/request_handlers.py | Python | mit | 10,014 |
# Name: CDate.py
# Purpose: Date and Calendar classes
#
# Author: Lorne White (email: lwhite1@planet.eon.net)
#
# Created:
# Version 0.2 08-Nov-1999
# Licence: wxWindows license
#----------------------------------------------------------------------------
# Updated: 01-Dec-2004
# Acti... | garrettcap/Bulletproof-Backup | wx/lib/CDate.py | Python | gpl-2.0 | 3,804 |
from matplotlib import pyplot as plt
import numpy as np
def latin_square(size):
el = range(size)
return np.array([[el[i - j] for i in el] for j in el])
#return np.array([[el[i - j] for i in el] for j in range(size, 0, -1)])
def unique_cards(array):
cards = []
for r in array:
l = set(r)
if l not in cards:
... | oOo0oOo/CommonCards | first.py | Python | mit | 757 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Image.shortuuid'
db.alter_column(u'articles_image', 'shortuuid', self.gf('core.fields.Sho... | megaprojectske/megaprojects.co.ke | megaprojects/articles/migrations/0008_auto__del_field_article_drupal_id.py | Python | apache-2.0 | 8,710 |
"""
Development tool utilities
"""
__copyright__ = '2013 Room 77, Inc.'
__author__ = 'Kyle Konrad <kyle@room77.com>'
import inspect
import warnings
def deprecated(message):
def deprecate(obj):
class_or_func = 'class' if inspect.isclass(obj) else 'function'
warnings.warn('Use of deprecated %s %s: %s' % (cla... | room77/py77 | pylib/util/dev.py | Python | mit | 425 |
from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app
__all__ = ['celery_app'] | berylTechnologies/redcap | redcap/__init__.py | Python | gpl-3.0 | 121 |
"""Common code for Withings."""
import asyncio
from dataclasses import dataclass
import datetime
from datetime import timedelta
from enum import Enum, IntEnum
import logging
import re
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from aiohttp.web import Response
import requests
from withings_api... | turbokongen/home-assistant | homeassistant/components/withings/common.py | Python | apache-2.0 | 34,960 |
import os
import sys
import json
import imp
from copy import copy
from importlib import import_module
import inflect
from jinja2 import Environment, PackageLoader
from finny.command import Command
class GenerateEndpoint(Command):
def __init__(self):
self.pluralize = inflect.engine()
def _touch(self, file... | hurrycane/finny | finny/commands/generate_endpoint.py | Python | mit | 2,628 |
## @file
# This is an XML API that uses a syntax similar to XPath, but it is written in
# standard python so that no extra python packages are required to use it.
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the... | carmark/vbox | src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py | Python | gpl-2.0 | 7,215 |
# jsb/wave/bot.py
#
#
""" google wave bot. """
## jsb imports
from jsb.lib.persist import Persist
from jsb.lib.botbase import BotBase
from jsb.lib.plugins import plugs
from jsb.lib.version import getversion
from jsb.lib.callbacks import callbacks
from jsb.lib.outputcache import add
from jsb.lib.config import Config
... | melmothx/jsonbot | jsb/lib/gae/wave/bot.py | Python | mit | 8,455 |
class NodeLabels:
TYPE = 'node_type'
CONNECTION_TYPE = 'connection_type'
EQUIPMENT = 'equipment'
# igraph require 'label', do not change the string value
LABEL = 'label'
# igraph require 'color', do not change the string value
COLOR = 'color'
# igraph require 'name', do not change the string value
NAM... | pozar87/apts | apts/constants/nodelabels.py | Python | apache-2.0 | 330 |
from twisted.internet.threads import deferToThread
import scrapy.statscollectors
import statsd
import six
class StatsDStatsCollector(scrapy.statscollectors.MemoryStatsCollector):
"""
Send all the stats to the statsd server in a thread. This is to ensure
the UDP packet which is sent doesn't hold up the main... | vinayan3/scrapy-statsd | scrapy_statsd/statscollectors.py | Python | mit | 2,853 |
#!/usr/bin/env python2.7
#
# Copyright (C) 2016 INRA
#
# 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 program ... | geraldinepascal/FROGS | assessment/bin/grinder2biom.py | Python | gpl-3.0 | 7,610 |
from libcloud.dns.base import Record
from lib.actions import BaseAction
__all__ = [
'DeleteDNSRecordAction'
]
class DeleteDNSRecordAction(BaseAction):
api_type = 'dns'
def run(self, credentials, record_id):
driver = self._get_driver_for_credentials(credentials=credentials)
record = Reco... | Aamir-raza-1/st2contrib | packs/libcloud/actions/delete_dns_record.py | Python | apache-2.0 | 650 |
import os
import logging
from subprocess import Popen, PIPE
def which(prog):
""" Equivalent of unix which command """
def is_exe(fpath):
return os.path.exists(fpath) and os.access(fpath, os.X_OK)
paths = os.environ["PATH"].split(os.pathsep)
paths.append(".")
fpath, fname = os.path.split(p... | JustinHop/volti | src/volti/utils.py | Python | gpl-3.0 | 2,166 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import render_template, redirect, url_for, abort, flash, request, current_app,make_response
from flask_login import login_required, current_user
from datetime import datetime
from . import index
from .. import db
from ..models import Permission, KeyValue
from ..... | 8cbx/OnlineJudge_Web | app/index/views.py | Python | agpl-3.0 | 2,174 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2019 Compassion CH (http://www.compassion.ch)
# @author: Nicolas Badoux <n.badoux@hotmail.com>
#
# The licence is in the file __manifest__.py
#
##############################################... | eicher31/compassion-modules | mobile_app_connector/models/firebase_registration.py | Python | agpl-3.0 | 5,487 |
from django.contrib import admin
from .models import StaticPage
from django.utils.translation import ugettext_lazy as _
from .forms import StaticpageForm
from main import opengain_admin
from modeltranslation.admin import TabbedTranslationAdmin
@admin.register(StaticPage, site=opengain_admin)
class StaticPageAdmin(Tab... | null-none/OpenGain | default_set/staticpages/admin.py | Python | gpl-2.0 | 646 |
#
# The Python Imaging Library.
# $Id$
#
# PIL raster font management
#
# History:
# 1996-08-07 fl created (experimental)
# 1997-08-25 fl minor adjustments to handle fonts from pilfont 0.3
# 1999-02-06 fl rewrote most font management stuff in C
# 1999-03-17 fl take pth files into account in load_path (from Rich... | bzennn/blog_flask | python/lib/python3.5/site-packages/PIL/ImageFont.py | Python | gpl-3.0 | 20,716 |
# @lint-avoid-pyflakes2
# @lint-avoid-python-3-compatibility-imports
import asyncio
import functools
import logging
from io import BytesIO
import struct
import warnings
from .TServer import TServer, TServerEventHandler, TConnectionContext
from thrift.Thrift import TProcessor
from thrift.transport.TTransport import TM... | jesboat/fbthrift | thrift/lib/py/server/TAsyncioServer.py | Python | apache-2.0 | 9,957 |
#!/usr/bin/env python
# Class defitions for generic Atlas measurement statistics
# These are base classes which group functionality common to all
# measurement types (ping, traceroute, ...)
# statistics are collected at three levels:
#
# first the raw per probe, per target IP data
# second the aggregate over all prob... | RIPE-Atlas-Community/RIPE-Atlas-data-analysis | ripeatlas/analysis/msmstats.py | Python | lgpl-3.0 | 7,115 |
# Copyright 2013-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | americanstone/mongo-connector | tests/test_mongo.py | Python | apache-2.0 | 12,277 |
# -*- coding: utf-8 -*-
"""
sphinx.directives
~~~~~~~~~~~~~~~~~
Handlers for additional ReST directives.
:copyright: 2007-2008 by Georg Brandl.
:license: BSD.
"""
import re
import sys
import string
import posixpath
from os import path
from docutils import nodes
from docutils.parsers.rst import d... | creasyw/IMTAphy | documentation/doctools/tags/0.2/sphinx/directives.py | Python | gpl-2.0 | 31,058 |
__author__ = 'carpedm20'
__date__ = '2014.07.25'
from scrapy.spider import BaseSpider
# http://movie.naver.com/movie/sdb/rank/rmovie.nhn?sel=cnt&date=20050207&tg=0
from scrapy.item import Item, Field
class Movie(Item):
name = Field()
url = Field()
rank = Field()
date = Field()
#tgs = range(20)
#tgs... | carpedm20/voxoffice | scrapy/tutorial/spiders/people.py | Python | bsd-3-clause | 1,642 |
# -*- coding: utf-8 -*-
__author__ = 'yueli'
import pprint
from config.config import *
import resolver_comparator
import logging
# 借助第三方 package: netaddr来实现 IP subnetwork的排序
from netaddr import *
import re
import timeit
import datetime
# 定义一个排序函数,使得作为key的EID可以从小到大排列,作为value的Mapping entry list内部也可以按照从小到大排列
def sort_di... | hansomesong/TracesAnalyzer | mapping_entry_grouper.py | Python | gpl-2.0 | 9,173 |
import os
import logging
import logging.config
log = logging.getLogger(__file__)
from ott.utils import file_utils
from ott.utils import object_utils
from ott.utils import web_utils
from ott.utils.cache_base import CacheBase
from ott.loader.gtfs.info import Info
from ott.loader.gtfs.diff import Diff
class GtfsCache... | LACMTA/loader | ott/loader/gtfs/gtfs_cache.py | Python | mpl-2.0 | 4,663 |
__all__ = ['flatpages']
| tungvx/deploy | Django-0.90/django/contrib/flatpages/models/__init__.py | Python | apache-2.0 | 24 |
"""
Linalg tests.
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import scipy.linalg as sla
import numpy.testing as nt
from mwhutils.linalg import chol_update
def test_chol_update():
"""Test the incremental cholesky decomposit... | mwhoffman/mwhutils | tests/test_linalg.py | Python | bsd-2-clause | 665 |
from __future__ import absolute_import
import pytest
from sentry.api.paginator import (
Paginator, DateTimePaginator, OffsetPaginator
)
from sentry.models import User
from sentry.testutils import TestCase
class PaginatorTest(TestCase):
cls = Paginator
def test_max_limit(self):
self.create_user(... | JamesMura/sentry | tests/sentry/api/test_paginator.py | Python | bsd-3-clause | 3,176 |
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import logging
import textwrap
import portage
from portage import os
from portage.util import writemsg_level
def show_invalid_depstring_notice(parent_node, depstring, error_msg):
msg1 = "\n\n!!! Invalid or cor... | fastinetserver/portage-idfetch | pym/_emerge/show_invalid_depstring_notice.py | Python | gpl-2.0 | 1,425 |
import cv2
def detect(path):
img = cv2.imread(path)
cascade = cv2.CascadeClassifier("xml/face.xml")
rects = cascade.detectMultiScale(img, 1.3, 4, cv2.cv.CV_HAAR_SCALE_IMAGE, (20,20))
if len(rects) == 0:
return [], img
rects[:, 2:] += rects[:, :2]
return rects, img
def box(rects, img):... | powderblock/glasses-cv | faceDetect.py | Python | mit | 526 |
version = __version__ = '1.4.4'
authors = __authors__ = 'Sophia Borowka, Gudrun Heinrich, Stephan Jahn, Stephen Jones, Matthias Kerner, Johannes Schlenk, Tom Zirke'
from subprocess import check_output as shell_call
import os
# The following line is replaced by `setup.py` --> hard-code the commit id in distributions
gi... | mppmu/secdec | pySecDec/metadata.py | Python | gpl-3.0 | 563 |
# Generated by Django 3.1.7 on 2021-03-31 20:47
import time
from datetime import timedelta
from django.conf import settings
from django.db import migrations, transaction
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def set_expiry_date_for_exi... | rht/zulip | confirmation/migrations/0009_confirmation_expiry_date_backfill.py | Python | apache-2.0 | 2,610 |
"""
Module that provides a connection to the ModuleStore specified in the django settings.
Passes settings.MODULESTORE as kwargs to MongoModuleStore
"""
from __future__ import absolute_import
from importlib import import_module
import logging
import re
from django.conf import settings
# This configuration must be ... | simbs/edx-platform | common/lib/xmodule/xmodule/modulestore/django.py | Python | agpl-3.0 | 10,629 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext_lazy as _
from shuup... | suutari/shoop | shuup/campaigns/admin_module/sections.py | Python | agpl-3.0 | 1,237 |
"""
Test the publish code (mostly testing that publishing doesn't result in orphans)
"""
from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.modulestore.tests.test_split_w_old_mongo import SplitWMongoCourseBoostrapper
from xmodule.modulestore.tests.factories import check_mongo_calls
from xmodule.m... | epam-mooc/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/test_publish.py | Python | agpl-3.0 | 6,998 |
from PyQt4 import QtCore, QtGui
from sportshelper import *
from scoreboard import *
import os
#This module allows users to view Purdue football scores for the whole season
#as well as the teams record after each games and the start times and dates
#for future games
class SportsView(object):
def setupUi(self, Dial... | swanson/purdue-kiosk | sportsview.py | Python | bsd-3-clause | 3,234 |
# coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import sqlalchemy
import ckan.plugins.toolkit as toolkit
import ckan.lib.dictization.model_dictize as model_dictize
from ckan.logic import NotAuthorized
import logging
log = logging.getLogger(__name__)
from sqlalchemy import Column, String, ... | CBNU-BigDataLab/ckanext-theme | ckanext/theme/logic/action/create.py | Python | agpl-3.0 | 1,426 |
import dicom, os
try:
import cv2
except ImportError as E:
import cv as cv2
import numpy as np
def save_png(grid, path):
grid = np.array([[[px,px,px]for px in row] for row in grid])
cv2.imwrite(path, grid)
def extract_grid(dicom_path, normalize=True, maxval=255.0):
with open(dicom_path, 'rb') ... | lennin92/peppers | utils/dcm.py | Python | gpl-3.0 | 934 |
#! /usr/bin/python
from board import *
import random
import opc, time
client = opc.Client('localhost:7890')
length = 30
height = 23
#color = (0,80,140)
#color = (102,20,153)
color = (210,240,80)
colors = ((255,10,10),(10,255,20))
#ruleset = [[1, 1, 1, 1, 1, 1, 1, 1, 1],
# [1, 1, 1, 1, 1, 1, 1, 1, 1]]
rul... | GGreenwood/CellVi | automata.py | Python | gpl-2.0 | 1,617 |
"""
Various InferenceProcedures for use with the DBM class.
"""
__authors__ = ["Ian Goodfellow", "Vincent Dumoulin"]
__copyright__ = "Copyright 2012-2013, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
import functools
import logging
from theano.compa... | JazzeYoung/VeryDeepAutoEncoder | pylearn2/pylearn2/models/dbm/inference_procedure.py | Python | bsd-3-clause | 58,299 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | v-iam/azure-sdk-for-python | azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/protected_item_resource_paged.py | Python | mit | 926 |
# Flexlay - A Generic 2D Game Editor
# Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
#
# 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)... | SuperTux/flexlay | flexlay/commands/object_transform_command.py | Python | gpl-3.0 | 911 |
import warnings
import numpy
from sacred.dependencies import get_digest
from sacred.observers import RunObserver
import wandb
class WandbObserver(RunObserver):
"""Logs sacred experiment data to W&B.
Arguments:
Accepts all the arguments accepted by wandb.init()
name — A display name for this ... | wandb/client | wandb/integration/sacred/__init__.py | Python | mit | 5,783 |
#!/usr/bin/env python
import os
from argparse import ArgumentParser
from moviepy.editor import VideoFileClip
import numpy as np
from PIL import Image
from tqdm import tqdm
def frange(x, y, inc):
while x < y:
yield x
x += inc
def average_video(filepath, outpath, start=None, end=None, sample_ever... | nicodv/bgg | film/frameprocessor.py | Python | mit | 2,915 |
import os, json
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
PORT = os.getenv('PORT', '5000')
vcap_services = os.getenv("VCAP_SERVICES")
if not vcap_services:
raise BaseException(
'Environment variable VCAP_SERVICES was not found.\n' +
... | snowch/movie-recommender-demo | web_app/config.py | Python | apache-2.0 | 2,341 |
#!/usr/bin/env python3
import sys
from PyQt5.QtWidgets import QApplication, qApp
from yozik.ui import MainWindowController, MainWindow
if __name__ == '__main__':
app = QApplication(sys.argv)
qApp.setApplicationDisplayName("Yozik")
qApp.setApplicationName("Yozik")
w = MainWindow()
c = MainWindowCo... | vminakov/yozik | run.py | Python | mit | 372 |
# Copyright 2017~ mengalong <alongmeng@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | mengalong/bter | bter/tests/unit/storage/test_mysql.py | Python | apache-2.0 | 2,726 |
from __future__ import absolute_import, division, print_function
import json
from toolz import map, partial
import gzip
from .resource import resource
__all__ = 'resource',
@resource.register('.*\.json')
def resource_json(uri, open=open):
f = open(uri)
try:
data = json.load(f)
f.close()
... | vitan/blaze | blaze/json.py | Python | bsd-3-clause | 566 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Alen Komic
#
# 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 opti... | kustodian/ansible | lib/ansible/modules/monitoring/zabbix/zabbix_proxy.py | Python | gpl-3.0 | 14,159 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation;... | tp81/openmicroscopy | components/tools/OmeroPy/test/unit/gatewaytest/test_argument_errors.py | Python | gpl-2.0 | 1,789 |
"""
Django settings for interview_voting project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
imp... | VRSandeep/icrs | interview_voting/settings.py | Python | mit | 4,339 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from cms.models import CMSPlugin, Page
from cms.models.fields import PageField
from filer.fields.file import FilerFileField
DEFULT_LINK_STYLES = (
(" ", "Default"),
)
LINK_STYLES = getattr(setting... | pbs/cmsplugin-filer | cmsplugin_filer_link/models.py | Python | bsd-3-clause | 1,306 |
#!/usr/bin/env python
import nltk
import os
import sys
import include
title = sys.argv[1].lower()
html = sys.argv[2].lower()
cate_id = sys.argv[3]
def do_read_train(uni_dict, bi_dict, file):
lines = file.readlines()
for line in lines:
words = line.split()
bi_dict[words[0]] = int(words[2])
uni_dict[words[0].s... | jiayisuse/cs73 | wp-admin/data_delete.py | Python | gpl-2.0 | 2,483 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
import re
import time
import traceback
from functools import wraps
import six
from slackbot.manager import PluginsManager
from slackbot.utils import WorkerPool
from slackbot import settings
logger = logging.getLogger(__name__)
class Mess... | omerxx/slapybot | slackbot/dispatcher.py | Python | mit | 8,792 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contests', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='StatisticsConfig',
fields... | papedaniel/oioioi | oioioi/statistics/migrations/0001_initial.py | Python | gpl-3.0 | 976 |
from sklearn.datasets import make_regression
def get_random_epoch(dimensions=1, samples=1000):
# generate random data
# http://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_regression.html
x, y = make_regression(n_samples=samples, n_features=dimensions, n_informative=1, noise=10)
if... | DanielDeychakiwsky/python-machine-learning | src/linear_regression/data.py | Python | mit | 446 |
#!/usr/bin/python
# 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/
import os
import re
import sys
import urllib.request
"""Logpuzzle exercise
Given an apache l... | norbertspiess/google-python-exercises | logpuzzle/solution/logpuzzle.py | Python | apache-2.0 | 3,140 |
from toee import *
import race_defs
###################################################
def GetCategory():
return "Core 3.5 Ed Classes"
print "Registering race: Troll"
raceEnum = race_troll
raceSpec = race_defs.RaceSpec()
raceSpec.modifier_name = "Troll" # Python modifier to be applied
raceSpec... | GrognardsFromHell/TemplePlus | tpdatasrc/tpgamefiles/rules/races/race011_troll.py | Python | mit | 1,219 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.core.mail.backends.locmem import EmailBackend as BaseEmailBackend
class BrokenEmailBackend(BaseEmailBackend):
def send_messages(self, messages):
return 0
| CloudNcodeInc/djmail | testing/mocks.py | Python | bsd-3-clause | 248 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para rapidgator
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core im... | dknlght/dkodi | src/plugin.video.animehere/servers/rapidgator.py | Python | gpl-2.0 | 1,401 |
import ast
import hashlib
from json import dumps, loads
import os
from Queue import Queue
import random
import sys
import time
import threading
import urllib
import deserialize
from processor import Processor, print_log
from utils import *
from storage import Storage
from utils import logger
class BlockchainProcessor... | mazaclub/tate-server | src/blockchain_processor.py | Python | agpl-3.0 | 27,968 |
##########################################################################
#
# Copyright (c) 2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | chippey/gaffer | python/GafferImageUI/ImageStatsUI.py | Python | bsd-3-clause | 3,293 |
"""
shared options and groups
The principle here is to define options once, but *not* instantiate them
globally. One reason being that options with action='append' can carry state
between parses. pip parse's general options twice internally, and shouldn't
pass on state. To be consistent, all options will follow this d... | Ivoz/pip | pip/cmdoptions.py | Python | mit | 9,790 |
# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# 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/.
#
# ... | lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/uno.py | Python | lgpl-3.0 | 15,393 |
from os import path
from freezegun import freeze_time
from nose.tools import assert_equals
from echelonpy.__main__ import generate_output
@freeze_time("2017-04-23T12:57:42Z")
def test_single_stage():
_integration_test('single_stage')
@freeze_time("2017-04-23T12:59:00Z")
def test_multi_stage():
_integration... | trickhub/echelonpy | tests/test_integration.py | Python | mit | 776 |
"""Extension management."""
from django.conf import settings
from django.conf.urls import include
class ModoExtension(object):
"""
Base extension class.
Each Modoboa extension must inherit from this class to be
considered as valid.
"""
name = None
label = None
version = "NA"
des... | carragom/modoboa | modoboa/core/extensions.py | Python | isc | 3,675 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2017, Juan José Gómez Romera <jjgomera@gmail.com>
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 Softwar... | jjgomera/pychemqt | equipment/UI_electricPrecipitator.py | Python | gpl-3.0 | 6,896 |
"""add node control
Revision ID: 40a641ef2f52
Revises: a3d144cdc527
Create Date: 2018-08-30 20:02:26.339879+00:00
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '40a641ef2f52'
down_revision = 'a3d144cdc527'
branch_labe... | HERA-Team/Monitor_and_Control | alembic/versions/40a641ef2f52_add_node_control.py | Python | bsd-2-clause | 836 |
__all__ = [
"getMin"
]
__doc__ = "Different algorithms used for optimization"
import Optizelle.Unconstrained.State
import Optizelle.Unconstrained.Functions
from Optizelle.Utility import *
from Optizelle.Properties import *
from Optizelle.Functions import *
def getMin(X, msg, fns, state, smanip=None):
"""Solv... | OptimoJoe/Optizelle | src/python/Optizelle/Unconstrained/Algorithms.py | Python | bsd-2-clause | 863 |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | kamal-gade/rockstor-core | bootstrap.py | Python | gpl-3.0 | 10,120 |
# Copyright 2014 NeuroData (http://neurodata.io)
#
# 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... | neurodata/ndstore | scripts/deprecated/testhdf5.py | Python | apache-2.0 | 2,753 |
import pytest
pytest.importorskip("speedtest")
def test_load_module():
__import__("modules.core.speedtest")
| tobi-wan-kenobi/bumblebee-status | tests/modules/core/test_speedtest.py | Python | mit | 115 |
##############################################################################
#
# 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 Affero General Public L... | OSSESAC/odoopubarquiluz | addons/sale/wizard/sale_make_invoice_advance.py | Python | agpl-3.0 | 10,631 |
# -*- coding: UTF-8 -*-
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/dygraph_sharding_stage3_offload.py | Python | apache-2.0 | 6,264 |
import os, sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)),'release'))
from invoke import task
from pathlib import Path
from util.splunkbase_releaser import SplunkbaseReleaser
__all__ = ['splunkbase_release']
@task
def splunkbase_release(app_dir=None):
'''
Prepare the release... | Cisco-AMP/amp4e_splunk_events_input | fabfile.py | Python | bsd-2-clause | 591 |
# -*- coding: utf-8 -*-
import xbmc
import xbmcaddon
import os
ADDON_NAME = 'plugin.video.freplay'
ADDON = xbmcaddon.Addon(ADDON_NAME)
SETTINGS = ADDON
LANGUAGE = ADDON.getLocalizedString
ADDON_DIR = ADDON.getAddonInfo("path")
ADDON_DATA = xbmc.translatePath(ADDON.getAddonInfo('profile'))
VERSION = ADDON.getAddonInfo... | CyBHFal/plugin.video.freplay | resources/lib/globalvar.py | Python | gpl-2.0 | 880 |
# coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2021 yutiansut/QUANTAXIS
#
# 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 th... | yutiansut/QUANTAXIS | QUANTAXIS/QAAnalysis/__init__.py | Python | mit | 1,200 |
#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | carthach/essentia | test/src/unittests/all_tests.py | Python | agpl-3.0 | 8,953 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import InfinitumTestFramework
from test_framework.util import *
class... | fcecin/infinitum | qa/rpc-tests/wallet.py | Python | mit | 15,398 |
#!/usr/bin/env python
import sys
import socket
import BaseHTTPServer
import pyqrcode
import os
import shutil
class BoatHTTPServer(BaseHTTPServer.HTTPServer):
def __init__(self, server_address, server_handler, timeout, maxrequests):
BaseHTTPServer.HTTPServer.__init__(self, server_address, server_handler)
... | ashisha/boat | boat/boat.py | Python | mit | 3,900 |
# Copyright 2016 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 agreed to in writing, ... | Servir-Mekong/SurfaceWaterTool | lib/google/auth/app_engine.py | Python | gpl-3.0 | 4,985 |
# encoding: utf-8
import json
import os.path
from time import time
from itertools import chain
from collections import defaultdict
from gevent import wsgi
from flask import Flask, make_response, request, render_template
from . import runners
from .cache import memoize
from .runners import MasterLocustRunner
from loc... | pglass/locust | locust/web.py | Python | mit | 6,577 |
import random
ts = [
(3, 1, 40, 'gauss', 50, 50),
(3, 1, 40, 'uniform'),
(3, 1, 40, 'gauss', 50, 3),
(3, 1, 40, 'gauss', 10, 5),
(3, 1, 40, 'gauss', 80, 7),
(3, 41, 200, 'gauss', 50, 50),
(3, 41, 200, 'uniform'),
(3, 41, 200, 'gauss', 50, 3),
(3, 41, 200, 'gauss', 10, 5),
(3, 4... | SuprDewd/epsilon | example_contests/fk_2014_delta/tests/stofn_og_lauf_plott/gen.py | Python | mit | 894 |
class DeprecatedKeywords:
def deprecated_library_keyword(self):
"""*DEPRECATED* Use keyword `Not Deprecated With Doc` instead!
Some more doc here. ignore this in the warning.
"""
pass
def deprecated_keyword_returning(self):
"""*DEPRECATED* But still returni... | userzimmermann/robotframework-python3 | atest/testdata/test_libraries/DeprecatedKeywords.py | Python | apache-2.0 | 568 |
"""Unit tests for backwards_optimization.py."""
import unittest
import numpy
import pandas
from gewittergefahr.gg_utils import radar_utils
from gewittergefahr.gg_utils import soundings
from gewittergefahr.deep_learning import cnn
from gewittergefahr.deep_learning import backwards_optimization as backwards_opt
from gew... | thunderhoser/GewitterGefahr | gewittergefahr/deep_learning/backwards_optimization_test.py | Python | mit | 15,191 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... | dokipen/trac | trac/versioncontrol/tests/svn_authz.py | Python | bsd-3-clause | 7,491 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import inspect
import frappe
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '10.0.8'
def get_default_company(user=None):
'''Get default company for user'''
from frappe.defaults import get_user_default_as_lis... | tfroehlich82/erpnext | erpnext/__init__.py | Python | gpl-3.0 | 3,969 |
# Copyright (c) 2010 by California Institute of Technology
# Copyright (c) 2012 by Delft University of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source... | murrayrm/python-control | control/frdata.py | Python | bsd-3-clause | 26,326 |
#!/usr/bin/env python2
# -*- encoding: utf-8 -*-
""" MineRCON.py : a graphical Minecraft RCON client """
__author__ = "Beerstorm"
__license__ = "GPLv2"
__version__ = "0.7"
__maintainer__ = "Beerstorm"
__email__ = "beerstorm.emberbeard@gmail.com"
from srcdspy import rcon
import socket
from Tkinter impo... | Beerstorm/MineRCON | MineRCON.py | Python | gpl-2.0 | 21,626 |
import sys
sys.path.append("../../Crawlers/Bing/WAPI/")
from crawlerbing import crawlerbing
sys.path.append("../../Crawlers/Google/")
from crawlergoogle import crawlergoogle
class fingergrampushttp:
def __init__(self,key,header):
self.key = key
self.header = header
self.__selectUrls()
def __searchUrls(s... | overxfl0w/Grampus-Forensic-Utils | Finger-FootPrinting/GrampusHTTP/fingerghttp.py | Python | gpl-2.0 | 1,829 |
from django.contrib.gis.geos import Point
from osgeo import osr
from terrapyn.ows.views.wms.base import WMSAdapterBase
from terrapyn.ows.rendering.cairo_geodjango_renderer import RenderingContext
from terrapyn.ows.parsing import create_spatialref
class OGRDatasetWMSAdapter(WMSAdapterBase):
""" A default implement... | JeffHeard/terrapyn | ows/views/wms/ogr.py | Python | apache-2.0 | 8,363 |
import string
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
def SelectOptions(driver, elementId, labels):
el = driver.find_element_by_css_selector(elementId)
for option in el.find_elements_b... | Uckpa/selenium-course | lesson11/select_product.py | Python | gpl-3.0 | 2,876 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-28 11:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fleetboss', '0002_fleetaccess'),
]
operations = [
migrations.AlterField(
... | StephenSwat/EVE-Fleetboss | fleetboss/migrations/0003_auto_20160628_1133.py | Python | gpl-3.0 | 459 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.