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 |
|---|---|---|---|---|---|
"""
A Reddit bot that messages subscribed users of a chosen number of random top posts within the
last 24 hours of their selected subreddits. The name "Dose_Of_Sunshine" came from the original
idea to send users pictures from /r/aww every morning.
Created by Tony Vo (/u/Thirteen30) 2017
License: MIT License
"... | Lyxpudox/Dose_of_Sunshine | dose_of_sunshine.py | Python | mit | 9,665 |
# Copyright (C) 2012 Alex Nitz, Josh Willis, Andrew Miller, Tito Dal Canton
#
# 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 ve... | hagabbar/pycbc_copy | pycbc/types/array.py | Python | gpl-3.0 | 33,597 |
from .sitemap import * | grupydf/grupybr-template | {{cookiecutter.repo_name}}/.plugins/sitemap/__init__.py | Python | gpl-3.0 | 22 |
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2012 The Chromium OS Authors.
#
import command
import gitutil
import os
def FindGetMaintainer():
"""Look for the get_maintainer.pl script.
Returns:
If the script is found we'll return a path to it; else None.
"""
try_list = [
os.path... | ev3dev/u-boot | tools/patman/get_maintainer.py | Python | gpl-2.0 | 1,287 |
# -*- coding: utf-8 -*-
"""
requests.monkeys
"""
| garnaat/requests | requests/patches.py | Python | isc | 50 |
# Light LEDs at random and make them fade over time
#
# Usage:
#
# led_dance(delay)
#
# 'delay' is the time between each new LED being turned on.
#
# TODO The random number generator is not great. Perhaps the accelerometer
# or compass could be used to add entropy.
import microbit
import random
def led_dance(delay... | JoeGlancy/micropython | examples/led_dance.py | Python | mit | 664 |
from dotamatch import api
class Economy(api.Api):
url = "http://api.steampowered.com/IEconItems_570/GetSchema/v0001/?"
def items(self, **kwargs):
"""
Cosmetic items.
Available options are:
language=<lang code>
"""
return self._get(**kwargs)
| leonardobsjr/D2WBot | dotamatch/economy.py | Python | gpl-3.0 | 301 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis_louvain | assessments/business/score_encoding_export.py | Python | agpl-3.0 | 7,914 |
import pytest
from .common import * # NOQA
from .test_rke_cluster_provisioning import HOST_NAME
from .test_rke_cluster_provisioning import create_and_validate_custom_host
from .test_rke_cluster_provisioning import rke_config
namespace = {"p_client": None, "ns": None, "cluster": None, "project": None,
"no... | rancher/rancher | tests/validation/tests/v3_api/test_bkp_restore_s3_recover.py | Python | apache-2.0 | 7,295 |
#
# SPDX-FileCopyrightText: 2016 Dmytro Kolomoiets <amerlyq@gmail.com> and contributors.
#
# SPDX-License-Identifier: GPL-3.0-only
#
import curses
from .tui import draw
from .keymap import keymap
from miur.cursor import update
def prepare(stdscr):
# begin_x = 20
# begin_y = 7
# height = 5
# width = 4... | miur/miur | OLD/miur/ui/loop.py | Python | gpl-3.0 | 1,148 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("fluent_contents", "0001_initial")]
operations = [
migrations.CreateModel(
name="GistItem",
fields=[
... | edoburu/django-fluent-contents | fluent_contents/plugins/gist/migrations/0001_initial.py | Python | apache-2.0 | 1,780 |
# Patchwork - automated patch tracking system
# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import include
from django.urls import path... | getpatchwork/patchwork | patchwork/urls.py | Python | gpl-2.0 | 12,262 |
#!/usr/bin/env python
#coding:utf-8
# Purpose:
# Created: 10.04.12
# Copyright (C) 2012, Manfred Moitzi
# License: MIT
import ezodf2
from ezodf2.text import Paragraph, Heading
from ezodf2.whitespaces import SoftPageBreak
name = 'pageBreakText.odt'
odt = ezodf2.newdoc(doctype=name[-3:], filename=name)
... | iwschris/ezodf2 | examples/odt_04_page_break.py | Python | mit | 559 |
import subprocess
import tempfile
import gzip
try:
transtab = str.maketrans('ACGTNacgtn','TGCANtgcan')
except:
import string
transtab = string.maketrans('ACGTNacgtn','TGCANtgcan')
revcompdict = {}
def revcomp(sequence):
"""Reverse complement a string
:param sequence: The DNA string (all caps)
... | lowks/SDST | seqtools/utils.py | Python | mit | 2,259 |
from django.test import TestCase
from ddah_web.templatetags import simple_accomplishment, all_template_tags
# Ok so in order for this templatetags to work with
# moustache they have to be python functions
class TemplateTagsTestCase(TestCase):
def setUp(self):
pass
def test_simple_accomplishment_is_in... | goinnn/deldichoalhecho | ddah_web/tests/template_tags_tests.py | Python | gpl-3.0 | 768 |
from django.apps import AppConfig
class SiteopsConfig(AppConfig):
name = 'siteops'
| ops-org/sistema-ops-backend | siteops/apps.py | Python | gpl-3.0 | 89 |
import os
import sys
import operator
import time
import numpy as np
from copy import deepcopy
from owanimo.app.algorithm import base
from owanimo.util import define
from owanimo.util.log import LOG as L
def change(ls):
result = []
for l in ls: result.append(l[0]*10+l[1])
return result
class Node(object):... | setsulla/owanimo | lib/puyo/bin/schezo.py | Python | mit | 3,141 |
# Copyright (c) 2012 Calin Crisan <ccrisan@gmail.com>
#
# This file is part of PiLowLib.
#
# PiLowLib 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 version 3 of the License, or
# (at your optio... | ccrisan/pilowlib | pilowlib/__init__.py | Python | lgpl-3.0 | 1,125 |
#!/usr/bin/env python
# Copyright 2015-2016 Scott Bezek and the splitflap contributors
#
# 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/LICENS... | jmwright/oshw-code | kicad_to_svg_converter/libs/export_util.py | Python | apache-2.0 | 3,232 |
# Copyright 2013 Daniel Narvaez
#
# 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... | dnarvaez/osbuild | osbuild/run.py | Python | apache-2.0 | 1,688 |
from ._version import __version__
import os
import matplotlib
# To avoid Runtime Error
# RuntimeError: Python is not installed as a framework. The Mac OS X backend
# will not be able to function correctly if Python is not installed as a framework.
# See the Python documentation for more information on installing Pyth... | ltesti/pmstracks | pmstracks/__init__.py | Python | gpl-3.0 | 997 |
# This empty file is kept around just to keep Django happy...
| jgerigmeyer/jquery-django-messages-ui | messages_ui/models.py | Python | mit | 62 |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 12 13:25:55 2016
Fetch tracks info from EchoNest and LastFM
@author: xhong
"""
from billboard import billboard
from echonest import fetchEchoNest
from lastfm import fetchLastFM
import sqlite3 as lite
import time
import types
import pickle
import os.path
def form_track(s... | tonyhong272/MusicML | DataScraping/fetchTracks.py | Python | mit | 5,917 |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | pyfa-org/eos | eos/eve_obj/effect/repairs/ship_module_ancillary_remote_shield_booster.py | Python | lgpl-3.0 | 1,564 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
import pytest
from flexmock import flexmock
from dockerfile_parse import DockerfileParser
from atomi... | jpopelka/atomic-reactor | tests/plugins/test_add_dockerfile.py | Python | bsd-3-clause | 6,215 |
# -*- coding: utf-8 -*-
{
'!langcode!': 'fr',
'!langname!': 'Français',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" est une expression optionnelle comme "champ1=\'nouvellevaleur\'". Vous ne pouvez mettre à jour ou supprimer les résultats ... | laminko/wBlog | languages/fr.py | Python | mit | 11,160 |
#!/usr/bin/env python
# @@ bmo
# @T type event
# @T category audit
# @T eventsource CEREAL
# @Q summary: login
import sys
import json
import re
def procln(ev):
ret = {'valid': False, 'name': 'bmo'}
if 'utctimestamp' not in ev:
return ret
ret['timestamp'] = ev['utctimestamp']
if 'summary' not ... | ameihm0912/geomodel | plugin/bmo.py | Python | mpl-2.0 | 750 |
"""
desisim.pixsim
==============
Tools for DESI pixel level simulations using specter
"""
from __future__ import absolute_import, division, print_function
import sys
import os
import os.path
import random
from time import asctime
import socket
import astropy.units as u
import numpy as np
import desimodel.io
impo... | desihub/desisim | py/desisim/pixsim.py | Python | bsd-3-clause | 30,517 |
from sigvisa.plotting.event_heatmap import EventHeatmap
import numpy as np
import scipy.stats
import os
from matplotlib.patches import Circle
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
import matplotlib.cm as cm
from sigvisa import Sigvisa
from sigvisa.models.spa... | davmre/treegp | experiments/vis/plot_fitz.py | Python | gpl-3.0 | 7,109 |
# return a list of exactly len(rebootTimes) lists
# result[k] -> list of job indexes for server k
# 30 minutes to read problem and write this code
rebootTimes = [ 30, 45, 20]
jobTimes = [ 30, 45, 20, 30, 15, 10, 20, 15, 40, 20, 25, 30, 10, 15, 30, 20, 5, 35]
def schedule_jobs(rebootTimes, jobTimes):
p... | swirlingsand/self-driving-car-nanodegree-nd013 | interview-quizes/server_times.py | Python | mit | 1,772 |
from django.contrib.auth import authenticate
from django.contrib.auth import login as loginUser
from django.contrib.auth import logout as logoutUser
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.models import User
from django.http import HttpResponse, HttpResponseRedir... | AndyGrant/EtherealBenchmarking | EtherBench/views.py | Python | gpl-3.0 | 11,198 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/datashare/azure-mgmt-datashare/setup.py | Python | mit | 2,675 |
'''
Renamedcoin base58 encoding and decoding.
Based on https://renamedcointalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
# for compatibility with following code...
class SHA256:
new = hashlib.sha256
if str != bytes:
# Python 3.x
def ord(c):
return c
def chr(n):
ret... | Earlz/renamedcoin | contrib/testgen/base58.py | Python | mit | 2,834 |
"""Define tests for the Awair config flow."""
from unittest.mock import patch
from python_awair.exceptions import AuthError, AwairError
from homeassistant import data_entry_flow
from homeassistant.components.awair.const import DOMAIN
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_REAUTH, SOURCE_USER
... | jawilson/home-assistant | tests/components/awair/test_config_flow.py | Python | apache-2.0 | 6,877 |
"""
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
\
2
/
3
return [1,3,2].
Note: Recursive solution is trivial, could you do it iteratively?
confused what "{1,#,2,3}" means? > read more on how binary tree is seriali... | algorhythms/LeetCode | 095 Binary Tree Inorder Traversal.py | Python | mit | 2,480 |
"""
Auteur: Bruno DELATTRE
Date : 07/08/2016
"""
import urllib.parse
import urllib.request
import requests
from bs4 import BeautifulSoup
from lib import com_config, com_email, com_logger, com_sqlite
class Scraper:
@staticmethod
def scrap():
logger = com_logger.Logger('Scraper')
url_start = ... | delattreb/WebScraper-Le-Bon-Coin | src/scraper.py | Python | gpl-3.0 | 10,274 |
# -*- coding: utf-8 -*-
#
# Copyright © 2014 Spyder development team
# Licensed under the terms of the New BSD License
#
# DataFrameModel is based on the class ArrayModel from array editor
# and the class DataFrameModel from the pandas project.
# Present in pandas.sandbox.qtpandas in v0.13.1
# Copyright (c) 2011-2012, ... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/spyderlib/widgets/dataframeeditor.py | Python | gpl-3.0 | 22,985 |
"""
Facebook platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.facebook/
"""
import json
import logging
from aiohttp.hdrs import CONTENT_TYPE
import requests
import voluptuous as vol
from homeassistant.const import CO... | jamespcole/home-assistant | homeassistant/components/facebook/notify.py | Python | apache-2.0 | 4,284 |
# Copyright 2007 by Michiel de Hoon. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""
This module provides code to work with the sprotXX.dat file from
SwissProt.
http://www.ex... | BlogomaticProject/Blogomatic | opt/blog-o-matic/usr/lib/python/Bio/SwissProt/__init__.py | Python | gpl-2.0 | 20,449 |
# encoding: utf-8
import os
import re
import shutil
import subprocess
import tempfile
import textwrap
import time
from test.constant import (ARR_D, ARR_L, ARR_R, ARR_U, BS, ESC, PYTHON3,
SEQUENCES)
def wait_until_file_exists(file_path, times=None, interval=0.01):
while times is None o... | wincent/ultisnips | test/vim_interface.py | Python | gpl-3.0 | 6,882 |
#!/usr/bin/python2.7
# Copyright 2012 Google Inc. 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 requi... | saicheems/discovery-artifact-manager | google-api-client-generator/src/googleapis/codegen/cpp_generator.py | Python | apache-2.0 | 29,362 |
# -*- coding: utf-8 -*-
"""
A list of Peru regions as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from __future__ import unicode_literals
REGION_CHOICES = (
('AMA', 'Amazonas'),
('ANC', 'Ancash'),
('APU', 'Apurímac'),
... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/contrib/localflavor/pe/pe_region.py | Python | bsd-3-clause | 854 |
# -- encoding: UTF-8 --
from django.forms import TypedChoiceField
from django.forms.fields import TypedMultipleChoiceField
from django.utils.encoding import force_text
__all__ = ["EnumChoiceField", "EnumMultipleChoiceField"]
class EnumChoiceFieldMixin(object):
def prepare_value(self, value):
# Widgets exp... | jessamynsmith/django-enumfields | enumfields/forms.py | Python | mit | 951 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np # import biblioteki do obliczeń naukowych
import matplotlib.pyplot as plt # import biblioteki do tworzenia wykresów
import mcpi.minecraft as minecraft # import modułu minecraft
import mcpi.block as block # import modułu block
os.environ["U... | koduj-z-klasa/python101 | docs/mcpi/funkcje/mcpi-funkcje02.py | Python | mit | 2,942 |
# -*- coding: utf-8 -*-
# Copyright 2016 upvm Contributors (see CONTRIBUTORS.md file in source)
# License: Apache License 2.0 (see LICENSE file in source)
# Modules from standard library
from __future__ import print_function
import subprocess
import os
import tempfile
from sys import exit
import pwd, grp
import json
f... | ryran/upvm | modules/sysvalidator.py | Python | apache-2.0 | 9,829 |
#!/usr/bin/python
from sys import argv
from socket import *
################################################################################
def SendBroadcast(ScreenId):
print "Sending Broadcast Screen Id =", ScreenId
broadcast = socket(AF_INET, SOCK_DGRAM)
broadcast.bind(('', 0))
broadcast.setsockopt(SOL_SOC... | dloman/FiestaMonsterz | SendBroadcast.py | Python | gpl-3.0 | 787 |
import os
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = []
TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'en-us'
USE_I18N = True
USE_L10N = True
USE_TZ = True
MEDIA_ROOT = os.path.join(os.path.dirname(__file__), '..', '..', '..', 'media')
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(os.path.dirname(__file__), '..',... | nikdoof/limetime | app/limetime/conf/base.py | Python | bsd-3-clause | 2,162 |
import pyxhook | Sunhick/keylogger | Client/Hook/__init__.py | Python | gpl-3.0 | 14 |
import CTK
TABLE = [
('Primero', 'First', '1st'),
('Segundo', 'Second', '2nd'),
('Tercero', 'Third', '3rd'),
('Cuarto', 'Fourth', '4th'),
('Quito', 'Fifth', '5th'),
('Sexto', 'Sixth', '6th')
]
def table_reordered (post_key):
print "New Order", CTK.post[post_key].split(',')
ret... | cherokee/pyscgi | tests/test3.py | Python | bsd-3-clause | 815 |
#!/usr/bin/python
# Generate .js files defining Blockly core and language messages.
#
# Copyright 2013 Google Inc.
# https://developers.google.com/blockly/
#
# 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 t... | NTUTVisualScript/Visual_Script | static/javascript/blockly/i18n/create_messages.py | Python | mit | 6,374 |
#!/usr/bin/env python
import sys
from datetime import datetime, timedelta
from opendrift.models.openoil3D import OpenOil3D
from opendrift.readers import reader_netCDF_CF_generic
if __name__ == '__main__':
if len(sys.argv) == 1:
mode = 'fast'
if len(sys.argv) == 2:
mode = sys.argv[1]
i... | knutfrode/opendrift | tests/benchmarks/performance_test_oil.py | Python | gpl-2.0 | 2,348 |
"""Contains the Tilt mode code."""
from typing import List, Any, Optional
from mpf.core.events import EventHandlerKey
from mpf.core.events import QueuedEvent
from mpf.core.mode import Mode
class Tilt(Mode):
"""A mode which handles a tilt in a pinball machine.
Note that this mode is always running (even dur... | missionpinball/mpf | mpf/modes/tilt/code/tilt.py | Python | mit | 10,908 |
from werkzeug import redirect
from werkzeug.exceptions import NotFound
from shorty.utils import Session, Pagination, render_template, expose, \
validate_url, url_for
from shorty.models import URL
@expose('/')
def new(request):
error = url = ''
if request.method == 'POST':
url = request.form.get('u... | dbbhattacharya/kitsune | vendor/packages/Werkzeug/examples/shorty/views.py | Python | bsd-3-clause | 1,742 |
from seedbox import config
from seedbox.config_renderer.ignition.base import BaseIgnitionPackage
class K8sMasterManifestsPackage(BaseIgnitionPackage):
def get_files(self):
return [
{
'filesystem': 'root',
'path': config.k8s_service_account_public_key_path,
... | nailgun/seedbox | src/seedbox/config_renderer/ignition/k8s_master_manifests/__init__.py | Python | apache-2.0 | 1,789 |
# ST2/ST3 compat
from __future__ import print_function
import sublime
if sublime.version() < '3000':
# we are on ST2 and Python 2.X
_ST3 = False
else:
_ST3 = True
import sublime_plugin
# Insert environment closer
# this only looks at the LAST \begin{...}
# need to extend to allow for neste... | dostavro/dotfiles | sublime2/Packages/LaTeXTools/latexEnvCloser.py | Python | mit | 1,317 |
# pylint: disable-msg=C0103
"""
Functions related to Salt jobs from minions
"""
import logging
from saltwalk.inventory import LIST_PKGS_CMD
from saltwalk.inventory import NETWORK_IFACES_CMD
from saltwalk.inventory import process_network_ifaces_result
from saltwalk.inventory import process_package_list_result
logger =... | SUSE/spacewalk-saltstack | saltwalk/jobs.py | Python | mit | 1,367 |
__author__ = 'Ricter'
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '*8+)vnxta_02rp8w@($8(^ui*td+9xurz@x_j9^h^wv_58p4-t' | RicterZ/AnimeReminder | project_anime/local_settings.py | Python | gpl-2.0 | 155 |
import gdb
class HelloWorld (gdb.Command):
"""Greet the whole world."""
def __init__ (self):
#gdb.Command.__init__ (self, "hello", gdb.COMMAND_DATA)
super(HelloWorld,self).__init__ ( "hello", gdb.COMMAND_DATA)
def invoke (self, arg, from_tty):
print "Hello, World!"
HelloWorld ()
| sigma-random/PyGDB | gdb-hello.py | Python | gpl-2.0 | 306 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-08-31 14:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('checkout', '0010_auto_20170614_1434'),
]
operation... | martinstastny/django-simplestore | simplestore/checkout/migrations/0011_auto_20170831_1618.py | Python | mit | 654 |
# -*- coding: utf-8 -*-
# pylint: disable=too-many-public-methods
"""
Unit tests for JSON lines message parser.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import unittest
from spreadflow_core.format import JsonMessageParser
class JsonParserTes... | spreadflow/spreadflow-core | spreadflow_core/test/test_json_parser.py | Python | mit | 1,745 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import itertools
import uuid
from enum import Enum, unique
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.contenttypes.fields import GenericForeignKey
from dj... | absperf/wagtailapproval | wagtailapproval/models.py | Python | bsd-2-clause | 17,695 |
"""
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.
The tests in this file are inherited from the BaseExtensionTests, and only
minimal ... | amolkahat/pandas | pandas/tests/extension/test_integer.py | Python | bsd-3-clause | 6,498 |
"""
Hybrid-TD Learning Algorithm, via Adam White's doctoral thesis, pg. 173.
Like GTD(λ), it doesn't diverge in the off-policy case, while acting like TD(λ)
in the on-policy case, particularly with regards to good sample efficiency.
In Latex, the update equations look like:
δ_{t} = R_{t+1} + γ_{t+1} w_{t}^T x_{t+1... | rldotai/rl-algorithms | py3/htd.py | Python | mit | 4,061 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.cogdominium.CogdoFlyingGuiManager
from panda3d.core import NodePath
from toontown.toonbase import ToontownIntervals
from toontown.toonbase.ToontownTimer import ToontownTimer
from CogdoFlyingGameGuis import CogdoFlyingFuelGui, CogdoFlyingProgressGui... | DedMemez/ODS-August-2017 | cogdominium/CogdoFlyingGuiManager.py | Python | apache-2.0 | 6,541 |
# encoding=utf-8
__author__ = 'Q-Whai'
'''
DESC: 测试SQL注入
Blog: http://blog.csdn.net/lemon_tree12138
Create Date: 2016/3/9
Last Modify: 2016/3/9
version: 0.0.1
'''
import db.db_server as db1
CREATE_TABLE_SQL = 'CREATE TABLE student(id INT, name TEXT, sex INT, age INT);'
INSERT_SQL = 'INSERT student(id, name, sex, ag... | William-Hai/SimpleDemo-python | db/demo_db_inject.py | Python | gpl-3.0 | 747 |
def get_ip_address(request):
# may also come from X-HTTP-FORWARDED-FOR
return request.META.get('REMOTE_ADDR')
def get_user_agent(request):
return request.META.get('HTTP_USER_AGENT')[:255]
| mrts/foodbank-campaign | src/utils/request.py | Python | mit | 201 |
"""
Creer par Antoine Leonard
antoine@antbig.fr
"""
import Colors
import Line
class PlayerInput(object):
def __init__(self, nbcolor):
self.nbcolor = nbcolor
self.line = Line.Line()
def askforanswer(self):
stringvalue = ""
for color in Colors.COLORS:
st... | antbig/MasterMind | PlayerInput.py | Python | gpl-2.0 | 1,125 |
"""SCons.Script
This file implements the main() function used by the scons script.
Architecturally, this *is* the scons script, and will likely only be
called from the external "scons" wrapper. Consequently, anything here
should not be, or be considered, part of the build engine. If it's
something that we expect ot... | pnorman/mapnik | scons/scons-local-2.4.1/SCons/Script/Main.py | Python | lgpl-2.1 | 53,053 |
#!/usr/bin/env python
__author__ = "Meet Shah"
__license__ = "MIT"
import tensorflow as tf
def init_weights(shape, name):
return tf.get_variable(name, shape=shape, initializer=tf.contrib.layers.xavier_initializer())
def init_biases(shape):
return tf.Variable(tf.zeros(shape))
def batchNorm(x, n_out, ... | meetshah1995/tf-3dgan | src/utils.py | Python | mit | 2,032 |
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Model, NOT_PROVIDED, DateTimeField
from django.utils import timezone
from django.utils.encoding import smart_text
def track_field(field):
"""
Returns whether the given field should be tracked by... | kbussell/django-auditlog | src/auditlog/diff.py | Python | mit | 5,123 |
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from oscar.app import shop
admin.autodiscover()
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'', include(shop.urls)),
url(r'^i18n/', include('d... | marcoantoniooliveira/labweb | tests/_site/urls.py | Python | bsd-3-clause | 388 |
# Copyright (c) 2012 NetApp, Inc. All rights reserved.
# Copyright (c) 2014 Ben Swartzlander. All rights reserved.
# Copyright (c) 2014 Navneet Singh. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Andrew Ker... | julianwang/cinder | cinder/volume/drivers/netapp/dataontap/block_base.py | Python | apache-2.0 | 37,442 |
from . import services
def prep_rules(rules):
prepped = []
for rule in rules:
if rule['enabled']:
prepped.append(prep_rule(rule))
return prepped
def prep_rule(raw_rule):
rule = dict(raw_rule)
if rule['service'] != 'custom':
proto, port = services.decode_service(rul... | Kromey/piroute | iptables/utils.py | Python | mit | 808 |
"""Test the classes and functions defined by gg/photos.py"""
from time import struct_time
from mock import Mock, call
from tests import BaseTestCase
class point:
def __init__(self, lat, lon, ele):
self.lat = lat
self.lon = lon
self.ele = ele
class GError(Exception):
pass
class Ph... | TheNeuralBit/gottengeography | tests/test_photos.py | Python | gpl-3.0 | 16,202 |
from collections import deque
from enum import Enum
from twisted.internet import reactor
from twisted.internet.protocol import Protocol, ClientFactory
from ..utils.logging import *
from ..crypto.crypto import *
from ..client.client_session import *
class HermesClientProtocol(Protocol):
class State(Enum):
... | Abraxos/hermes | hermes-api/hermeslib/hermeslib/client/hermes_client.py | Python | gpl-3.0 | 5,093 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/TEX/PDFLATEXCOM.py | Python | mit | 1,935 |
###############################################################################
#
# seqUtils.py - Common functions for interacting with sequences
#
###############################################################################
# #
# T... | dparks1134/DBB | dbb/seqUtils.py | Python | gpl-3.0 | 8,255 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bt_demo.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sbaechler/braintree-django-demo | manage.py | Python | mit | 250 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | zhimin711/nova | nova/virt/xenapi/image/bittorrent.py | Python | apache-2.0 | 3,223 |
import json
from social.p3 import urlencode
from social.tests.backends.oauth import OAuth1Test
class TwitterOAuth1Test(OAuth1Test):
backend_path = 'social.backends.twitter.TwitterOAuth'
user_data_url = 'https://api.twitter.com/1.1/account/' \
'verify_credentials.json'
expected_use... | cjltsod/python-social-auth | social/tests/backends/test_twitter.py | Python | bsd-3-clause | 9,385 |
import time
import random
from contextlib import contextmanager
from multiprocessing import Lock, BoundedSemaphore, Value
class RequestManager:
def __init__(self, max_workers):
self.max_workers = max_workers
self.lock = Lock()
self.sem = BoundedSemaphore(max_workers)
self.last_requ... | logicalhacking/ExtensionCrawler | ExtensionCrawler/request_manager.py | Python | gpl-3.0 | 1,347 |
# -*- coding: utf-8 -*-
# Copyright 2003, 2004, 2019 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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,... | unioslo/cerebrum | Cerebrum/modules/entity_expire/entity_expire.py | Python | gpl-2.0 | 5,035 |
#!/usr/bin/python
letters = ['A', 'C', 'G', 'T']
def make_table():
table = [0] * 256
for i in xrange(256):
bin_vals = [0] * 4
rev_vals = [0] * 4
bin_vals[0] = i & 3
bin_vals[1] = (i >> 2) & 3
bin_vals[2] = (i >> 4) & 3
bin_vals[3] = (i >> 6) & 3
re... | sylvainforet/libngs | src/libngs/make_revcomp_table.py | Python | gpl-3.0 | 1,115 |
###
### InstallUtil.py
###
### Usage: lib/ipy util/MSBuild.py <Verb> <Configuration> <Platform> <DistDir>
###
import clr
import sys
from System import *
from System.IO import *
from System.Diagnostics import *
fxdir = DirectoryInfo(Path.Combine(
Environment.GetEnvironmentVariable("WINDIR"),
"Microsoft.NET"
))
if l... | takeshik/metatweet-old | util/InstallUtil.py | Python | gpl-3.0 | 1,298 |
# coding: utf-8
#
# Copyright (C) 2012-2016 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Sof... | kif/dahu | dahu/test/utilstest.py | Python | gpl-2.0 | 14,699 |
# This file is part of wger Workout Manager <https://github.com/wger-project>.
# Copyright (C) 2013 - 2021 wger Team
#
# wger Workout Manager 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 ... | wger-project/wger | wger/measurements/tests/__init__.py | Python | agpl-3.0 | 802 |
#!/usr/bin/python
import sys, os, commands
print 'building the valgrind tool'
print
verbose = int(os.getenv('VERBOSE',0))
valgrind_root = os.getenv('CT_VALGRIND_SRC_DIR')
if not valgrind_root:
print 'please edit defaults.mk so that $CT_VALGRIND_SRC_DIR points to your Valgrind source distribution'
sys.exit(1)... | jinxuan/checkedthreads | valgrind/build.py | Python | bsd-2-clause | 1,892 |
def prefix_range_end(prefix):
"""Create a bytestring that can be used as a range_end for a prefix."""
s = bytearray(prefix)
for i in reversed(range(len(s))):
if s[i] < 0xff:
s[i] = s[i] + 1
break
return bytes(s)
def to_bytes(maybe_bytestring):
"""
Encode string ... | kragniz/python-etcd3 | etcd3/utils.py | Python | apache-2.0 | 1,132 |
# python-jinjatools
#
# Various tools for Jinja2,
# including new filters and tests based on python-moretools,
# a JinjaLoader class for Django,
# and a simple JinjaBuilder class for SCons.
#
# Copyright (C) 2011-2015 Stefan Zimmermann <zimmermann.code@gmail.com>
#
# python-jinjatools is free software: you can redistri... | userzimmermann/python-jinjatools | jinjatools/env.py | Python | gpl-3.0 | 1,555 |
#!/usr/bin/env python3
from os import path
from setuptools import setup
import apertium_init
setup(
name='apertium-init',
version=apertium_init.__version__,
license=apertium_init.__license__,
description='Bootstrap Apertium language modules and pairs',
long_description=open(path.join(path.abspath... | goavki/bootstrap | setup.py | Python | gpl-3.0 | 1,392 |
"""
A Self Assessment module that allows students to write open-ended responses,
submit, then see a rubric and rate themselves. Persists student supplied
hints, answers, and assessment judgment (currently only correct/incorrect).
Parses xml definition file--see below for exact format.
"""
import json
import logging
f... | olexiim/edx-platform | common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py | Python | agpl-3.0 | 36,788 |
import unittest
from automata.automata_classifier import is_final_sink
from interfaces.automaton import Node, Label
class ClassifierTest(unittest.TestCase):
def test_is_not_absorbing(self):
node = Node('node')
true_label = Label({})
node.add_transition(true_label, [('dst1', True)])
... | 5nizza/party-elli | automata/tests_automata_classifier.py | Python | mit | 865 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Matthias Klumpp <mak@debian.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.0 of the License, or (at your option) any la... | limba-project/limba-hub | lihub/repository/models.py | Python | gpl-3.0 | 4,844 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import inspect
from datetime import datetime
import freezegun
import pytest
from sqlalchemy import DateTi... | mic4ael/indico | indico/testing/fixtures/util.py | Python | mit | 2,040 |
# Copyright 2021 The TensorFlow Probability 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 applicable law o... | tensorflow/probability | spinoffs/fun_mc/fun_mc/using_jax.py | Python | apache-2.0 | 1,013 |
from os import path
from matlab import engine
class IOHmmModel(object):
def __init__(self):
self.__nstates = 0
self.__ostates = 0
self.__strt_prob = None # start probability of hidden states, shape = 1 * S fake...
self.__tmat0 = None # transition matrix with no bonus, shape =... | guanhuamai/DPM | PythonSource/BonusAllocatorLib/IOHmmModel.py | Python | mit | 3,724 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cstr
from frappe import _
from erpnext.stock.doctype.item.item import get_last_purchase_details
from erpnex... | Tejal011089/trufil-erpnext | erpnext/buying/doctype/purchase_common/purchase_common.py | Python | agpl-3.0 | 4,125 |
"""Copyright (c) 2012 Nezar Abdennur
This module contains code adapted from the Python implementation of the heapq
module, which was written by Kevin O'Connor and augmented by Tim Peters and
Raymond Hettinger.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated... | SystemsBioinformatics/stochpy | stochpy/tools/Priority_queue.py | Python | gpl-3.0 | 17,820 |
# -*- coding: utf-8 -*-
from django.db import models, connection
from tavling.utils import add_results, combine_results
SIZES = (('S', 'Small'), ('M', 'Medium'), ('L', 'Large'))
KLASS = (('A', 'Agility'), ('J', 'Hopp'))
TEAMORDER = (('A', 'A'),
('B', 'B'),
('C', 'C'),
('D', 'D'))... | derfian/lagtavling | tavling/models.py | Python | gpl-2.0 | 5,427 |
from utils.testcase import EndpointTestCase
from rest_framework import status
from rest_framework.test import APIClient
import sure
class TestLogin(EndpointTestCase):
def test_login_successful(self):
client = APIClient()
response = client.get('/login', {'name': 'a', 'password': 'a'})
res... | Amoki/Amoki-Music | endpoints/tests/test_login.py | Python | mit | 1,502 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.