commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
c8dea883af662341b2dc22927f71a4bd06e62244 | Add a streamingtestcase base (starting) | jnadler/spark-testing-base,mahmoudhanafy/spark-testing-base,joychugh/spark-testing-base,MiguelPeralvo/spark-testing-base,joychugh/spark-testing-base,ghl3/spark-testing-base,jnadler/spark-testing-base,samklr/spark-testing-base,jnadler/spark-testing-base,eyeem/spark-testing-base,holdenk/spark-testing-base,ponkin/spark-te... | python/sparktestingbase/streamingtestcase.py | python/sparktestingbase/streamingtestcase.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 | Python | |
104bb1ec056e28c7e04e06603e6997e80a8f89f4 | fix typo (#5267) | pluskid/mxnet,piiswrong/mxnet,lxn2/mxnet,CodingCat/mxnet,jamesliu/mxnet,sxjscience/mxnet,dmlc/mxnet,tlby/mxnet,LinkHS/incubator-mxnet,madjam/mxnet,madjam/mxnet,hpi-xnor/BMXNet,vikingMei/mxnet,coder-james/mxnet,ForkedReposBak/mxnet,wangyum/mxnet,jermainewang/mxnet,wangyum/mxnet,stefanhenneking/mxnet,solin319/incubator-m... | example/ssd/dataset/testdb.py | example/ssd/dataset/testdb.py | import os
from imdb import Imdb
class TestDB(Imdb):
"""
A simple wrapper class for converting list of image to Imdb during testing
Parameters:
----------
images : str or list of str
image path or list of images, if directory and extension not
specified, root_dir and extension are ... | import os
from imdb import Imdb
class TestDB(Imdb):
"""
A simple wrapper class for converting list of image to Imdb during testing
Parameters:
----------
images : str or list of str
image path or list of images, if directory and extension not
specified, root_dir and extension are ... | apache-2.0 | Python |
d38751f466f2b76f71dc716b85cdd1ffbabd481d | Add 2 new skills: concentration and all round, with sentences in English and Japanese | SchoolIdolTomodachi/CinderellaProducers,SchoolIdolTomodachi/CinderellaProducers | cpro/migrations/0015_auto_20170217_0801.py | cpro/migrations/0015_auto_20170217_0801.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import cpro.models
class Migration(migrations.Migration):
dependencies = [
('cpro', '0014_auto_20170129_2236'),
]
operations = [
migrations.AlterField(
model_name='card',... | apache-2.0 | Python | |
c1a9bd1029ad0f6b87a05b2a7bade351c485546e | add collector for http://data.phishtank.com/ | spantons/attacks-pages-collector | collectors/phishtank.py | collectors/phishtank.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import re
import bz2
import requests
import ipwhois
from pprint import pprint
def get_url(url):
try:
res = requests.get(url)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("DNS lookup failures")
... | mit | Python | |
d35423336578df2332cb90083cd3d7497f2076f5 | join stats | ModernMT/DataCollection,ModernMT/DataCollection,ModernMT/DataCollection,ModernMT/DataCollection,ModernMT/DataCollection | metadata/lang_stats/join_stats.py | metadata/lang_stats/join_stats.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
from math import log
def entropy(lang_dist):
total = float(sum(lang_dist.values()))
h = 0
for lang, count in lang_dist.iteritems():
p = count / total
h += p * log(p)
return h
if __name__ == ... | apache-2.0 | Python | |
d28b8f20fb052eea958aa1a3c5d1bec0cb5bde9b | Add default UUID generation function | globality-corp/microcosm-postgres,globality-corp/microcosm-postgres | microcosm_postgres/identifiers.py | microcosm_postgres/identifiers.py | """
Identifier utilities.
"""
from uuid import uuid4
def new_object_id():
"""
Use randomized UUIDs by default.
"""
return uuid4()
| apache-2.0 | Python | |
1a3f2eaa8bfadfa368a32abcc1a0173ad521fafb | Add django-oidc-provider userinfo support | montudor/django-oidc-user | django_oidc_user/oidc_provider.py | django_oidc_user/oidc_provider.py | def userinfo(claims, user):
claims['name'] = '{0} {1}'.format(user.first_name, user.last_name)
claims['given_name'] = user.first_name
claims['family_name'] = user.last_name
claims['preferred_username'] = user.username
claims['website'] = user.website
claims['zoneinfo'] = user.zoneinfo
cliams['locale'] = user.loc... | mit | Python | |
603caefa5fd9e10690f78a133e005059de414e0b | Add OpenStreetMap | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | services/openstreetmap.py | services/openstreetmap.py | from xml.dom import minidom
from werkzeug.urls import url_decode
import foauth.providers
class OpenStreetMap(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'http://www.openstreetmap.org/'
docs_url = 'http://wiki.openstreetmap.org/wiki/API'
category = 'Mapping'
# URLs ... | bsd-3-clause | Python | |
5c90d5145d0f05aae1f01747af0c35c2daf7f7f2 | add await pool example | aio-libs/aiomysql | examples/example_pool.py | examples/example_pool.py | import asyncio
import aiomysql
async def test_example(loop):
pool = await aiomysql.create_pool(host='127.0.0.1', port=3306,
user='root', password='',
db='mysql', loop=loop)
async with pool.acquire() as conn:
async with conn.cu... | mit | Python | |
9f614ab50508e6f813873e6199ea57a5f1a29c87 | Add script to help with testing interactive examples. | percyfal/bokeh,Karel-van-de-Plassche/bokeh,philippjfr/bokeh,timothydmorton/bokeh,dennisobrien/bokeh,aavanian/bokeh,deeplook/bokeh,laurent-george/bokeh,ChristosChristofidis/bokeh,gpfreitas/bokeh,timsnyder/bokeh,PythonCharmers/bokeh,phobson/bokeh,schoolie/bokeh,DuCorey/bokeh,carlvlewis/bokeh,aiguofer/bokeh,DuCorey/bokeh,... | examples/interactiveTester.py | examples/interactiveTester.py | # "bokeh is imported and unused as a quick way to check for directory bokeh/bokeh/static/js
# which is required for many (but not all) examples to run properly.
import bokeh
import glob
import os
import sys
# TODO: --no-log option
# --test-all option (run through tests on every file in a given directory, rather ... | bsd-3-clause | Python | |
1875c5f1a813abda0ecf52b5b2604011fe2f2c15 | Add a sample Pre/Post job | ThinkboxSoftware/Deadline,ThinkboxSoftware/Deadline,ThinkboxSoftware/Deadline | Examples/Scripting/PostJob/Sample/Sample.py | Examples/Scripting/PostJob/Sample/Sample.py | #Python.NET
###############################################################
# This is an Python.net/CPython script. #
# To use IronPython, remove "#Python.NET" from the first #
# line of this file. Make sure you don't use the quotes. #
####################################################... | apache-2.0 | Python | |
2c179160715e6384d41ddf119e6df965ed53eefe | Add documenteer.sphinxext subpackage | lsst-sqre/documenteer,lsst-sqre/sphinxkit,lsst-sqre/documenteer | documenteer/sphinxext/__init__.py | documenteer/sphinxext/__init__.py | """Sphinx/docutils extensions for LSST DM documentation."""
"""Sphinx/docutils extensions for LSST DM documentation.
Enable these extension by adding `documenteer.sphinxext` to your
extensions list in :file:`conf.py`::
extensions = [
# ...
'documenteer.sphinxext'
]
"""
| mit | Python | |
c774adea86682f721cad0a073390c5f43ef712a8 | Add reporting-to-times.py. | aaichsmn/tacc_stats,ubccr/tacc_stats,TACC/tacc_stats,TACC/tacc_stats,dimm0/tacc_stats,rtevans/tacc_stats_old,TACC/tacc_stats,TACC/tacc_stats,sdsc/xsede_stats,ubccr/tacc_stats,sdsc/xsede_stats,dimm0/tacc_stats,dimm0/tacc_stats,ubccr/tacc_stats,aaichsmn/tacc_stats,dimm0/tacc_stats,rtevans/tacc_stats_old,TACC/tacc_stats,u... | monitor/reporting-to-times.py | monitor/reporting-to-times.py | #!/usr/bin/env python
import datetime, os, sys, time
# reporting-to-times.py END_TIME_MIN END_TIME_MAX > FILE
# Print "JOBID START_TIME END_TIME HOST..." for each job that ended
# between END_TIME_MIN and END_TIME_MAX.
# reporting-to-times.py $(date -d 'Apr 1 2012' +%s) $(date -d 'Jul 1 2012' +%s) > 2012-03-01
prog_n... | lgpl-2.1 | Python | |
2af33db72d2c70b28359811d903dc0b2b5f6d32d | Add atomic firewall state | thusoy/salt-states,thusoy/salt-states,thusoy/salt-states,thusoy/salt-states | salt/_states/firewall.py | salt/_states/firewall.py | from collections import defaultdict
import difflib
import jinja2
import json
import os
import subprocess
RULES_TEMPLATE = jinja2.Template('''
{% if nat_rules %}
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
{% for chain in nat_chains|default([]) -%}
:{{ chain }} - [0:... | mit | Python | |
8bebea72536a8a6fc480631d737f2426f52a356c | Test for load a kern table with a bad glyph id. | googlefonts/fonttools,fonttools/fonttools | Lib/fontTools/ttLib/tables/_k_e_r_n_test.py | Lib/fontTools/ttLib/tables/_k_e_r_n_test.py | from __future__ import print_function, absolute_import
from fontTools.misc.py23 import *
from fontTools import ttLib
import unittest
from ._k_e_r_n import KernTable_format_0
class MockFont(object):
def getGlyphOrder(self):
return ["glyph00000", "glyph00001", "glyph00002", "glyph00003"]
... | mit | Python | |
c26ed45536157f0c4ed07ed4c4ecd72b184090a1 | Add tests | rakanalh/pocket-api,fullbright/gary-reporter,fullbright/gary-reporter | test_pocket.py | test_pocket.py | import responses
import pytest
from pocket import Pocket, PocketException
_consumer_key = 'test_consumer_key'
_access_token = 'test_access_token'
_pocket = None
def setup_function(function):
global _pocket
_pocket = Pocket(_consumer_key, _access_token)
def success_request_callback(request):
return 200,... | apache-2.0 | Python | |
a6ec585283c3f36c5811b9ad3e4bcd362a222bae | Add jvc network class | arvehj/jvcprojectortools | jvc_network.py | jvc_network.py | #!/usr/bin/env python3
"""JVC projector network connection module"""
import json
import select
import socket
import dumpdata
conf_file = 'jvc_network.conf'
class Error(Exception):
"""Error"""
pass
class Timeout(Exception):
"""Command Timout"""
pass
class JVCNetwork:
"""JVC projector network co... | apache-2.0 | Python | |
71efec085927ddf0636bdd069e46e87f7daed19b | Add reporting utilities | SciLifeLab/scilifelab,senthil10/scilifelab,jun-wan/scilifelab,senthil10/scilifelab,jun-wan/scilifelab,kate-v-stepanova/scilifelab,kate-v-stepanova/scilifelab,kate-v-stepanova/scilifelab,jun-wan/scilifelab,SciLifeLab/scilifelab,SciLifeLab/scilifelab,senthil10/scilifelab,SciLifeLab/scilifelab,jun-wan/scilifelab,kate-v-st... | scilifelab/report/__init__.py | scilifelab/report/__init__.py | """
Reporting utilities
"""
import sys
from mako.template import Template
from collections import OrderedDict
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import cm
from reportlab.platypus import Paragraph, SimpleDocTemplate
from reportlab.lib import colors
from reportlab.lib.pagesize... | mit | Python | |
aa79abc5bd71fc684e9ad096ec0ff69292e3caf9 | Add import os for crawl. | snowdream1314/scrapy,nguyenhongson03/scrapy,taito/scrapy,hansenDise/scrapy,redapple/scrapy,olorz/scrapy,taito/scrapy,joshlk/scrapy,smaty1/scrapy,shaform/scrapy,starrify/scrapy,dhenyjarasandy/scrapy,wangjun/scrapy,CENDARI/scrapy,jdemaeyer/scrapy,rolando-contrib/scrapy,raphaelfruneaux/scrapy,Ryezhang/scrapy,umrashrf/scra... | scrapy/commands/crawl.py | scrapy/commands/crawl.py | import os
from scrapy.command import ScrapyCommand
from scrapy.utils.conf import arglist_to_dict
from scrapy.exceptions import UsageError
class Command(ScrapyCommand):
requires_project = True
def syntax(self):
return "[options] <spider>"
def short_desc(self):
return "Run a spider"
... | from scrapy.command import ScrapyCommand
from scrapy.utils.conf import arglist_to_dict
from scrapy.exceptions import UsageError
class Command(ScrapyCommand):
requires_project = True
def syntax(self):
return "[options] <spider>"
def short_desc(self):
return "Run a spider"
def add_op... | bsd-3-clause | Python |
2658480cce8eff515074fa2e979487055a5d0a07 | Create a script to bump the version in changelog | PyCQA/astroid | script/bump_changelog.py | script/bump_changelog.py | """
This script permits to upgrade the changelog in astroid or pylint when releasing a version.
"""
import argparse
from datetime import datetime
from pathlib import Path
DEFAULT_CHANGELOG_PATH = Path("ChangeLog")
err = "in the changelog, fix that first!"
TBA_ERROR_MSG = "More than one release date 'TBA' %s" % err
NEW... | lgpl-2.1 | Python | |
94b179f444df3c017e356c1b1a8253e499ab8302 | Implement RGBColor trait for qt4 backend. | geggo/pyface,geggo/pyface,pankajp/pyface,brett-patterson/pyface | enthought/traits/ui/qt4/rgb_color_trait.py | enthought/traits/ui/qt4/rgb_color_trait.py | #------------------------------------------------------------------------------
#
# Copyright (c) 2009, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions... | bsd-3-clause | Python | |
cf7a36ac2666a57436aac6ba6fa97b7d29c21a3d | fix patch to clear lead customization | indictranstech/erpnext,njmube/erpnext,gsnbng/erpnext,Aptitudetech/ERPNext,geekroot/erpnext,geekroot/erpnext,njmube/erpnext,indictranstech/erpnext,njmube/erpnext,gsnbng/erpnext,njmube/erpnext,geekroot/erpnext,gsnbng/erpnext,indictranstech/erpnext,indictranstech/erpnext,geekroot/erpnext,gsnbng/erpnext | erpnext/patches/v7_1/update_lead_source.py | erpnext/patches/v7_1/update_lead_source.py | import frappe
from frappe import _
def execute():
from erpnext.setup.setup_wizard.install_fixtures import default_lead_sources
frappe.reload_doc('selling', 'doctype', 'lead_source')
frappe.local.lang = frappe.db.get_default("lang") or 'en'
for s in default_lead_sources:
frappe.get_doc(dict(doctype='Lead Sourc... | import frappe
from frappe import _
def execute():
from erpnext.setup.setup_wizard.install_fixtures import default_lead_sources
frappe.reload_doc('selling', 'doctype', 'lead_source')
frappe.local.lang = frappe.db.get_default("lang") or 'en'
for s in default_lead_sources:
frappe.get_doc(dict(doctype='Lead Sourc... | agpl-3.0 | Python |
ff3580c76d7a35d05c1334da4b15aa3d601ccdde | Create R_model_support.py | dubeyabhi07/clipper,dubeyabhi07/clipper,dubeyabhi07/clipper,dubeyabhi07/clipper | examples/tutorial_for_R/R_model_support.py | examples/tutorial_for_R/R_model_support.py | import requests
import sys
import numpy as np
import json
import scipy as sp
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
from pandas import *
import pandas.rpy.common as com
from rpy2.robjects.packages import importr
import rpy2.robjects as ro
stats = importr('stats')
base = importr('bas... | apache-2.0 | Python | |
66e8c43b6475d414a199f8ed4abb4876f0e86c42 | add google geocoder to fix missing values | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/DEV/adm/fix_latlon.py | scripts/DEV/adm/fix_latlon.py | ''' Fill in the missing lat/lon values '''
import urllib2
import json
import time
out = open('step2.csv', 'w')
cnt = 0
for linenum, line in enumerate(open('daryl_corey_data_110513.csv')):
if linenum == 0:
continue
tokens = line.split(",")
zipcode = tokens[11]
lon = tokens[13]
lat = tokens[... | mit | Python | |
0d5d5c5b1a9333651d952e8eaf3ce226d6e5e282 | Add Python script for animating 16 RGBW spots, mostly for testing speed | bitfasching/leodmx | examples/serial2dmx/animate-16x4ch.py | examples/serial2dmx/animate-16x4ch.py | #!/usr/bin/python
# import stuff
import sys
from serial import Serial
from time import sleep, time
# helper: coerce integer
def coerceInt( value, low, high ): return max( low, min( high, int(value) ) )
# parse required argument: automation
if len(sys.argv) >= 2:
preset = sys.argv[1]
else:
print
print "Us... | bsd-3-clause | Python | |
b77ff668f603673c1932948047e9190152367af7 | add google_compute_engine hook | dataversioncontrol/dvc,efiop/dvc,efiop/dvc,dataversioncontrol/dvc,dmpetrov/dataversioncontrol,dmpetrov/dataversioncontrol | scripts/hooks/hook-google_compute_engine.py | scripts/hooks/hook-google_compute_engine.py | from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('google-compute-engine')
| apache-2.0 | Python | |
7d89303fddd12fc88fd04bcf27826c3c801b1eff | Add a dummy script for continuous submission importing | lalinsky/acoustid-server,lalinsky/acoustid-server,lalinsky/acoustid-server,lalinsky/acoustid-server | scripts/import_submissions.py | scripts/import_submissions.py | #!/usr/bin/env python
# Copyright (C) 2012 Lukas Lalinsky
# Distributed under the MIT license, see the LICENSE file for details.
import json
from acoustid.script import run_script
from acoustid.data.submission import import_queued_submissions
logger = logging.getLogger(__name__)
def main(script, opts, args):
c... | mit | Python | |
206454788c6d054f8c562d4d5d13a737d9cb6d27 | Add tests for project serializer | beeftornado/sentry,ifduyue/sentry,gencer/sentry,ifduyue/sentry,beeftornado/sentry,gencer/sentry,mvaled/sentry,mvaled/sentry,gencer/sentry,looker/sentry,gencer/sentry,beeftornado/sentry,gencer/sentry,mvaled/sentry,looker/sentry,ifduyue/sentry,ifduyue/sentry,mvaled/sentry,looker/sentry,mvaled/sentry,looker/sentry,ifduyue... | tests/sentry/api/serializers/test_project.py | tests/sentry/api/serializers/test_project.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import six
from sentry.api.serializers import serialize
from sentry.api.serializers.models.project import (
ProjectWithOrganizationSerializer, ProjectWithTeamSerializer
)
from sentry.testutils import TestCase
class ProjectSerializerTest(TestCase):
... | bsd-3-clause | Python | |
cc07366ea3dab81cd9abbb5958ccde5833f7527a | drop in our boilerplate | pombredanne/drf-collection-methods,gizmag/drf-collection-methods | drf_collection_methods/__init__.py | drf_collection_methods/__init__.py | class CollectionMethodRouterMixin(object):
def get_routes(self, viewset):
# do some magic to hooked up our decorated methods
def collection_link(**kwargs):
def decorator(func):
func.bind_to_collection_methods = ['get']
func.kwargs = kwargs
return func
return decorator
def... | mit | Python | |
394b4e07014c5ade34531555577bf6253d3a5b1f | add colabe install script | miaecle/deepchem,miaecle/deepchem,peastman/deepchem,lilleswing/deepchem,peastman/deepchem,miaecle/deepchem,lilleswing/deepchem,deepchem/deepchem,deepchem/deepchem,lilleswing/deepchem | scripts/colab_install.py | scripts/colab_install.py | """
Original code by @philopon
https://gist.github.com/philopon/a75a33919d9ae41dbed5bc6a39f5ede2
"""
import sys
import os
import requests
import subprocess
import shutil
from logging import getLogger, StreamHandler, INFO
logger = getLogger(__name__)
logger.addHandler(StreamHandler())
logger.setLevel(INFO)
def inst... | mit | Python | |
a9b447dcbe7fd5bd5e93341662ecccc1e4699e74 | add script import-to-ida.py | mandiant/capa,mandiant/capa | scripts/import-to-ida.py | scripts/import-to-ida.py | """
IDA Pro script that imports a capa report,
produced via `capa --json /path/to/sample`,
into the current database.
It will mark up functions with their capa matches, like:
; capa: print debug messages (host-interaction/log/debug/write-event)
; capa: delete service (host-interaction/service/delete)
... | apache-2.0 | Python | |
e6b17a3510e9f6a6954926205ff19e0069d6f56f | Create palindromic-substrings.py | tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11... | Python/palindromic-substrings.py | Python/palindromic-substrings.py | # Time: O(n)
# Space: O(n)
# Given a string, your task is to count how many palindromic substrings in this string.
#
# The substrings with different start indexes or end indexes are counted as
# different substrings even they consist of same characters.
#
# Example 1:
# Input: "abc"
# Output: 3
# Explanation: Three p... | mit | Python | |
d1b4ddf7c566ff7376ee5b9f5516d111c0da5f2b | Create Titles.py | mayankdcoder/Matplotlib | Titles.py | Titles.py | #Draws labels for the axes using matplotlib
import matplotlib.pyplot as plt
x = [1, 2, 3]
y = [5, 7, 4]
plt.plot(x, y)
plt.xlabel('X Axis')
plt.ylabel('Y Axis')
plt.title('This is a Title')
plt.show()
| mit | Python | |
beb8470dacd866e5cf77941ff60f7698266508f2 | Add analyzer test harnes | cmheisel/agile-analytics | tests/test_analyzers.py | tests/test_analyzers.py | """Test the bundled analyzers."""
import pytest
@pytest.mark.fixture
def klass():
"""Return the Class Under Test."""
from jira_agile_extractor.analyzers import ThroughputAnalyzer
return ThroughputAnalyzer
| mit | Python | |
8768c03ddc366adf9a85de9841e4b4b8053737c3 | Create Curso.py | AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb | backend/Database/Controllers/Curso.py | backend/Database/Controllers/Curso.py | from Framework.BancoDeDados import BancoDeDados
from Database.Models.Curso import Curso as ModelCurso
class Curso(object):
def pegarCurso(self, condicao, valores):
cursos = []
for curso in BancoDeDados().consultarMultiplos("SELECT * FROM curso %s" % (condicao), valores):
cursos.append(ModelCurso(curso))
r... | mit | Python | |
f4b9df206d6b89a4d465017c96580044cf2d2c8a | Create crawler_with_tagger.py | manashmndl/NewsCrawler | crawler/crawler_with_tagger.py | crawler/crawler_with_tagger.py | # TODO
# StanfordNERTagger to tag the words
| mit | Python | |
f5b185fa2bba29efe3c1db2cd6c6a50188be24e3 | Add a basic test for locking and unlocking | mitya57/secretstorage | tests/test_unlocking.py | tests/test_unlocking.py | # Tests for SecretStorage
# Author: Dmitry Shachnev, 2018
# License: BSD
import unittest
from secretstorage import dbus_init, get_any_collection
from secretstorage.util import BUS_NAME
from secretstorage.exceptions import LockedException
@unittest.skipIf(BUS_NAME == "org.freedesktop.secrets",
"This... | bsd-3-clause | Python | |
cf5fa4acdb58507b8cccb11fd880360726a6069b | test freeze_js function | chenjiandongx/pyecharts,chenjiandongx/pyecharts,chenjiandongx/pyecharts | test/test_template.py | test/test_template.py | from pyecharts.template import freeze_js
def test_freeze_js():
html_content = """
</style>
<!-- build -->
<script src="js/echarts.min.js"></script>
<script src="js/wordcloud.js"></script>
<!-- endbuild -->
</head><body>"""
html_content = freeze_js(html_content)
... | mit | Python | |
a489a0b296f3311a878b0cf7262724a966a86ed0 | Add helpers module | Cosiek/KombiVojager | helpers.py | helpers.py | #!/usr/bin/env python
# encoding: utf-8
INF = float('inf')
def print_array(array):
print '-----'
for row in array:
print [int(x) if isinstance(x, float) and x < INF else x for x in row]
| mit | Python | |
306531edb21e2ba2f2a39d30e1b1c26b6a9a32f6 | Add imports | raztechs/py-video-crawler | crawl.py | crawl.py | import urllib2;
from bs4 import BeautifulSoup;
| mit | Python | |
79832d4e43acee9c0cb98140dc91d707debb5635 | Add swe solver for williamson 5 test | thomasgibson/firedrake-hybridization | sw_williamson5/sw_williamson5.py | sw_williamson5/sw_williamson5.py | from gusto import *
from firedrake import (IcosahedralSphereMesh, SpatialCoordinate,
Constant, as_vector)
import sys
day = 24.*60.*60
ref_level = 3
dt = 3000.
tmax = 3000.
# Shallow water parameters
R = 6371220
H = 5960
u_0 = 20. # Maximum amplitude of zonal winds (m/s)
# Setup input that wo... | mit | Python | |
0ea21d4771bafec24478d8aa7d386d598685edd4 | Create runner.py | sevenbigcat/wthen | wthen/runner.py | wthen/runner.py | import yaml
class RuleRunner():
@classmethod
def evaluate_conditions(cls, when, scope):
eval_result = False
for w in when:
eval_result = eval(w, globals(), scope)
if eval_result == False:
break
return eval_result
@classmethod
def run_rule(cls, r, scope):
output = r.get('out... | mit | Python | |
9114fad437d8dc402abc9bc50e90cc6125c57648 | Create __init__.py | Fillll/reddit2telegram,Fillll/reddit2telegram | channels/r_latestagecapitalism/__init__.py | channels/r_latestagecapitalism/__init__.py | # Just empty file
| mit | Python | |
085efb9bfe476232695cb66ddf28d6c1a6f84c2f | Add migration for Model changes. | cdubz/timestrap,cdubz/timestrap,cdubz/timestrap,muhleder/timestrap,Leahelisabeth/timestrap,muhleder/timestrap,Leahelisabeth/timestrap,muhleder/timestrap,overshard/timestrap,overshard/timestrap,Leahelisabeth/timestrap,overshard/timestrap,Leahelisabeth/timestrap | core/migrations/0005_auto_20170506_1026.py | core/migrations/0005_auto_20170506_1026.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-06 14:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20170426_1717'),
]
operations = [
... | bsd-2-clause | Python | |
d2d9716660b3d87999aba8603aaa19519ce03eca | Create rs.py | YannChemin/distRS,YannChemin/distRS,YannChemin/distRS,YannChemin/distRS | rs.py | rs.py | from math import *
def rh(PW,Pa,Ta,dem):
"""
https://www.researchgate.net/publication/227247013_High-resolution_Surface_Relative_Humidity_Computation_Using_MODIS_Image_in_Peninsular_Malaysia/
PW <- MOD05_L2 product
Pa <- MOD07 product
Pa <- 1013.3-0.1038*dem
Ta <- MOD07 product
Ta <- -0.0065*dem+TaMOD07 (if dem... | unlicense | Python | |
ee58aec8c92ca4f1c407872419956f5601cd600e | Create 048.py | hiseba/project_euler,hiseba/project_euler | 048.py | 048.py |
result = 0
modulo = 10000000000
n = 1000
# Using (a*b)%c = ((a%c)*(b%c))%c
# (a+b)%c = ((a%c)+(b%c))%c
for i in range(1,n+1):
temp = i
for j in range(1,i):
temp = (temp * i) % modulo
result = (temp + result) % modulo
print (result)
| mit | Python | |
764ac1bbb8cdc5c688f567fcd0ff8a67bff4269c | Add basic bot outline and functions | Bubblesphere/ay-discord-bot,BrusiRoy/ay-discord-bot | bot.py | bot.py | import praw
import discord
from discord.ext import commands
reddit = praw.Reddit(client_id = '',
client_secret = '',
user_agent = 'aySH Bot')
print(reddit.read_only)
async def top_subreddit(subreddit, time):
tops = reddit.subreddit(subreddit).top(time, limit = 1)
for... | mit | Python | |
3bc86ca5bd302103a57b6e2829d549aa1e243766 | Add basic test for jsbox forms. | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/apps/jsbox/tests/test_forms.py | go/apps/jsbox/tests/test_forms.py | from django.test import TestCase
from go.apps.jsbox.forms import JsboxForm
class JsboxFormTestCase(TestCase):
def test_to_metdata(self):
form = JsboxForm(data={
'javascript': 'x = 1;',
})
self.assertTrue(form.is_valid())
metadata = form.to_metadata()
self.asser... | bsd-3-clause | Python | |
868502d62e9a7aaa1fd7b9bf75030dfa359436b3 | add missing modules | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | bumblebee_status/modules/core/keys.py | bumblebee_status/modules/core/keys.py | # pylint: disable=C0111,R0903
"""Shows when a key is pressed
Parameters:
* keys.keys: Comma-separated list of keys to monitor (defaults to "")
"""
import core.module
import core.widget
import core.decorators
import core.event
import util.format
from pynput.keyboard import Listener
NAMES = {
"Key.cmd": "cm... | mit | Python | |
a6712ce13b0c6e62488adf0ae13fabf986a1b890 | Add simple script to sort images | ranisalt/imgsort | imgsort.py | imgsort.py | #!/usr/bin/env python3
import os
import shutil
from PIL import Image
whitelist = (
(1366, 768),
(1600, 900),
(1680, 1050),
(1920, 1080),
(1920, 1200),
)
def split(directory):
filemap = {dimensions: set() for dimensions in whitelist}
filemap['others'] = set()
makepath = lambda filena... | mit | Python | |
805447a2b90ed4f6f881d47663767b3a375558b1 | Create sieve_of_eratosthenes.py | fullmooninu/messy,fullmooninu/messy | sieve_of_eratosthenes.py | sieve_of_eratosthenes.py | #Sieve of Eratosthenes
#Crivo de Eratóstenes
#fullmooninu 2018
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout, QGroupBox, QDialog, QVBoxLayout, QGridLayout, QLabel, QLineEdit
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
import math, time
class App(QWidget):
... | unlicense | Python | |
233dea19cbe95829fb17fe30053478c3d2a4000a | Add version file to the repository. | jmbr/diffusion-maps,jmbr/diffusion-maps | diffusion_maps/version.py | diffusion_maps/version.py | __all__ = ['version']
class version:
"""Current version."""
v_short = '20170520.3'
v_long = '20170520.3 (2017-May-20)'
v_gnu = 'diffusion_maps 20170520.3 (2017-May-20)'
| mit | Python | |
1efce5f4381d87384d4ac3ec30266d7065e1ab9a | add simulation.py | ntucllab/striatum | simulation/simulation.py | simulation/simulation.py | from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import LogisticRegression
from sklearn.multiclass import OneVsRestClassifier
from striatum.storage import history
from striatum.storage import model
from striatum.bandit import ucb1
from striatum.bandit import linucb
from striatum.bandit import lin... | bsd-2-clause | Python | |
004d8fc6edae142cff7d26e53a79183b1ca29a5b | Migrate greplin.defer's remaining used code to greplin-twisted-utils | Cue/greplin-twisted-utils | src/greplin/defer/wait.py | src/greplin/defer/wait.py | # Copyright 2010 Greplin, Inc. All Rights Reserved.
"""Mixin for waiting on deferreds, and cancelling them if needed."""
class WaitMixin(object):
"""Mixin for waiting on deferreds, and cancelling them if needed."""
__currentWait = None
def _wait(self, deferred):
"""Waits for the given deferred."""
... | apache-2.0 | Python | |
6a08dc8ae70ebb7d759514991033a54e35ef0a93 | Update brick maker to use new meta functionality | profxj/desispec,timahutchinson/desispec,profxj/desispec,gdhungana/desispec,desihub/desispec,gdhungana/desispec,timahutchinson/desispec,desihub/desispec | bin/desi_make_bricks.py | bin/desi_make_bricks.py | #!/usr/bin/env python
#
# See top-level LICENSE file for Copyright information
#
# -*- coding: utf-8 -*-
import argparse
import os.path
import glob
import desispec.io
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--verbose', action ... | #!/usr/bin/env python
#
# See top-level LICENSE file for Copyright information
#
# -*- coding: utf-8 -*-
import argparse
import desispec.io
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--fibermap', default = None, metavar = 'FILE',... | bsd-3-clause | Python |
0e6b38f86194be468d9d4098a736914bae65f496 | Add downloader for ksml archive | HIIT/mediacollection | sites/ksml_downloader.py | sites/ksml_downloader.py | import time
import json
import ksml
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditi... | mit | Python | |
c43b3a6e5a66faa119c6bf4860dd5bd3af05afb5 | Add test cases for TextCodec | xrloong/Xie | tests/test/xie/graphics/utils.py | tests/test/xie/graphics/utils.py | import unittest
from xie.graphics.utils import TextCodec
class TextUtilsTestCase(unittest.TestCase):
def setUp(self):
self.codec = TextCodec()
def tearDown(self):
pass
def test_encodeStartPoint(self):
self.assertEqual("0.37.59", self.codec.encodeStartPoint((37, 59)))
self.assertEqual("0.59.37", self.codec... | apache-2.0 | Python | |
84d056fcb62d232ff1df8b8063da325f15feeec6 | Create get.py | CodersClan/full-contact-api-python | get.py | get.py | from datetime import datetime, timedelta
import time
import requests
class FullContactAdaptiveClient(object):
REQUEST_LATENCY=0.2
def __init__(self):
self.next_req_time = datetime.fromtimestamp(0)
def call_fullcontact(self, email):
self._wait_for_rate_limit()
r = requests.get('htt... | apache-2.0 | Python | |
3347a656ca6b28113c7d54f4cfc3fabdf6800bcc | Include ability score module | quintenpalmer/dnd | character_sheet/src/player/ability.py | character_sheet/src/player/ability.py | import util
class AbilityScores:
def __init__(self, STR, CON, DEX, INT, WIS, CHA):
self.scores = {
'STR': STR,
'CON': CON,
'DEX': DEX,
'INT': INT,
'WIS': WIS,
'CHA': CHA,
}
def get_abil_mod(self, name, ability_scores):
... | mit | Python | |
af127fa56d2ce9304034e19ed2e0a598d10bebba | Add main regression test file for cyclus | Baaaaam/cyBaM,gonuke/cycamore,gonuke/cycamore,cyclus/cycaless,Baaaaam/cyCLASS,gonuke/cycamore,rwcarlsen/cycamore,gonuke/cycamore,jlittell/cycamore,rwcarlsen/cycamore,Baaaaam/cyBaM,Baaaaam/cycamore,Baaaaam/cyBaM,jlittell/cycamore,Baaaaam/cycamore,jlittell/cycamore,Baaaaam/cycamore,Baaaaam/cyCLASS,jlittell/cycamore,cyclu... | tests/tests_cyclus.py | tests/tests_cyclus.py | #! /usr/bin/env python
import os
from tests_list import sim_files
from cyclus_tools import run_cyclus, db_comparator
"""Tests"""
def test_cyclus():
"""Test for all inputs in sim_files. Checks if reference and current cyclus
output is the same.
WARNING: the tests require cyclus executable to be included... | bsd-3-clause | Python | |
c4086e135efdac5299575e12c25393885e6f757d | Add forgotten command module | dax/jcl | src/jcl/jabber/command.py | src/jcl/jabber/command.py | ##
## command.py
## Login : David Rousselie <dax@happycoders.org>
## Started on Wed Jun 20 08:19:57 2007 David Rousselie
## $Id$
##
## Copyright (C) 2007 David Rousselie
## 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
## th... | lgpl-2.1 | Python | |
91e0b239e3b36ad7d2a5572b9c6f48f9f04d74cf | add appel li test cases | BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,kishoredbn/barrelfish,kishoredbn/barrelfish,kishoredbn/barrelfish,BarrelfishOS/barrelfish,kishoredbn/barrelfish,kishoredbn/barrelfish,BarrelfishOS/barrelfish,kishoredbn/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelf... | tools/harness/tests/mem_appel.py | tools/harness/tests/mem_appel.py | import tests, debug
from common import TestCommon
from results import PassFailResult, RowResults
import sys, re, numpy, os, datetime
class AppelLiBench(TestCommon):
'''Benchmark GC primitives with Appel Li benchmark'''
def get_finish_string(self):
return "appel_li: done"
def process_data(self, t... | mit | Python | |
ad5f851b7959f7bf09d7cd669d8db126fa962982 | Add a unittest for spacegroup. Still very basic. | migueldiascosta/pymatgen,yanikou19/pymatgen,sonium0/pymatgen,migueldiascosta/pymatgen,ctoher/pymatgen,sonium0/pymatgen,Dioptas/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,yanikou19/pymatgen,Bismarrck/pymatgen,sonium0/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,Dioptas/pymatgen,Bismarrck/pymatgen,ctoher/pymatgen,mig... | pymatgen/symmetry/tests/test_spacegroup.py | pymatgen/symmetry/tests/test_spacegroup.py | #!/usr/bin/env python
'''
Created on Mar 12, 2012
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Mar 12, 2012"
import unittest
import os
from pymatg... | mit | Python | |
79e160ebd8c26ec4e4bcdc5836bcdc3f7a234de4 | Create __init__.py | IRC-SPHERE/HyperStream,IRC-SPHERE/HyperStream,IRC-SPHERE/HyperStream,IRC-SPHERE/HyperStream | hyperstream/tools/__init__.py | hyperstream/tools/__init__.py | # The MIT License (MIT) # Copyright (c) 2014-2017 University of Bristol
#
# 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... | mit | Python | |
65184e09f5d66ba814b73040f0cb52db90ec795e | add baidu backend | duoduo369/python-social-auth,duoduo369/python-social-auth | social/backends/baidu.py | social/backends/baidu.py | #coding:utf8
# author:duoduo3369@gmail.com https://github.com/duoduo369
"""
Baidu OAuth2 backend, docs at:
"""
from social.backends.oauth import BaseOAuth2
class BaiduOAuth2(BaseOAuth2):
"""Baidu (of sina) OAuth authentication backend"""
name = 'baidu'
ID_KEY = 'userid'
AUTHORIZATION_URL = 'http://op... | bsd-3-clause | Python | |
5f93a425dae42b0942e2f417aa30b7910a53db7e | add missing migration | terceiro/squad,terceiro/squad,terceiro/squad,terceiro/squad | squad/core/migrations/0049_projectstatus_plural.py | squad/core/migrations/0049_projectstatus_plural.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-25 20:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0048_moderate_notifications'),
]
operations = [
migrations.AlterMod... | agpl-3.0 | Python | |
595a81445ae6ccb2c61e1c1409ddebde018c7533 | Move logging config to separate file - missed file | singularityhub/sregistry,singularityhub/sregistry,singularityhub/sregistry,singularityhub/sregistry | shub/settings/logging.py | shub/settings/logging.py | # Default Django logging is WARNINGS+ to console
# so visible via docker-compose logs uwsgi
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django': {
'handle... | mpl-2.0 | Python | |
e1e90a8d704666613e6f2f6aaf839724af05cc19 | Add CLI tool for creating SciTokens. | scitokens/scitokens,scitokens/scitokens | tools/create_token.py | tools/create_token.py | #!/usr/bin/env python
import argparse
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.backends import default_backend
import scitokens
# Arguments:
def add_args():
parser = argparse.ArgumentParser(description='Create a new SciToken')
parser.add_argument('claims', meta... | apache-2.0 | Python | |
29f32ec5cc3b050d6307688995907d094966b369 | Add script to make SOFIA ontology | sorgerlab/indra,bgyori/indra,sorgerlab/belpy,pvtodorov/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/indra,bgyori/indra,johnbachman/belpy,pvtodorov/indra,johnbachman/belpy,sorgerlab/indra,pvtodorov/indra,johnbachman/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/indra,bgyori/indra | indra/sources/sofia/make_sofia_ontology.py | indra/sources/sofia/make_sofia_ontology.py | import sys
import json
from os.path import join, dirname, abspath
from rdflib import Graph, Namespace, Literal
from indra.sources import sofia
# Note that this is just a placeholder, it doesn't resolve as a URL
sofia_ns = Namespace('http://cs.cmu.edu/sofia/')
indra_ns = 'http://sorger.med.harvard.edu/indra/'
indra_re... | bsd-2-clause | Python | |
da32e369b2ee850195ffd646921c5283e9ac19e4 | Test existing behavior to highlight limitations | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/analytics/tests/test_hubspot.py | corehq/apps/analytics/tests/test_hubspot.py | from __future__ import absolute_import, unicode_literals
from django.test import RequestFactory, TestCase, override_settings
import mock
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.users.models import WebUser
from ..tasks import (
HUBSPOT_COOKIE,
HUBSPOT_SIGNUP_FORM_ID,
track... | bsd-3-clause | Python | |
e4a19972960b2b2618a380239d8e9e0687296d0f | Create test_client.py | msincenselee/vnpy,bigdig/vnpy,msincenselee/vnpy,msincenselee/vnpy,bigdig/vnpy,andrewchenshx/vnpy,andrewchenshx/vnpy,andrewchenshx/vnpy,bigdig/vnpy,vnpy/vnpy,vnpy/vnpy,msincenselee/vnpy,bigdig/vnpy,andrewchenshx/vnpy,andrewchenshx/vnpy | vnpy/rpc/test_client.py | vnpy/rpc/test_client.py | from __future__ import print_function
from __future__ import absolute_import
from time import sleep
from .vnrpc import RpcClient
class TestClient(RpcClient):
"""
Test RpcClient
"""
def __init__(self, req_address, sub_address):
"""
Constructor
"""
super(TestClient... | mit | Python | |
d1928a1027bd2448ac1653ac74f826cefc4a8745 | Add first script using XGBoosting Classifier | davidgasquez/kaggle-airbnb | scripts/xgdboost.py | scripts/xgdboost.py | import pandas as pd
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from xgboost.sklearn import XGBClassifier
# Set magic seed
np.random.seed(42)
# Load Data
df_train = pd.read_csv('data/raw/train_users.csv')
df_test = pd.read_csv('data/raw/test_users.csv')
labels = df_train['cou... | mit | Python | |
7a7af1cb2eb5cf17e6697893ef32dc6aca96b711 | Create train_deep_compare.py | galad-loth/LearnDescriptor | train_deep_compare.py | train_deep_compare.py | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 04 08:00:11 2017
@author: galad-loth
"""
import mxnet as mx
import logging
import sys
from symbols.deep_compare_symbol import get_deep_compare_symbol
from utils.data import get_UBC_patch_dataiter
from utils.evaluate_metric import pn_accuracy
logging.basicConfig(level=lo... | apache-2.0 | Python | |
7a01615d50ec374687a5676e53e103eff9082b3e | Fix return get_types for ClipboardXsel | gonzafirewall/kivy,LogicalDash/kivy,aron-bordin/kivy,jffernandez/kivy,VinGarcia/kivy,vipulroxx/kivy,jehutting/kivy,rafalo1333/kivy,matham/kivy,matham/kivy,MiyamotoAkira/kivy,mSenyor/kivy,kivy/kivy,thezawad/kivy,bionoid/kivy,LogicalDash/kivy,aron-bordin/kivy,bionoid/kivy,bionoid/kivy,KeyWeeUsr/kivy,arlowhite/kivy,Farkal... | kivy/core/clipboard/clipboard_xsel.py | kivy/core/clipboard/clipboard_xsel.py | '''
Clipboard xsel: an implementation of the Clipboard using xsel command line tool.
'''
__all__ = ('ClipboardXsel', )
from kivy.utils import platform
from kivy.core.clipboard import ClipboardBase
if platform != 'linux':
raise SystemError('unsupported platform for xsel clipboard')
try:
import subprocess
... | '''
Clipboard xsel: an implementation of the Clipboard using xsel command line tool.
'''
__all__ = ('ClipboardXsel', )
from kivy.utils import platform
from kivy.core.clipboard import ClipboardBase
if platform != 'linux':
raise SystemError('unsupported platform for xsel clipboard')
try:
import subprocess
... | mit | Python |
c10202f6ca72ab5dc10a34ad31121e55a331f1c2 | add python example | connyay/speed,connyay/speed | python/server.py | python/server.py | import tornado.ioloop
import tornado.web
from tornado import gen
class MainHandler(tornado.web.RequestHandler):
@gen.coroutine
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(8888)
tor... | mit | Python | |
7a3f4f3594c14ae7c7799d6a8488bea408369bc1 | add models to admin | wearespindle/quickly.press,wearespindle/quickly.press,wearespindle/quickly.press | quickly/admin.py | quickly/admin.py | from django.contrib import admin
from quickly.buttons.models import EmergencyButtonClient
from quickly.schedules.models import Schedule
from quickly.services.models import Service
myModels = [EmergencyButtonClient, Schedule, Service]
admin.site.register(myModels)
| mit | Python | |
fbcfcc6cbe9a92b62448d876614b5a012ccf18d2 | Update network | MizukiSonoko/iroha-cli,MizukiSonoko/iroha-cli | cli/network.py | cli/network.py | import grpc
from cli import crypto
from schema.primitive_pb2 import Signature
from schema.block_pb2 import Transaction
from schema.endpoint_pb2_grpc import CommandServiceStub, QueryServiceStub
import datetime
"""
message Header {
uint64 created_time = 1;
repeated Signature signatures = 2;
}
message Signature {
... | apache-2.0 | Python | |
f74c7f1cdb805a6cb08d98e3c0bc4adb5b688bde | add web admin cli (develop model) | 360skyeye/kael | web_cli.py | web_cli.py | # -*- coding: utf-8 -*-
import click
from gevent.wsgi import WSGIServer
from web_admin import app
@click.group()
def web_cli():
"""
This shell command start kael web admin for Kael applications.
Example usage:
\b
$ kael-web dev (For development)
"""
pass
@web_cli.command('run', sho... | apache-2.0 | Python | |
d442a93ef02f0f9a33b50c2a92db647944cb5c46 | Add files via upload | yunzhexue/tensorflow_backup_script | cifar100_resnet/test.py | cifar100_resnet/test.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 6 09:24:19 2017
@author: xueyunzhe
"""
import numpy as np
import tensorflow as tf
def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
def _bytes_feature(value):
return tf.train.Feature(bytes_l... | bsd-2-clause | Python | |
f0907ebd30f17e02aedd0bb4d979f11399995f32 | add newline segment | saghul/shline | segments/newline.py | segments/newline.py | def add_newline_segment():
powerline.append('\n', 0, 0)
add_newline_segment()
| mit | Python | |
7489246f9926350f7e14549b6efe38d1386cd786 | add missing jupyter_nbconvert.__main__ | ipython/ipython,ipython/ipython | jupyter_nbconvert/__main__.py | jupyter_nbconvert/__main__.py | from .nbconvertapp import launch_new_instance
launch_new_instance()
| bsd-3-clause | Python | |
8b5e347a3ca94730ff5a2d45b22cae5557274b4b | test initial | kmike/russian-tagsets | russian_tagsets/tests/test_oc_to_ud.py | russian_tagsets/tests/test_oc_to_ud.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, print_function
import pytest
from russian_tagsets import converters, ud
#from .opencorpora_aot_data import PARSE_RESULTS
class TestInternalConversion(object):
TEST_DATA = [
['власть', 'NOUN,inan,femn sing,nomn', 'NOUN Animac... | mit | Python | |
a71807789bd09181369fff8b18b3ab5544ba58dd | Add spider for Sun Loan Company | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/sunloan.py | locations/spiders/sunloan.py | # -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
DAYS={
'Monday':'Mo',
'Tuesday':'Tu',
'Wednesday':'We',
'Friday':'Fr',
'Thursday':'Th',
'Saturday':'Sa',
'Sunday':'Su',
}
class SunLoanSpider(scrapy.Spider):
name = "sunloan"
a... | mit | Python | |
f969ea842284aec89f2d2446394eebdb4b91801d | add print current time to a file | demonkit/toolbox | print_time.py | print_time.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
from datetime import datetime
TIME_FILE = "time.txt"
now = datetime.now()
if not os.path.exists(TIME_FILE):
print "first run"
f = open(TIME_FILE, 'w')
f.write("%s\n" % now.strftime("%Y-%m-%d %X"))
print "write %s to %s" % (now, TIME_FILE... | apache-2.0 | Python | |
7a3072134c129ade43c0f806526e18b0500ee69e | Create 0007.py | Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python | woniuzhang/0007/0007.py | woniuzhang/0007/0007.py | ##将空行和注释都放到空行
import re
f = open('readme.md')
a = f.readlines()
r1 = re.compile('^"""')
r3 = re.compile('."""$')
r2 = re.compile('^#')
r4 = re.compile('^$')
kong_count = 0
daima_count = 0
flag = 1
### flag 为标志位,是否遇到"""
for line in a:
# print(line)
line = line.strip()
if flag == 1:
if re.match(r1,line):
kong_co... | mit | Python | |
bbd194750df149df84d2d7af540eb14f0c75f290 | Create problem-48.py | vnbrs/project-euler | problem-48.py | problem-48.py | s = 0
for i in range(1,1001):
s += i ** i
print(str(s)[-10:])
| mit | Python | |
463a96ef1357c6bc7a7954d04526b6df8ca762ae | Add tree_search utility module | mahdavipanah/pynpuzzle | algorithms/util/tree_search.py | algorithms/util/tree_search.py | """
pynpuzzle - Solve n-puzzle with Python
Useful utilities for tree search algorithms
Version : 1.0.0
Author : Hamidreza Mahdavipanah
Repository: http://github.com/mahdavipanah/pynpuzzle
License : MIT License
"""
from copy import deepcopy
def is_goal_state(state, goal_state):
for i in range(len(state)):
... | mit | Python | |
7f48db6912682a1842ab18a21edead3ed861385f | Add regression test for #413. | jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,scipy/scipy-svn,lesserwhirls/scipy-cwt,scipy/scipy-svn,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,scipy/scipy-svn,scipy/scipy-svn,jasonmccampbell/scipy-refactor | scipy/ndimage/tests/test_regression.py | scipy/ndimage/tests/test_regression.py | import numpy as np
from numpy.testing import *
import scipy.ndimage as ndimage
def test_byte_order_median():
"""Regression test for #413: median_filter does not handle bytes orders."""
a = np.arange(9, dtype='<f4').reshape(3, 3)
ref = ndimage.filters.median_filter(a,(3, 3))
b = np.arange(9, dtype=... | bsd-3-clause | Python | |
0551b3bd29195a88bf0d9453fec746fa49b15f75 | add install file | ratnania/vim_environment,ratnania/vim_environment | install.py | install.py | # coding: utf-8
#! /usr/bin/python
import os
home = os.environ['HOME']
cmd = 'rm -rf ' + home + '/.vim*'
os.system(cmd)
cmd = 'cp .vimrc ' + home + '/.vimrc'
os.system(cmd)
cmd = 'cp -R .vim ' + home + '/.vim'
os.system(cmd)
| mit | Python | |
66a0622ba63d89b6cfcfa74f7b342f4df55c5045 | Add missing migration for sponsors | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | src/sponsors/migrations/0004_auto_20160501_1632.py | src/sponsors/migrations/0004_auto_20160501_1632.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-05-01 16:32
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0003_auto_20160427_0722'),
]
operations = [
migrations.AlterModelOptions... | mit | Python | |
873cd2140a415defe44d6630dea47a4252e570a2 | convert log to tex tables | bhzunami/Immo,bhzunami/Immo,bhzunami/Immo | log2tex.py | log2tex.py | import pdb
"""
"""
STOP_WORDS = ["mean living area", "Renovation", "Noise level", "Outlier detection", "Steuerfuss",
"Tags gruppieren", "Stacked model", "Without Tags"]
STATS_WORD = ["R²-Score:", "MAPE:", "MdAPE:", "Min", "Max", "Max", "Mean", "Median", "Mean"]
def main():
with open('train.log', '... | mit | Python | |
51d5706b48454d08766fa74b009090b7e2f5322e | Update libchromiumcontent: fix usage of private API in MAS build | wan-qy/electron,biblerule/UMCTelnetHub,miniak/electron,seanchas116/electron,bpasero/electron,twolfson/electron,twolfson/electron,joaomoreno/atom-shell,bpasero/electron,brenca/electron,shiftkey/electron,tonyganch/electron,twolfson/electron,the-ress/electron,seanchas116/electron,twolfson/electron,seanchas116/electron,wan... | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import errno
import os
import platform
import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = os.getenv('LIBCHROMIUMCONTENT_COMMIT') or \
'4f5b89374df7ee69095b9f7d50b30fb46ddd7407... | #!/usr/bin/env python
import errno
import os
import platform
import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = os.getenv('LIBCHROMIUMCONTENT_COMMIT') or \
'ea20b8dfe0a7fad61bb4917404950ddcd2224588... | mit | Python |
03993c7234d7c5950bebcf9172803b1003863801 | add renren backend | duoduo369/django-social-auth | social_auth/backends/contrib/renren.py | social_auth/backends/contrib/renren.py | from social.backends.renren import RenRenOAuth2 as RenRenBackend
| bsd-3-clause | Python | |
ef16ba62776d86cffad1f713e337b55970b24c05 | Make array length smaller for visibility. | RaoUmer/distarray,RaoUmer/distarray,enthought/distarray,enthought/distarray | distarray/tests/demo.py | distarray/tests/demo.py | import numpy as np
import distarray
from distarray import odin
np.set_printoptions(precision=2, linewidth=1000)
@odin.local
def local_sin(da):
"""A simple @local function."""
return np.sin(da)
@odin.local
def local_sin_plus_50(da):
"""An @local function that calls another."""
return local_sin(da) +... | import numpy as np
import distarray
from distarray import odin
np.set_printoptions(precision=2, linewidth=1000)
@odin.local
def local_sin(da):
"""A simple @local function."""
return np.sin(da)
@odin.local
def local_sin_plus_50(da):
"""An @local function that calls another."""
return local_sin(da) +... | bsd-3-clause | Python |
ca1d27dba84574927e28cee2090155785b46ec44 | remove debugging prints | CarlFK/veyepar,xfxf/veyepar,xfxf/veyepar,xfxf/veyepar,CarlFK/veyepar,xfxf/veyepar,CarlFK/veyepar,xfxf/veyepar,CarlFK/veyepar,CarlFK/veyepar | dj/scripts/mk_titles.py | dj/scripts/mk_titles.py | #!/usr/bin/python
# creates svg titles for all the episodes
# used to preview the title slides,
# enc.py will re-run the same code.
import os
import subprocess
from enc import enc
from main.models import Client, Show, Location, Episode, Raw_File, Cut_List
class mk_title(enc):
ready_state = None
def proce... | #!/usr/bin/python
# creates svg titles for all the episodes
# used to preview the title slides,
# enc.py will re-run the same code.
import os
import subprocess
from enc import enc
from main.models import Client, Show, Location, Episode, Raw_File, Cut_List
class mk_title(enc):
ready_state = None
def proc... | mit | Python |
f4624823447d4be367c0c68ae4fbf28cb06d07a0 | test that uses r2demo.yml, to simulate UX work | ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services | ion/services/sa/instrument/test/test_fake_ux_launch.py | ion/services/sa/instrument/test/test_fake_ux_launch.py | from interface.services.cei.iprocess_dispatcher_service import ProcessDispatcherServiceClient
from interface.services.dm.idataset_management_service import DatasetManagementServiceClient
from interface.services.icontainer_agent import ContainerAgentClient
#from pyon.ion.endpoint import ProcessRPCClient
from ion.agents... | bsd-2-clause | Python | |
701c29e3cd0e216df6b787e5d046d994e9dea51c | Create mainPy.py | devot0/PythonRepo | mainPy.py | mainPy.py | string sHi = "Hello!"
print sHi
| mit | Python | |
71109f46d00d513f85287354c00bf6b53cb4cf30 | add module for processing and displaying logs -- initial cut | bluesquall/okeanidanalysis | oceanidanalysis/logs.py | oceanidanalysis/logs.py | """
oceanidanalysis.logs
====================
Generally useful methods that span across submodules.
"""
import numpy as np
import scipy as sp
import h5py
import matplotlib.pyplot as plt
class OceanidLog(h5py.File):
def plot_timeseries(self, x, **kw):
"A convenience function for plotting time-series."""... | mit | Python | |
29e60de7ab362659b9a7e928c5d64ac29f27de02 | Add the converter for online products dataset | ronekko/deep_metric_learning | datasets/online_products_converter.py | datasets/online_products_converter.py | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 13:54:09 2017
@author: sakurai
"""
import os
import zipfile
import tarfile
import subprocess
import numpy as np
from scipy.io import loadmat
import matplotlib.pyplot as plt
import h5py
import fuel
from fuel.datasets.hdf5 import H5PYDataset
from tqdm import tqdm
import... | mit | Python | |
c84a18663f65783d1aa0e1cd7fb6eeba1ef03bc8 | 添加 WSGI stub | xen0n/snsfeed | snsfeed/app/wsgi.py | snsfeed/app/wsgi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Wang Xuerui <idontknw.wang@gmail.com>
#
# This file is part of snsfeed.
#
# snsfeed 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, e... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.