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 |
|---|---|---|---|---|---|
"""Handle the frontend for Home Assistant."""
import json
import logging
import mimetypes
import os
import pathlib
from typing import Any, Dict, Optional, Set, Tuple
from aiohttp import web, web_urldispatcher, hdrs
import voluptuous as vol
import jinja2
from yarl import URL
import homeassistant.helpers.config_validat... | Cinntax/home-assistant | homeassistant/components/frontend/__init__.py | Python | apache-2.0 | 16,467 |
#! /usr/bin/python
# -*- coding: UTF-8 -*-
# Copyright 2011-2017 Luiko Czub, Olivier Renault, James Stock, TestLink-API-Python-client developers
#
# 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 Lice... | orenault/TestLink-API-Python-client | src/testlink/testlinkapi.py | Python | apache-2.0 | 22,615 |
# 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/.
from __future__ import absolute_import, unicode_literals
import argparse
import collections
import inspect
import sys
i... | CYBAI/servo | python/mach/mach/decorators.py | Python | mpl-2.0 | 11,849 |
import django_tables2 as tables
from categories.models import Message
class MessageTable(tables.Table):
class Meta:
model = Message
attrs = {"class": "table table-bordered table-condensed"}
| srugano/categorization | categories/tables.py | Python | apache-2.0 | 212 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!가입; 봇 게임센터에 가입합니다.\n!내정보; 내 등록된 정보를 봅니다."""
import re
import json
from botlib import BotLib
from rpg import RPG
from util.util import enum
CmdType = enum(
Register = 1,
MyInfo = 2,
WeaponInfo = 3,
AddWeapon = 4,
UpgradeWeapon = 5,
)
# 입력으로부터 명령어 ... | storyhe/playWithBot | plugins/rpgbot.py | Python | mit | 3,282 |
# license: BSD, see LICENSE included in this package
#
# based on awesome lib from Jonathan Williamson (https://github.com/pimoroni/adxl345-python/)
#
import smbus
import time
import sys
class ADXL345:
#SCALE_MULTIPLIER = 0.004
DATA_FORMAT = 0x31
BW_RATE = 0x2C
POWER_CTL ... | locked/4stability | adxl345.py | Python | bsd-3-clause | 2,336 |
"""more_antenna_stats
Revision ID: 50c966c5427a
Revises: edecd502cdd8
Create Date: 2019-07-19 19:59:08.371361+00:00
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '50c966c5427a'
down_revision = 'edecd502cdd8'
branch_la... | HERA-Team/Monitor_and_Control | alembic/versions/50c966c5427a_more_antenna_stats.py | Python | bsd-2-clause | 1,649 |
#!/usr/bin/env python
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
modified by andrewR on 2015 sept
"""
__author__ = 'wesc+api@google.com (Wesley Chun) and haia... | uncleoptimus/FSND4-ConferenceApp | conference.py | Python | apache-2.0 | 33,365 |
import wx
import wx.calendar
from wx.lib.masked import TimeCtrl
from wx.lib.agw import hypertreelist as HTL
from datetime import datetime, time
from lib import Task, DATA, PRIORITIES, DEFAULT_PRIORITY
from decorators import requires_selection
ID_ADD_TASK = 1000
ID_ADD_SUBTASK = 1010
ID_COLLAPSE = 1020
ID_EXPAND = 103... | codekoala/treedo | treedo/gui.py | Python | bsd-3-clause | 12,628 |
class object_ustr(object):
def __unicode__(self):
'''This should really be overriden in subclasses'''
class_name = self.__class__.__name__
attr_pairs = ('%s=%s' % (key, val) for key, val in self.__dict__.items())
return u'<%s %s>' % (class_name, ' '.join(attr_pairs))
def __str__... | chbrown/xdoc-python | xdoc/lib/base.py | Python | mit | 483 |
"""Code for Lower Bounds of Dynamic Time Warping."""
# Author: Johann Faouzi <johann.faouzi@gmail.com>
# License: BSD-3-Clause
import numpy as np
from math import sqrt
from numba import njit, prange
from sklearn.utils import check_array
def _check_consistent_lengths(X, Y):
n_timestamps_X, n_timestamps_Y = X.sha... | johannfaouzi/pyts | pyts/metrics/lower_bounds.py | Python | bsd-3-clause | 12,840 |
from skimage import data
from skimage.viewer.qt import QtGui, QtCore
from skimage.viewer import ImageViewer, CollectionViewer, viewer_available
from skimage.transform import pyramid_gaussian
from skimage.viewer.plugins import OverlayPlugin
from skimage.filter import sobel
from numpy.testing import assert_equal
from nu... | SamHames/scikit-image | skimage/viewer/tests/test_viewer.py | Python | bsd-3-clause | 2,081 |
# Copyright 2013-2015 DataStax, 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 writi... | jfelectron/python-driver | tests/integration/standard/test_udts.py | Python | apache-2.0 | 28,490 |
from CoperProxy import ProxyDemo
import time
from config import settings
# 首先配置好config文件
while True:
ProxyDemo().start()
time.sleep(settings['interval'])
| A1014280203/Ugly-Distributed-Crawler | cooperator/start.py | Python | mpl-2.0 | 185 |
#
# Module implementing synchronization primitives
#
# multiprocessing/synchronize.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
__all__ = [
'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event'
]
import threading
import sys
import... | prefetchnta/questlab | bin/x64bin/python/37/Lib/multiprocessing/synchronize.py | Python | lgpl-2.1 | 11,979 |
两个用户a,b
pull完同一个github.ocm代码库在同时对同一个代码文件进行修改
修改后,a先做了push
之后b做push时,提示版本冲突
此时,b需要先pull,再add,再commit,再push
b再pull时,会提示需要做merge
这时的merge有两种方案:
1.丢弃本地修改,直接接受github.com文件
git reset --hard
git pull
2.选择将a,b的修改同时包含到冲突文件,由b手动修改
git pull 后会提示如何操作
在两台电脑上使用同一个用户对代码库做改动时,最好的方式是:
1.每次修改前
pull
2.每... | UpSea/midProjects | BasicOperations/13_git/版本冲突.py | Python | mit | 747 |
"""InvoiceBatch is a container for Invoice instances.
"""
from AccessControl import ClassSecurityInfo
from Products.CMFPlone.utils import _createObjectByType
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import t
from bika.lims.config import ManageInvoices, PROJECTNAME
from bika.lims.content.bikasc... | anneline/Bika-LIMS | bika/lims/content/invoicebatch.py | Python | agpl-3.0 | 8,938 |
# Copyright (C) 2007 Shijoe George <spanjikk@redhat.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 2 of the License, or
# (at your option) any later version.
# This progra... | csutherl/sos | sos/plugins/nscd.py | Python | gpl-2.0 | 1,423 |
#
# artist2albumartist ID3 copier
#
# Scans given directory for mp3 and m4a files. Copies artist tag to album artist.
# Why: Some Digital DJ softwares use album artist tag for tracks instead of artist and it makes things complicated.
#
# See README.md
#
# 24/11/2016 Marko Sahlman (marko.sahlman@gmail.com)
#
from os.p... | markosa/artist2albumartistid3 | artist2albumartist.py | Python | gpl-3.0 | 2,974 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('Manager', '0013_auto_20140904_1942'),
]
operations = [
migrations.AddField(
model_name='plan',
name=... | CCharlieLi/StaffManagmentSystem | Manager/migrations/0014_plan_planlevel.py | Python | gpl-2.0 | 454 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | The-Compiler/qutebrowser | qutebrowser/browser/webkit/network/webkitqutescheme.py | Python | gpl-3.0 | 3,136 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 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... | Forage/Gramps | gramps/gen/filters/_paramfilter.py | Python | gpl-2.0 | 2,390 |
from moviepy.decorators import requires_duration
@requires_duration
def fadeout(clip, duration):
"""
Makes the clip fade to black progressively, over ``duration`` seconds.
For more advanced fading, see ``composition.crossfade``
"""
fading = lambda t: min(1.0 * (clip.duration - t) / duration, 1)
return clip.fl(la... | ShaguptaS/moviepy | moviepy/video/fx/fadeout.py | Python | mit | 375 |
# NamoInstaller ActiveX Control 1.x - 3.x
# CVE-NOMATCH
import logging
log = logging.getLogger("Thug")
def Install(self, arg):
if len(arg) > 1024:
log.ThugLogging.log_exploit_event(self._window.url,
"NamoInstaller ActiveX",
... | buffer/thug | thug/ActiveX/modules/NamoInstaller.py | Python | gpl-2.0 | 1,259 |
import os, time, timeit, argparse
from PIL import ImageDraw
from processMaze import Maze
from binaryHeap import BinaryHeap
from helpers import replace_print
class mazeSolve(object):
"""Takes in a maze, makes a graph, and solves it"""
def __init__(self, filename, to_crop=False):
self.maze = Maze(fil... | Axel-Jacobsen/MazeSolve | programs/mazeSolve.py | Python | mit | 5,970 |
# Copyright 2020 Makani Technologies 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... | google/makani | analysis/force_balance_loop/lib/fun.py | Python | apache-2.0 | 15,163 |
#=============================================
# Collecting detail data of each user's result
# do 32 manually
# read from the file and only take information from each differently
#===============================================
from datetime import datetime
from csv import DictReader
from math import exp, log, sqrt
im... | meisamhe/GPLshared | Research_Projects_UTD/Gamification/Crawler/CorrectedCodes/crawlDetailDataExtractionLDRBRD.py | Python | gpl-3.0 | 4,656 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payment', '0014_sdncheckfailure_site'),
]
operations = [
migrations.AlterField(
model_name='source',
name='reference',
field=mo... | eduNEXT/edunext-ecommerce | ecommerce/extensions/payment/migrations/0015_auto_20170215_2229.py | Python | agpl-3.0 | 407 |
# Volatility
#
# Zeus support:
# Michael Hale Ligh <michael.ligh@mnin.org>
#
# Citadel 1.3.4.5 support:
# Santiago Vicente <smvicente@invisson.com>
#
# Generic detection, Citadel 1.3.5.1 and ICE IX support:
# Juan C. Montes <jcmontes@cert.inteco.es>
#
# This program is free software; you can redistribute it and/or modi... | INTECOCERT/volatility_plugins | zbotscan.py | Python | gpl-2.0 | 45,058 |
""" Strip stop words from text"""
import re
class ridstop:
def __init__(self, question):
needshelp = str.lower(question)
self.query = set(re.sub("[^\w]", " ", needshelp).split())
stop = open("stopwords.txt", "r")
self.stopwords = set([line.rstrip('\n') for line in stop])
def stripstop(self):
goods = se... | LinusS1/botbot | stopwords/stopstrip.py | Python | mit | 371 |
# Made by Drov.
import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
SWEET_FLUID = 7586
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,... | Barrog/C4-Datapack | data/jscript/quests/426_FishingShot/__init__.py | Python | gpl-2.0 | 2,541 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote
class XNXXIE(InfoExtractor):
_VALID_URL = r'https?://(?:video|www)\.xnxx\.com/video-?(?P<id>[0-9a-z]+)/'
_TESTS = [{
'url': 'http://www.xnxx.com/video-55awb78/sky... | Tithen-Firion/youtube-dl | youtube_dl/extractor/xnxx.py | Python | unlicense | 1,596 |
################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
# Redistribu... | saltastro/pysalt | lib/saltfit.py | Python | bsd-3-clause | 12,791 |
# -*- coding: utf-8 -*-
"""Test loading of data from and into static tables"""
import os
from pyrseas.testutils import DatabaseToMapTestCase
from pyrseas.testutils import InputMapToSqlTestCase
CREATE_STMT = "CREATE TABLE t1 (c1 integer, c2 text)"
FILE_PATH = 'table.t1.data'
TABLE_DATA = [(1, 'abc'), (2, 'def'), (3, '... | dvarrazzo/Pyrseas | tests/dbobject/test_static.py | Python | bsd-3-clause | 4,712 |
# -*- coding: utf-8 -*-
from django.core.management.base import NoArgsCommand, CommandError
from djmail import core
class Command(NoArgsCommand):
def handle_noargs(**options):
core._send_pending_messages()
core._mark_discarded_messages()
core._retry_send_messages()
return 0
| snig-b/djmail | djmail/management/commands/djmail_retry_send_messages.py | Python | bsd-3-clause | 314 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Savoir-faire Linux (<www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the t... | OCA/program | program_multi_menu/__init__.py | Python | agpl-3.0 | 1,142 |
# coding=utf-8
"""
Collector that reports amavis metrics as reported by amavisd-agent
#### Dependencies
* amavisd-agent must be present in PATH
"""
import os
import subprocess
import re
import diamond.collector
import diamond.convertor
from diamond.collector import str_to_bool
class AmavisCollector(diamond.coll... | EzyInsights/Diamond | src/collectors/amavis/amavis.py | Python | mit | 3,704 |
"""Sink implementations for SQL backend"""
import hashlib
from collections import OrderedDict
from future.utils import iteritems
from onix.model import Moveset, Forme, BattleInfo, Player
from onix.utilities import compute_sid
from onix.collection import sinks as _sinks
from onix.backend.sql import schema
def compu... | Antar1011/Onix | onix/backend/sql/sinks.py | Python | gpl-3.0 | 14,132 |
import os
from openstack_portation.exceptions import OpenStackPortationError
from openstack_portation import utils
from tests import utils as test_utils
class TestImport(test_utils.TestClient):
# teardown will take care of deleting created resources
# assume that if they can be deleted, they were created cor... | tnoff/OpenStack-Account-Setup | tests/test_import.py | Python | bsd-2-clause | 13,954 |
# Created: 16.03.2011, 2018 rewritten for pytest
# Copyright (C) 2011-2019, Manfred Moitzi
# License: MIT License
import pytest
from ezdxf.entities.appid import AppID
@pytest.fixture
def appid():
return AppID.new(
"FFFF",
dxfattribs={
"name": "EZDXF",
},
)
def test_name(... | mozman/ezdxf | tests/test_01_dxf_entities/test_118_appid_table_entry.py | Python | mit | 365 |
#!python2
#
# SUMMARY: Outputs the [application name] of the topmost window at mouse screen position or nothing if none
# USAGE: <script> <x-screen-coordinate> <y-screen-coordinate>
#
# REQUIRES: macOS window system and the python2 and the PyObjC libraries available here: https://pythonhosted.org/pyobjc... | jhbadger/emacs.d | elpa/hyperbole-7.0.3/topwin.py | Python | gpl-3.0 | 2,127 |
# Copyright 2015 The Shaderc Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | qrealka/skia-hc | third_party/externals/shaderc2/glslc/test/option_std.py | Python | apache-2.0 | 10,472 |
from v1_0.user_roles import anonymous_user, authenticated_user, bumblebee_user
import unittest
class HarbourServiceTest(unittest.TestCase):
def test_anonymous_user(self):
r = anonymous_user.get('harbour/mirrors')
self.assertEqual(r.status_code, 401)
def check_harbour_service(self, user=authen... | adsabs/adsrex | v1_0/api/harbour.py | Python | mit | 650 |
import functools
from framepy import _method_inspection
from framepy import core
annotated_beans = {}
annotated_configurations = []
def bean(key):
def wrapped(potential_bean_class):
annotated_beans[key] = potential_bean_class
return potential_bean_class
return wrapped
def autowired(key):
... | mkorman9/framepy | framepy/beans.py | Python | mit | 6,714 |
from __future__ import unicode_literals
from django.db.models.fields import NOT_PROVIDED
from django.utils import six
from django.utils.functional import cached_property
from .base import Operation
class AddField(Operation):
"""
Adds a field to a model.
"""
def __init__(self, model_name, name, field... | Sonicbids/django | django/db/migrations/operations/fields.py | Python | bsd-3-clause | 11,032 |
import os
import time
import logging
import duckduckgo
import string
from utils import *
def ComputeMetaRatings(object_common_name = 'MAME', topic_keyword_array = ['arcade', 'emulator']):
print('ComputeMetaRatings() object_common_name = ' + object_common_name)
seach_string = object_common_name
for s_keyword in to... | astrofra/emucamp-engine | python/meta_ratings.py | Python | mit | 810 |
# package org.apache.helix.participant
#from org.apache.helix.participant import *
| davzhang/helix-python-binding | org/apache/helix/participant/package-info.py | Python | apache-2.0 | 84 |
#############################################################################79
"""Enhanced assembler for 16-bit THCO MIPS.
usage: thcoas [-h] [--stdio] [inFile [outFile]]
-h --help display help and exit
--stdio input from stdin and output to stdout, can be used for piping,
omits inFile ... | fupolarbear/THU-Class-CO-makecomputer | assembler/thcoas.py | Python | mit | 9,359 |
#!/usr/bin/env python
# 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.
modes = {
'argparse':0,
'trivia':1
}
mpd_host =... | shippingsoon/Shippingsoon | uploads/articles/src/12/config.py | Python | gpl-3.0 | 31,703 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from distutils.core import setup
setup( name="pinyin-comp",
version="0.1",
description="complete path containing Chinese by pinyin acronym",
author="Jekyll Wu",
author_email="adaptee@gmail.com",
url="http://www.github.com/a... | Vayn/dotfiles | tools/pinyin-completion/setup.py | Python | mit | 411 |
from django.core import validators
from django.core.exceptions import ValidationError
from django.core.urlresolvers import resolve
from oscar.core.loading import get_model
from django.http import Http404
from django.utils.translation import ugettext_lazy as _
class ExtendedURLValidator(validators.URLValidator):
... | manevant/django-oscar | src/oscar/core/validators.py | Python | bsd-3-clause | 4,618 |
#!/usr/bin/env python
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2018 Raik Gruenberg & Johan Leckner
##
## 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... | graik/biskit | archive_biskit2/scripts/analysis/a_foldX.py | Python | gpl-3.0 | 9,278 |
#!/usr/bin/python
"""
Tool for approximate reductions of finite automata used in network traffic
monitoring.
Copyright (C) 2017 Vojtech Havlena, <xhavle03@stud.fit.vutbr.cz>
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 ... | vhavlena/appreal | reduce/appred/pruning_reduction.py | Python | gpl-2.0 | 20,156 |
#!/usr/bin/env python3
from flask import Flask, request
app = Flask(__name__)
#for requests to the root hierarchy, say hello
@app.route("/")
def hello():
if not request.headers.getlist("X-Forwarded-For"):
return "you've reached the VANILLA HTTP SERVER\n"
#start vanilla HTTP server
if __name__ == "__main__":
... | skynode/blockchain-dev | micropayments-proxy/vanilla_http_server.py | Python | mit | 361 |
# Copyright 2011 Isaku Yamahata
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | bigswitch/nova | nova/tests/unit/test_block_device.py | Python | apache-2.0 | 29,365 |
#/usr/bin/env python
#-----------------------------------------------------------------------
# author:
import random
import numpy as np
#=======================================================================
# Kalman Filter implementation
# Implements a linear Kalman filter.
class KalmanFilterLinear:
def __in... | phoenixding/scdiff | scdiff/KF2.py | Python | mit | 12,776 |
#!/user/bin/env python
import smach
import rospy
import time
import actionlib
from actionlib_msgs.msg import GoalStatus
from sub_vision.msg import TrackObjectAction, TrackObjectGoal, TrackObjectFeedback, TrackObjectResult, VisualServoAction, VisualServoGoal, VisualServoFeedback, VisualServoResult
from geometry_msgs.msg... | RoboticsClubatUCF/RoboSub | ucf_sub_catkin_ros/src/sub_states/src/slots.py | Python | mit | 2,258 |
# BurnMan - a lower mantle toolkit
# Copyright (C) 2012, 2013, Heister, T., Unterborn, C., Rose, I. and Cottaar, S.
# Released under GPL v2 or later.
"""
example_chemical_potentials
---------------------------
This example shows how to use the chemical potentials library of functions.
*Demonstrates:*
* How to ... | QuLogic/burnman | examples/example_chemical_potentials.py | Python | gpl-2.0 | 6,394 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either vers... | markovmodel/PyEMMA | pyemma/_base/estimator.py | Python | lgpl-3.0 | 19,148 |
## @file
# generate capsule
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found... | bitcrystal/buildtools-BaseTools | Source/Python/GenFds/Capsule.py | Python | bsd-2-clause | 3,894 |
# Copyright 2018 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, s... | quartzmo/gcloud-ruby | google-cloud-spanner/synth.py | Python | apache-2.0 | 6,363 |
#! /usr/bin/env python
import random
def josephus(N, m):
idx = 1
for n in range(1, N):
idx = (idx+m-1)%(n+1)+1
return idx
def test(N, m):
lst = [i for i in range(1, N+1)]
pos = 0
while len(lst)>1:
pos = (pos+m-1)%len(lst)
del lst[pos]
return lst[0] == josephus(N, ... | DevinZ1993/Pieces-of-Code | python/algo/josephus.py | Python | mpl-2.0 | 519 |
"""
Tests for the sprockets.clients.statsd package
"""
import os
import mock
import socket
try:
import unittest2 as unittest
except ImportError:
import unittest
from sprockets.clients import statsd
class SendTests(unittest.TestCase):
def test_socket_sendto_is_invoked(self):
with mock.patch('soc... | sprockets/sprockets.clients.statsd | tests.py | Python | bsd-3-clause | 3,003 |
from django.utils.translation import ugettext_noop
from casexml.apps.case.models import CommCareCase
from corehq.apps.hqwebapp.doc_info import get_doc_info
from corehq.apps.locations.models import SQLLocation
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn
from corehq.apps.reports.filters.... | qedsoftware/commcare-hq | custom/ilsgateway/tanzania/reports/unrecognized_sms.py | Python | bsd-3-clause | 5,566 |
from .utils.url import Mountpoint
class Location:
def __init__(self, mountpoint, is_frontend_app=False, is_static=False, fs_paths=()):
assert isinstance(mountpoint, Mountpoint)
self.mountpoint = mountpoint
self._is_frontend_app = is_frontend_app
self._is_static = is_static
... | getweber/weber-cli | cob/locations.py | Python | bsd-3-clause | 570 |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 22 14:07:39 2016
@author: pablo
"""
import numpy as np
import abc
import matplotlib.pyplot as plt
class Hyperplume():
""" Parent class Hyperplume loads target plasma and defines common attributes as well as
shared methods in the AEM and SSM plume classe... | Pabsm94/HyperPlume | src/HYPERPLUME/hyperplume.py | Python | mit | 9,570 |
import os
from datetime import time
from django.db import migrations
def edit_weekly_time_slot(apps, schema_editor):
WeeklyTimeSlot = apps.get_model('app', 'WeeklyTimeSlot')
weekly_time_slots = list(
WeeklyTimeSlot.objects.all().order_by('weekday', 'start')
)
index = 0
for weekday in ra... | malaonline/Server | server/app/migrations/0059_weeklytimeslot.py | Python | mit | 861 |
import eqpy
import sympy
from eqpy._utils import raises
def test_constants():
assert eqpy.nums.Catalan is sympy.Catalan
assert eqpy.nums.E is sympy.E
assert eqpy.nums.EulerGamma is sympy.EulerGamma
assert eqpy.nums.GoldenRatio is sympy.GoldenRatio
assert eqpy.nums.I is sympy.I
assert eqpy.nums... | eriknw/eqpy | eqpy/tests/test_nums.py | Python | bsd-3-clause | 747 |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib.sitemaps import views as sitemaps_views
from django.views.decorators.cache import cache_page
from django.views.static import serve
from os.path import abspath, dirname, join, isfile
from sys... | AlexStarov/Shop | proj/urls.py | Python | apache-2.0 | 12,021 |
# 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 | On_Combining_Bags_to_Better_Learn_from_Label_Proportions/Code/GenBagTfCode/method1loopseeded.py | Python | apache-2.0 | 17,216 |
from .game_manager import GameManager
from .robot_controller import RobotController
from .snake_board import SnakeBoard
from .snake_robot import SnakeRobot
from .snake_beacon import SnakeBeacon
def launch_robot(robot_module, myrobot, board_size=(8,16)):
'''
Creates a robot controller, a board, and sets th... | virtuald/RobotSnake | snake/launcher.py | Python | mit | 1,218 |
from parse_mps_interests import parse | spudmind/undertheinfluence | parsers/mps_interests/__init__.py | Python | mit | 37 |
# -*- coding: utf-8 -*-
"""
Server Program Ver.0.0.3
Time-stamp: <2017-05-13 17:43:34 akira>
"""
import sys
import datetime
import logging
import socket
def log_open(basename):
today = datetime.datetime.today()
logfile=today.strftime(basename + '_%Y%m%d_%H%M%S.log')
logging.basicConfig(filename=logfile,
... | kido-akira/scs | server.py | Python | mit | 1,244 |
#initialize the variables
girldescription = " "
boydescription = " "
walkdescription = " "
girlname = " "
boyname = " "
animal = " "
gift = " "
answer = " "
#Ask the user to specify values for the variables
girlname = input("Enter a girl's name: ")
boyname = input("Enter a boy's name: " )
animal = inp... | susanibach/IntroToPython | ChallengeSolutionFiles/Module3PersonalizedStorySolution.py | Python | apache-2.0 | 1,299 |
#!/usr/bin/env python
###################################################################################
#
# Copyright (c) 2010-2016 Motsai
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwa... | Motsai/neblina-python | test/neblinaTest.py | Python | mit | 4,448 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2009, 2010, 2011, 2013 CERN.
#
# Invenio 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... | Lilykos/invenio | invenio/modules/bulletin/testsuite/test_bulletin.py | Python | gpl-2.0 | 2,791 |
# coding=utf-8
"""InaSAFE Wizard Step Hazard Layer Origin."""
# noinspection PyPackageRequirements
from PyQt4.QtGui import QPixmap
from safe.utilities.i18n import tr
from safe.utilities.resources import resources_path
from safe.gui.tools.wizard.wizard_strings import (
select_hazard_origin_question,
select_ha... | Gustry/inasafe | safe/gui/tools/wizard/step_fc15_hazlayer_origin.py | Python | gpl-3.0 | 5,287 |
# coding=utf-8
from kg.lang.affix import Affix
class ChudayEtishMuchosu(Affix):
def __init__(self, word_object):
self.word_object = word_object
self.word_object.prepare()
def transformers(self):
return [ChudayEtishMuchosu.make]
mucholor = [
[u"чудай", u"чудай", u"чүдөй", ... | MasterAlish/kyrgyz_tili | kg/lang/etish/_chuday.py | Python | gpl-3.0 | 1,032 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(name="gridproxy",
version="0.2.1",
description="Small library for working with grid proxy certificates and VOMS extensions",
long_description="""\
... | abbot/gridproxy | setup.py | Python | gpl-3.0 | 1,250 |
import keras.optimizers
from keras.layers import Dense
import sft.eps.Linear
import sft.agent.DeepQAgentReplayCloning
import sft.agent.model.KerasMlpModel
import sft.reward.TargetMiddle
from sft.log.AgentLogger import AgentLogger
from .. import world
from ..world import *
logger = AgentLogger(__name__)
epsilon_updat... | kevinkepp/look-at-this | sft/config-sample/old_keras_agents/agents/keras_simple.py | Python | mit | 1,120 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from mock import MagicMock, patch
import logging
from django.conf import settings
from drivers import DriverFactory
from drivers.tests.base import (BaseMysqlDriverTestCase,
BaseSingleInstanceUpdateSizesTest... | globocom/database-as-a-service | dbaas/drivers/tests/test_driver_mysql.py | Python | bsd-3-clause | 7,183 |
import unittest
import axelrod
matplotlib_installed = True
try:
import matplotlib.pyplot
except ImportError:
matplotlib_installed = False
class TestPlot(unittest.TestCase):
@classmethod
def setUpClass(cls):
players = ('Player1', 'Player2', 'Player3')
test_payoffs_list = [
... | drvinceknight/Axelrod | axelrod/tests/test_plot.py | Python | mit | 3,331 |
def omp_master_3():
import omp
tid_result = 0
nthreads = 0
executing_thread = -1
if 'omp parallel':
if 'omp master':
tid = omp.get_thread_num()
if tid != 0:
if 'omp critical':
tid_result += 1
if 'omp critical':
... | serge-sans-paille/pythran | pythran/tests/openmp.legacy/omp_master_3.py | Python | bsd-3-clause | 465 |
from boid import *
class Flock(object):
"""
A flock is just a list of Boids
"""
def __init__(self):
""" create empty flock """
self.boids = []
def add(self, boid):
""" add boid to flock """
self.boids.append(boid)
def decide(self):
"""
... | adanner/SandPyPr | flock.py | Python | apache-2.0 | 924 |
from django.core.paginator import Page
from mkt.api.paginator import ESPaginator
from mkt.games.constants import GAME_CATEGORIES
class ESGameAggregationPaginator(ESPaginator):
"""
Paginator that handles aggregated results using a hardcoded aggregation
name and bucket name specified in mkt.games.filters. ... | Jobava/zamboni | mkt/games/paginator.py | Python | bsd-3-clause | 1,667 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: Patrick Bos
# @Date: 2016-11-16 16:23:55
# @Last Modified by: E. G. Patrick Bos
# @Last Modified time: 2017-09-05 17:27:17
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from pathlib import Path
import itertool... | roofit-dev/parallel-roofit-scripts | profiling/vincemark/analyze_g.py | Python | apache-2.0 | 13,421 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | aayushidwivedi01/spark-tk | integration-tests/tests/test_frame_datetime.py | Python | apache-2.0 | 2,291 |
from functools import reduce
from itertools import combinations
from pybbn.graph.edge import Edge, EdgeType
from pybbn.graph.graph import Ug
from pybbn.graph.node import Clique
class Triangulator(object):
"""
Triangulator. Triangulates an undirected moralized graph and produces cliques in the process.
""... | vangj/py-bbn | pybbn/pptc/triangulator.py | Python | apache-2.0 | 4,535 |
#!/usr/bin/env python3
# Review Lines from the Selected Deck in Random Order Until All Pass
# Written in 2012 by 伴上段
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed with... | jtvaughan/oboeta | oboeta.py | Python | cc0-1.0 | 6,217 |
# Copyright (C) 2013, Martin Abente Lahaye - tch@sugarlabs.org
#
# 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.
#
# Thi... | quozl/sugar | extensions/cpsection/backup/backends/volume.py | Python | gpl-3.0 | 10,420 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
# Vamos a programar una calculadora
def main():
pass
try:
if sys.argv[2] == "sumar":
main()
a = int(sys.argv[1])
b = int(sys.argv[3])
print(a + b)
if sys.argv[2] == "restar":
main()
a = int(sys.argv[1])
... | DanielBarreno/ptavi-p2 | calc.py | Python | gpl-2.0 | 761 |
import spindrift.http as http
import spindrift.network as network
'''
connect to google using http to handle the connection
'''
class Google(http.HTTPHandler):
def on_ready(self):
self.send() # GET /
def on_http_data(self): # we're done reading all the response; print and close
self.h... | robertchase/spindrift | example/http_google.py | Python | mit | 681 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A proxy to twitter APIs.
File: twitter_proxy.py
Author: SpaceLis
Email: Wen.Li@tudelft.nl
GitHub: http://github.com/spacelis
"""
import json
from flask import Flask
from flask import Response
from flask import request
from flask import send_from_directory
from request... | spacelis/portraitist2 | server/twitter_proxy.py | Python | mit | 1,299 |
import tkinter
import turtle
import random
import time
import math
class Point(turtle.RawTurtle):
def __init__(self, canvas, x, y):
super().__init__(canvas)
canvas.register_shape("dot", ((3, 0), (2, 2), (0, 3), (-2, 2), (-3, 0), (-2, -2), (0, -3), (2, -2)))
self.shape("dot")
self.s... | quietcoolwu/python-playground | ULutherBook/SortAnimation.py | Python | mit | 13,197 |
from fabric.api import *
from fabric.contrib import files
from playback import common
from playback.templates.galera_list import (conf_galera_list_trusty,
conf_galera_list_xenial)
class MysqlInstallation(common.Common):
"""
Install Galera Cluster for MySQ... | jiasir/playback | playback/mysql_installation.py | Python | mit | 2,572 |
import numpy
import six
import cupy
def column_stack(tup):
"""Stacks 1-D and 2-D arrays as columns into a 2-D array.
A 1-D array is first converted to a 2-D column array. Then, the 2-D arrays
are concatenated along the second axis.
Args:
tup (sequence of arrays): 1-D or 2-D arrays to be sta... | benob/chainer | cupy/manipulation/join.py | Python | mit | 4,435 |
# Copyright 2018 Tile, Inc. All Rights Reserved.
#
# The MIT License
#
# 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, ... | miyuchina/mistletoe | test/test_contrib/test_jira_renderer.py | Python | mit | 6,642 |
"""
15. Transactions
Django handles transactions in three different ways. The default is to commit
each transaction upon a write, but you can decorate a function to get
commit-on-success behavior. Alternatively, you can manage the transaction
manually.
"""
from django.db import models
class Reporter(models.Model):
... | iguzu/gae-django | tests/modeltests/transactions/models.py | Python | bsd-3-clause | 3,351 |
first_name = 'Monty'
last_name = 'Python'
full_name = first_name + ' ' + last_name
print(full_name)
| ehog/python | code-school/try-python/2_1_introduction_to_strings.py | Python | mit | 100 |
import sys
import threading
import urllib.request
import unittest
ServerModule = sys.modules["SpotifyWeb.src.spotify.Server"]
Server = ServerModule.Server
class TestServer(unittest.TestCase):
def test_roundtrip(self):
oauth2_url = "some url"
redirect_port = 1337
def send_http_request_to_self():
... | DevInsideYou/SpotifyWeb | tests/testServer.py | Python | mit | 1,163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.