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 |
|---|---|---|---|---|---|---|---|---|
4fbba7e581b9ba4f98a3be4d09fbf929b32a6a87 | add test_load.py | imaginal/openprocurement.search,openprocurement/openprocurement.search | openprocurement/search/test_load.py | openprocurement/search/test_load.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import logging
import simplejson as json
import urllib, urllib2
from random import choice
from multiprocessing import Process
from time import time
FORMAT='%(asctime)-15s %(levelname)s %(processName)s %(message)s'
g_args=None
g_dict={}
def worker():
l... | apache-2.0 | Python | |
90e613063495dee9af8fefc7e682b15344eabc0d | Add an initial find missing translations script | quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot | util/find_missing_translations.py | util/find_missing_translations.py | import argparse
import os
import re
# Directory names to ignore when looking for JavaScript files.
ignore_dirs = [
".git",
"publish",
"ThirdParty",
]
# All valid two letter locale names.
all_locales = set(["en", "cn", "de", "fr", "ja", "ko"])
# Locales that are in zoneRegex object blocks.
zoneregex_local... | apache-2.0 | Python | |
38bfc1a536f43ece367a49a62501b57c89f689a1 | Add script to delete tables. | pixyj/feel,pixyj/feel,pixyj/feel,pixyj/feel,pixyj/feel | django-server/feel/core/db/reset.py | django-server/feel/core/db/reset.py | from django.db.models.base import ModelBase
from quiz.models import Quiz, ShortAnswer, Choice, QuizAttempt
from codequiz.models import CodeQuiz, CodeQuizAttempt
from concept.models import Concept, ConceptSection
from course.models import Course, CourseSlug, CourseConcept, ConceptDependency
def reset():
for key,... | mit | Python | |
4b3c3fb315c0f7450dd87a98e3d7f928408a8ab4 | add documentation for do_layout() method | aron-bordin/kivy,janssen/kivy,edubrunaldi/kivy,janssen/kivy,Cheaterman/kivy,jehutting/kivy,jffernandez/kivy,janssen/kivy,autosportlabs/kivy,denys-duchier/kivy,akshayaurora/kivy,andnovar/kivy,thezawad/kivy,ernstp/kivy,bhargav2408/kivy,MiyamotoAkira/kivy,yoelk/kivy,Ramalus/kivy,LogicalDash/kivy,vitorio/kivy,ehealthafrica... | kivy/uix/layout.py | kivy/uix/layout.py | '''
Layout
======
Layouts are used to calculate and assign widget positions.
The :class:`Layout` class itself cannot be used directly. You must use one of:
- Anchor layout : :class:`kivy.uix.anchorlayout.AnchorLayout`
- Box layout : :class:`kivy.uix.boxlayout.BoxLayout`
- Float layout : :class:`kivy.uix.floatlayout.... | '''
Layout
======
Layouts are used to calculate and assign widget positions.
The :class:`Layout` class itself cannot be used directly. You must use one of:
- Anchor layout : :class:`kivy.uix.anchorlayout.AnchorLayout`
- Box layout : :class:`kivy.uix.boxlayout.BoxLayout`
- Float layout : :class:`kivy.uix.floatlayout.... | mit | Python |
586c047cebd679f6a736c2dfec9b6df762938b12 | Add command line tool. | jpbarela/panini_complete | simulate_packs.py | simulate_packs.py | #!/usr/local/bin/python3
import argparse
import Panini
from Panini import StickerCollection
from Accumulator import Accumulator
parser = argparse.ArgumentParser('Simulate creating a Panini sticker collection')
parser.add_argument('runs', metavar='N', type= int)
runs = parser.parse_args().runs
results = Accumulator.... | mit | Python | |
7cb5e7b7ea65841e3eea11e337fe64e578cec2ce | Create buzzer.py | Dasl0ki/PyroBuzzer,Dasl0ki/PyroBuzzer | buzzer.py | buzzer.py | #!/usr/bin/env python
import RPi.GPIO as GPIO
import os
import smbus
from time import sleep
b = smbus.SMBus(1)
address = 0x20
GPIOA = 0x12
GPIOB = 0x13
b.write_byte_data(address,0x0C,0xFF)
b.write_byte_data(address,0x0D,0xFF)
if os.path.exists('ranking.txt'):
os.remove('ranking.txt')
if os.path.exists('stop-script')... | mit | Python | |
bad6bc988f09bf1f135d81eb654c5fc6c1de9a28 | add standalone gene report script. It will be used in the NDEx server as the GSEA exporter. | ndexbio/ndex-enrich | cx2grp.py | cx2grp.py | #!/usr/bin/python
'''
This script takes a CX network from stdin and print out a set of gene symbols found in node names,
represents, alias and function terms.
Gene Symbols are normallized to human genes using mygene.info services.
'''
import sys,json
import requests
def terms_from_function_term(function_term, term_... | bsd-2-clause | Python | |
9008d6e3d14a5a582f0ddbd6b4a113386b639f26 | Add Pyramid parser module | sloria/webargs,stas/webargs,Basis/webargs,hyunchel/webargs,yufeiminds/webargs,nealrs/webargs | webargs/pyramidparser.py | webargs/pyramidparser.py | # -*- coding: utf-8 -*-
"""Pyramid request argument parsing.
Example usage: ::
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from webargs import Arg
from webargs.pyramidparser import use_args
hello_args = {
... | mit | Python | |
5149d86c7e787eff46f21669d448158ba0905a41 | Add dbck.py: a database check tool | daedalus/pynode,petertodd/stealth-addresses-ref-implementation,petertodd/dust-b-gone,daedalus/python-bitcoin_r,jgarzik/pynode,jgarzik/python-bitcoinlib,petertodd/tx-flood-attack,robertsdotpm/python-bitcoinlib | dbck.py | dbck.py | #!/usr/bin/python
#
# dbck.py
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import sys
import Log
import MemPool
import ChainDb
import cStringIO
from bitcoin.coredefs import NETWORKS
from bitcoin.core import CBlock
fro... | mit | Python | |
48bc3bfa4ab6648d3599af15cfe7a2dd69abdb40 | make gsid ctable schedule run hourly | puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,gmimano/commcaretest,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-h... | custom/apps/gsid/ctable_mappings.py | custom/apps/gsid/ctable_mappings.py | from ctable.fixtures import CtableMappingFixture
from ctable.models import ColumnDef, KeyMatcher
class PatientSummaryMapping(CtableMappingFixture):
name = 'patient_summary'
domains = ['gsid']
couch_view = 'gsid/patient_summary'
schedule_active = True
@property
def columns(self):
colum... | from ctable.fixtures import CtableMappingFixture
from ctable.models import ColumnDef, KeyMatcher
class PatientSummaryMapping(CtableMappingFixture):
name = 'patient_summary'
domains = ['gsid']
couch_view = 'gsid/patient_summary'
schedule_active = True
@property
def columns(self):
colum... | bsd-3-clause | Python |
94ebfd057eb5a7c7190d981b26c027573578606d | validate using validator module | chrisseto/modular-odm,CenterForOpenScience/modular-odm,icereval/modular-odm,sloria/modular-odm | modularodm/fields/StringField.py | modularodm/fields/StringField.py | from ..fields import Field
from ..validators import StringValidator
class StringField(Field):
default = ''
validate = StringValidator()
def __init__(self, *args, **kwargs):
super(StringField, self).__init__(*args, **kwargs) | from ..fields import Field
import weakref
class StringField(Field):
default = ''
def __init__(self, *args, **kwargs):
super(StringField, self).__init__(*args, **kwargs)
def validate(self, value):
if isinstance(value, unicode):
return True
else:
try:
... | apache-2.0 | Python |
5748666a1f2c6cd307be79c33117252e10d6df01 | Add matchup script | ken-muturi/pombola,patricmutwiri/pombola,mysociety/pombola,Hutspace/odekro,Hutspace/odekro,ken-muturi/pombola,mysociety/pombola,geoffkilpin/pombola,hzj123/56th,geoffkilpin/pombola,patricmutwiri/pombola,patricmutwiri/pombola,geoffkilpin/pombola,hzj123/56th,ken-muturi/pombola,ken-muturi/pombola,patricmutwiri/pombola,hzj1... | mzalendo/kenya/management/commands/kenya_matchup_coords_to_place.py | mzalendo/kenya/management/commands/kenya_matchup_coords_to_place.py | import re
import csv
import sys
from optparse import make_option
from django.core.management.base import LabelCommand
from django.contrib.gis.geos import Point
from mapit.models import Area, Generation, Type, NameType, Country
class Command(LabelCommand):
"""Read a file in, extract coordinates and lookup the c... | agpl-3.0 | Python | |
9386236d41298ed8888a6774f40a15d44b7e53fe | Create command for Data Log Report fixtures | porksmash/swarfarm,porksmash/swarfarm,porksmash/swarfarm,porksmash/swarfarm | data_log/management/commands/generate_report_fixture.py | data_log/management/commands/generate_report_fixture.py | from django.core.management.base import BaseCommand
from django.core import serializers
from data_log import models
import json
class Command(BaseCommand):
help = 'Create Data Log Report fixtures'
def handle(self, *args, **kwargs):
self.stdout.write('Creating fixtures for Data Log Reports...')
... | apache-2.0 | Python | |
ebf790c6c94131b79cb5da4de6cb665f97e54799 | Add viewset permission class for checking image permissions | comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django | app/grandchallenge/cases/permissions.py | app/grandchallenge/cases/permissions.py | from rest_framework import permissions
from grandchallenge.serving.permissions import user_can_download_image
class ImagePermission(permissions.BasePermission):
"""
Permission class for APIViews in retina app.
Checks if user is in retina graders or admins group
"""
def has_object_permission(self... | apache-2.0 | Python | |
496754c54005cf7e1b49ada8e612207f5e2846ff | Add dead letter SQS queue example | awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,awsdocs/aws-doc... | python/example_code/sqs/dead_letter_queue.py | python/example_code/sqs/dead_letter_queue.py | # Copyright 2010-2016 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | apache-2.0 | Python | |
085a9aa05dfda6348d0e7e2aa6ac7f0c6ce6d63b | add some basic client-server tests | ychaim/opentxs-tests-1,Open-Transactions/opentxs-tests,ychaim/opentxs-tests-1,Open-Transactions/opentxs-tests | client_server_tests.py | client_server_tests.py | import pyopentxs
# this is defined by the sample data
SERVER_ID = "r1fUoHwJOWCuK3WBAAySjmKYqsG6G2TYIxdqY6YNuuG"
def test_check_server_id():
nym_id = pyopentxs.create_pseudonym()
assert pyopentxs.check_server_id(SERVER_ID, nym_id)
def test_register_nym():
nym_id = pyopentxs.create_pseudonym()
pyopent... | mpl-2.0 | Python | |
55f11f5952ad7c53267ec31c60196dd329eb09c0 | add one-off service | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | htdocs/json/vtec_events_bywfo.py | htdocs/json/vtec_events_bywfo.py | """Pidgin-holed service for some WFO data... """
import json
from io import BytesIO, StringIO
import datetime
from paste.request import parse_formvars
from pyiem.util import get_sqlalchemy_conn, html_escape
import pandas as pd
from sqlalchemy import text
EXL = "application/vnd.openxmlformats-officedocument.spreadshee... | mit | Python | |
7fc64847ed45229220e9bdfe20c25f3c83f10a80 | Add isup.py | fenhl/isup | isup.py | isup.py | #!/usr/bin/env python
import re
import sys
from urllib.request import urlopen
def isup(domain):
request = urlopen("http://www.isup.me/" + domain).read()
if type(request) != type(''):
request = request.decode('utf-8')
return domain + " " + ("UP" if "It's just you" in request else "DOWN")
def main(c... | mit | Python | |
9c7935ebbd4d995c44526c91fdb3b647a15eb877 | Create API tasks.py with update_char_data | evewspace/eve-wspace,acdervis/eve-wspace,Maarten28/eve-wspace,marbindrakon/eve-wspace,acdervis/eve-wspace,evewspace/eve-wspace,Zumochi/eve-wspace,Unsettled/eve-wspace,nyrocron/eve-wspace,nyrocron/eve-wspace,gpapaz/eve-wspace,gpapaz/eve-wspace,Unsettled/eve-wspace,Zumochi/eve-wspace,gpapaz/eve-wspace,Unsettled/eve-wspac... | evewspace/API/tasks.py | evewspace/API/tasks.py | # Eve W-Space
# Copyright 2014 Andrew Austin and 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/LICENSE-2.0
#
# Unless requi... | apache-2.0 | Python | |
1d1a37ad6f0aedbf18a72b551fdee4d96c92ea11 | Update RICA example. | chrinide/theanets,devdoer/theanets,lmjohns3/theanets | examples/mnist-rica.py | examples/mnist-rica.py | #!/usr/bin/env python
import climate
import matplotlib.pyplot as plt
import numpy as np
import theanets
from utils import load_mnist, plot_layers, plot_images
logging = climate.get_logger('mnist-rica')
climate.enable_default_logging()
class RICA(theanets.Autoencoder):
def J(self, weight_inverse=0, **kwargs):
... | #!/usr/bin/env python
import climate
import matplotlib.pyplot as plt
import numpy as np
import theanets
from utils import load_mnist, plot_layers, plot_images
logging = climate.get_logger('mnist-rica')
climate.enable_default_logging()
class RICA(theanets.Autoencoder):
def J(self, weight_inverse=0, **kwargs):
... | mit | Python |
57cf0e1d153c2d06e722329ac35f2093a1d1c17c | use .py file to make for setup.py | UWSEDS-aut17/uwseds-group-city-fynders | Docs/city_fynder.py | Docs/city_fynder.py | # Which city would like to live?
# Created by City Fynders - University of Washington
import pandas as pd
import numpy as np
import geopy as gy
from geopy.geocoders import Nominatim
import data_processing as dp
# import data
(natural, human, economy, tertiary) = dp.read_data()
# Add ranks in the DataFrame
(natura... | mit | Python | |
64b321f1815c17562e4e8c3123b5b7fbbe23ce0b | Add logging test | pubres/pubres | pubres/tests/logging_test.py | pubres/tests/logging_test.py | import logging
import logging.handlers
import multiprocessing
import pubres
from pubres.pubres_logging import setup_logging
from .base import *
class MultiprocessingQueueStreamHandler(logging.handlers.BufferingHandler):
"""A logging handler that pushes the getMessage() of every
LogRecord into a multiprocess... | mit | Python | |
b52bad82bafed23d3db5a0e73c22a056d1753174 | add card parsers | PeerAssets/pypeerassets | pypeerassets/card_parsers.py | pypeerassets/card_parsers.py | '''parse cards according to deck issue mode'''
def none_parser(cards):
'''parser for NONE [0] issue mode'''
return None
def custom_parser(cards, parser=None):
'''parser for CUSTOM [1] issue mode,
please provide your custom parser as argument'''
if not parser:
return cards
else:
... | bsd-3-clause | Python | |
a5b28834bb5e52857720139a1fbe6dfd1d1ea266 | create a new string helper that concatenates arguments | ceph/radosgw-agent,ceph/radosgw-agent | radosgw_agent/util/string.py | radosgw_agent/util/string.py |
def concatenate(*a, **kw):
"""
helper function to concatenate all arguments with added (optional)
newlines
"""
newline = kw.get('newline', False)
string = ''
for item in a:
if newline:
string += item + '\n'
else:
string += item
return string
| mit | Python | |
68c66c397f11637f650131ef69f4f16ebe6f43e4 | Create luhn.py | ilismal/luhnCompliance | luhn.py | luhn.py | # Luhn algorithm check
# From https://en.wikipedia.org/wiki/Luhn_algorithm
def luhn_checksum(card_number):
def digits_of(n):
return [int(d) for d in str(n)]
digits = digits_of(card_number)
odd_digits = digits[-1::-2]
even_digits = digits[-2::-2]
checksum = 0
checksum += sum(odd_digits)
... | unlicense | Python | |
1718926c99692fefb90627c55589990cd0e0225b | Make migrations in project_template home app reversible | rsalmaso/wagtail,FlipperPA/wagtail,chrxr/wagtail,nutztherookie/wagtail,mikedingjan/wagtail,nimasmi/wagtail,rsalmaso/wagtail,Toshakins/wagtail,mikedingjan/wagtail,thenewguy/wagtail,mikedingjan/wagtail,iansprice/wagtail,nilnvoid/wagtail,nimasmi/wagtail,mikedingjan/wagtail,nutztherookie/wagtail,zerolab/wagtail,FlipperPA/w... | wagtail/project_template/home/migrations/0002_create_homepage.py | wagtail/project_template/home/migrations/0002_create_homepage.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def create_homepage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Page = apps.get_model('wagtailcore.Page')
Site = apps.get_model('wagtailcore.Site')
Home... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def create_homepage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Page = apps.get_model('wagtailcore.Page')
Site = apps.get_model('wagtailcore.Site')
Home... | bsd-3-clause | Python |
889b322261384c90ac165ddd1e8bf2944b3e7785 | Add machine types people use as host for TF builds. | annarev/tensorflow,davidzchen/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,karllessard/tensorflow,aam-at/tensorflow,sarvex/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,petewarden/tensorflow,tenso... | third_party/remote_config/remote_platform_configure.bzl | third_party/remote_config/remote_platform_configure.bzl | """Repository rule to create a platform for a docker image to be used with RBE."""
def _remote_platform_configure_impl(repository_ctx):
platform = repository_ctx.attr.platform
if platform == "local":
os = repository_ctx.os.name.lower()
if os.startswith("windows"):
platform = "window... | """Repository rule to create a platform for a docker image to be used with RBE."""
def _remote_platform_configure_impl(repository_ctx):
platform = repository_ctx.attr.platform
if platform == "local":
os = repository_ctx.os.name.lower()
if os.startswith("windows"):
platform = "window... | apache-2.0 | Python |
c06ed61909cc9320b42c60fb435e4381f60e8b2e | Create Input-OutputNeuronGroup.py | ricardodeazambuja/BrianConnectUDP | examples/Input-OutputNeuronGroup.py | examples/Input-OutputNeuronGroup.py | '''
Example of a spike bridge (receives and sends spikes)
In this example spikes are received, processed and sent by UDP creating a raster plot at the end of the simulation.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
# The main function with the NeuronGroup(s) and Synap... | cc0-1.0 | Python | |
2dea3ee1e50d5365ca190ee894536faea3148c7d | Add ChromiumTestShell activity and socket to constants. | Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,nacl-webkit/chrome_deps,ChromiumWebApps/chromium,ltilve/chromium,axinging/chromium-crosswalk,dednal/chromium.src,pozdnyakov/chromium-crosswalk,hujiajie/pa-chromium,Chilledheart/chromium,hujiajie/pa-chromium,M4sse/chromium.src,jaruba/chromium.src,hujiajie/pa-chrom... | build/android/pylib/constants.py | build/android/pylib/constants.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Defines a set of constants shared by test runners and other scripts."""
import os
CHROME_PACKAGE = 'com.google.android.apps.chrome'
CHROME_ACTIVITY... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Defines a set of constants shared by test runners and other scripts."""
import os
CHROME_PACKAGE = 'com.google.android.apps.chrome'
CHROME_ACTIVITY... | bsd-3-clause | Python |
4ab784d9526b2a4555e288038df0490269b17683 | 完成1题 | karchi/codewars_kata | 已完成/ToLeetSpeak.py | 已完成/ToLeetSpeak.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
# ToLeetSpeak题目地址:https://www.codewars.com/kata/57c1ab3949324c321600013f/train/python
'''
import unittest
class TestCases(unittest.TestCase):
def setUp(self):
pass
def test1(self):self.assertEqual(to_leet_speak("LEET"), "1337")
def test2(self):self.as... | mit | Python | |
988b56b4348ec8be3127cfd6576779de4367d488 | Add pywikibot user-config file | wikimedia/labs-tools-lists,wikimedia/labs-tools-lists,wikimedia/labs-tools-lists | .pywikibot/user-config.py | .pywikibot/user-config.py | family = 'wikipedia'
mylang = 'en'
usernames['wikipedia']['en'] = u'ExampleBot'
console_encoding = 'utf-8'
textfile_encoding = 'unicode_escape'
| agpl-3.0 | Python | |
d808d55b5ca9ae2e45418aca718ee21a9beb84f9 | Create a custom reverse() function (not implemented yet) | ticosax/django-rest-framework,krinart/django-rest-framework,elim/django-rest-framework,delinhabit/django-rest-framework,qsorix/django-rest-framework,jerryhebert/django-rest-framework,mgaitan/django-rest-framework,MJafarMashhadi/django-rest-framework,leeahoward/django-rest-framework,wzbozon/django-rest-framework,ambival... | djangorestframework/urlresolvers.py | djangorestframework/urlresolvers.py | from django.core.urlresolvers import reverse
def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None, current_app=None):
raise NotImplementedError
| bsd-2-clause | Python | |
631faacaf077c2b4d0d446e42076fd4e4f27ed37 | Add tests for template tags | lotrekagency/djlotrek,lotrekagency/djlotrek | djlotrek/tests/test_templatetags.py | djlotrek/tests/test_templatetags.py | import os
import mock
from django.test import TestCase
from djlotrek.templatetags.djlotrek_tags import absolute_url
from django.test import RequestFactory
class TemplateTagsTestCase(TestCase):
def setUp(self):
pass
def test_absolute_url(self):
"""Our beloved get_host_url utility"""
... | mit | Python | |
e812029c03cb6a7a6e474546fb686342e6d2c064 | Add test for `wsgiref.simple_server` | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | python/ql/test/library-tests/frameworks/stdlib/wsgiref_simple_server_test.py | python/ql/test/library-tests/frameworks/stdlib/wsgiref_simple_server_test.py | # This test file demonstrates how to use an application with a wsgiref.simple_server
# see https://docs.python.org/3/library/wsgiref.html#wsgiref.simple_server.WSGIServer
import sys
import wsgiref.simple_server
def ignore(*arg, **kwargs): pass
ensure_tainted = ensure_not_tainted = ignore
ADDRESS = ("localhost", 8000)... | mit | Python | |
f2028ab194fe7c1c1497ee9320ddddbbece6406a | Add eventlet backdoor to facilitate troubleshooting. | n0ano/ganttclient | nova/common/eventlet_backdoor.py | nova/common/eventlet_backdoor.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 Openstack, LLC.
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | apache-2.0 | Python | |
d81ba7d656f11e817eb610b1c65a4880fddc9004 | Fix getting money from arcade games. | saylua/SayluaV2,saylua/SayluaV2,LikeMyBread/Saylua,saylua/SayluaV2,LikeMyBread/Saylua,LikeMyBread/Saylua,LikeMyBread/Saylua | saylua/modules/arcade/api.py | saylua/modules/arcade/api.py | from saylua import db
from saylua.wrappers import api_login_required
from flask import g, request
from models.db import Game, GameLog
from saylua.utils import int_or_none
import json
# Send a score to the API.
@api_login_required()
def api_send_score(game_id):
try:
gameName = Game(game_id)
except I... | from saylua.wrappers import api_login_required
from flask import g, request
from models.db import Game, GameLog
from saylua.utils import int_or_none
import json
# Send a score to the API.
@api_login_required()
def api_send_score(game_id):
try:
gameName = Game(game_id)
except IndexError:
retu... | agpl-3.0 | Python |
43d7160272511107528a33d7dff932ed274d9b58 | add sitemaps | edoburu/django-fluent-faq,edoburu/django-fluent-faq | fluent_faq/sitemaps.py | fluent_faq/sitemaps.py | from django.contrib.sitemaps import Sitemap
from fluent_faq.models import FaqCategory, FaqQuestion
from fluent_faq.urlresolvers import faq_reverse
class FaqQuestionSitemap(Sitemap):
"""
Sitemap for FAQ questions
"""
def items(self):
return FaqQuestion.objects.published()
def lastmod(self,... | apache-2.0 | Python | |
23f4e54ea84a23af55e29ead27a38af12672aa43 | Create multi_currency_prices.py | toloco/pyoanda | examples/multi_currency_prices.py | examples/multi_currency_prices.py |
from pyoanda import Client, PRACTICE
client = Client(environment=PRACTICE,account_id="Your Oanda account ID",access_token="Your Oanda access token")
# Get prices for a list of instruments
pair_list = ['AUD_JPY','EUR_JPY','GBP_JPY','AUD_USD']
dataset = client.get_prices(instruments=','.join(pair... | mit | Python | |
22b04a8a6a014ee4e077f2dc03338bdc9479cc5c | package module for handling wavelength calib | adrn/GaiaPairsFollowup | comoving_rv/longslit/wavelength.py | comoving_rv/longslit/wavelength.py | # Third-party
import numpy as np
from scipy.optimize import minimize, leastsq
from scipy.stats import scoreatpercentile
# Project
from .models import voigt_polynomial
__all__ = ['fit_emission_line']
def errfunc(p, pix, flux, flux_ivar):
amp, x_0, std_G, fwhm_L, *bg_coef = p
return (voigt_polynomial(pix, amp,... | mit | Python | |
21e411171e811e1b68ad3674567ecb05f6f7a7ad | add migrations | arteria/cmsplugin-contact-plus,arteria/cmsplugin-contact-plus | cmsplugin_contact_plus/migrations/0004_auto_20170410_1553.py | cmsplugin_contact_plus/migrations/0004_auto_20170410_1553.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_contact_plus', '0003_auto_20161102_1927'),
]
operations = [
migrations.AddField(
model_name='extrafiel... | bsd-3-clause | Python | |
fe18d3387f7f8072b4f23990e5108f646729a860 | Create pKaKs2.7.py | CharlesSanfiorenzo/Bioinformatics,CharlesSanfiorenzo/Bioinformatics,CharlesSanfiorenzo/Bioinformatics | Modules/pKaKs2.7.py | Modules/pKaKs2.7.py | #This short script uses the output values of KaKs.pl & SnpEff to calculate mutational load using Nei-Gojobori: pKa/Ks = [-3/4ln(1-4pn/3)] / [-3/4ln(1-4ps/3)], where ps = syn SNPs / syn sites and pn = nonsyn SNPs / nonsyn sites
from math import log #If for some reason you need to calculate the logarithm of a negative n... | mit | Python | |
61e56ad3feecef6fe422db8fb5d7b9b26dc03d6a | Add day 3 part 2. | SayWhat1/adventofcode2016 | day3-2.py | day3-2.py | """This module checks how many valid triangles are in the input data."""
def main():
"""Run main function."""
with open('data/day3data.txt', 'r') as f:
input = f.readlines()
dataList = [map(int, i.strip('\n').split()) for i in input]
# Transpose the data.
dataList = [list(i) for i in zip... | mit | Python | |
047541a111e9da5d59b47d40a528bc990bae6927 | add scope expression | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | compiler/eLisp/eLisp/expr/scope.py | compiler/eLisp/eLisp/expr/scope.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2015 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python | |
2d05a12a9b9534ad1925e7d543e6f66d8a79d3f8 | Initialize P02_deleteBigFiles | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter09/PracticeProjects/P02_deleteBigFiles.py | books/AutomateTheBoringStuffWithPython/Chapter09/PracticeProjects/P02_deleteBigFiles.py | # t’s not uncommon for a few unneeded but humongous files or folders to take up the
# bulk of the space on your hard drive. If you’re trying to free up room on your
# computer, you’ll get the most bang for your buck by deleting the most massive of
# the unwanted files. But first you have to find them.
#
# Write a progr... | mit | Python | |
cee924604f070bd1bbca33dda53c5783e2678c5d | Add tests for sagepay | artursmet/django-payments,imakin/pysar-payments,derenio/django-payments,artursmet/django-payments,imakin/pysar-payments,artursmet/django-payments,dashmug/django-payments,derenio/django-payments,polonat/django-payments,derenio/django-payments,polonat/django-payments,polonat/django-payments,dashmug/django-payments,dashmu... | payments/sagepay/test_sagepay.py | payments/sagepay/test_sagepay.py | from __future__ import unicode_literals
from unittest import TestCase
from mock import patch, MagicMock
from . import SagepayProvider
VENDOR = 'abcd1234'
ENCRYPTION_KEY = '1234abdd1234abcd'
class Payment(MagicMock):
id = 1
variant = 'sagepay'
currency = 'USD'
total = 100
status = 'waiting'
... | bsd-3-clause | Python | |
2528be1179355a9fcce40f283be18e87d682fede | add rpn creat tools | likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet | example/rcnn/rcnn/tools/proposal.py | example/rcnn/rcnn/tools/proposal.py | import argparse
import pprint
import mxnet as mx
from ..config import config, default, generate_config
from ..symbol import *
from ..dataset import *
from ..core.loader import TestLoader
from ..core.tester import Predictor, generate_proposals
from ..utils.load_model import load_param
def test_rpn(network, dataset, i... | apache-2.0 | Python | |
a07e4d08b475e0d921265f9da104f109943901bc | Add lammps wrapper tests with cuds | simphony/simphony-lammps-md,simphony/simphony-lammps-md | simlammps/tests/cuds_test.py | simlammps/tests/cuds_test.py | """Tests for running lammps using CUDS and Simulation classes."""
import unittest
from simphony.core.cuba import CUBA
from simphony import CUDS, Simulation
from simphony.engine import EngineInterface
from simphony.testing.utils import create_particles_with_id
from simphony.cuds.particles import Particle, Particles
c... | bsd-2-clause | Python | |
257c5bffe1804d694510f5a4638de8e6ae6a1470 | Create lstm_gan_mnist.py | amitadate/S-LSTM-GAN-MNIST | lstm_gan_mnist.py | lstm_gan_mnist.py | import tensorflow as tf
| mit | Python | |
7a813d21043c394ab10e1ddb687d7827a8b7e761 | add slideshare plugin | figshare/Total-Impact,figshare/Total-Impact,figshare/Total-Impact,figshare/Total-Impact | plugins/slideshare/slideshare.py | plugins/slideshare/slideshare.py | #!/usr/bin/env python
import urllib2
import re
import urllib
import time
import sha
import BeautifulSoup
from BeautifulSoup import BeautifulStoneSoup
from optparse import OptionParser
TOTALIMPACT_SLIDESHARE_KEY = "nyHCUoNM"
TOTALIMPACT_SLIDESHARE_SECRET = "z7sRiGCG"
MENDELEY_DOI_URL = "http://www.slideshare.net/api... | mit | Python | |
de2d21316ca47d1839584a7cccbe8026489ace7d | Change Schema.schema to a property | IATI/iati.core,IATI/iati.core | iati/core/schemas.py | iati/core/schemas.py | """A module containing a core representation of IATI Schemas."""
from lxml import etree
import iati.core.exceptions
import iati.core.resources
import iati.core.utilities
class Schema(object):
"""Represenation of a Schema as defined within the IATI SSOT.
Attributes:
name (str): The name of the Schema.... | """A module containing a core representation of IATI Schemas."""
from lxml import etree
import iati.core.exceptions
import iati.core.resources
import iati.core.utilities
class Schema(object):
"""Represenation of a Schema as defined within the IATI SSOT.
Attributes:
name (str): The name of the Schema.... | mit | Python |
f015f04bf05e6e58efd5fd0f90bbe72745eb60b2 | add experimental blas/lapack waf tool. | cournape/Bento,cournape/Bento,cournape/Bento,cournape/Bento | bento/backends/waf_tools/blas_lapack.py | bento/backends/waf_tools/blas_lapack.py | """Experimental ! This will very likely change"""
import collections
import sys
from bento.commands.options \
import \
Option
from bento.backends.waf_backend \
import \
WAF_TOOLDIR
import waflib
from waflib import Options
_PLATFORM_TO_DEFAULT = collections.defaultdict(lambda: "atlas")
_PLATF... | bsd-3-clause | Python | |
c388e6a4143b3646df5947cb5f596ec137488513 | Add minimal skeleton for plotting script | cphyc/n-body,cphyc/n-body | plot.py | plot.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import matplotlib.pyplot as plt
import pandas as pd
parser = argparse.ArgumentParser(description='Plot data from output of the n-body simulation.')
parser.add_argument('--output', type=str, default='output_int.dat',
help='The output file (d... | mit | Python | |
a7ad8f2075e7661ad9ed539083a8785f7a628b95 | test 1 | FungalPanic/dashsniffer | dashsniffer/sniff.py | dashsniffer/sniff.py | def greet(name):
print 'Hello', name
greet('Jack')
greet('Jill')
greet('Bob')
| mit | Python | |
faf13ff99fd47424c4fb93f1c2a6b3b80c81e0d1 | replace bin<->text converters for ipv6 | fkakuma/ryu,darjus-amzn/ryu,diogommartins/ryu,yamt/ryu,lagopus/ryu-lagopus-ext,yamt/ryu,Tejas-Subramanya/RYU_MEC,openvapour/ryu,elahejalalpour/ELRyu,habibiefaried/ryu,iwaseyusuke/ryu,TakeshiTseng/ryu,elahejalalpour/ELRyu,osrg/ryu,Tejas-Subramanya/RYU_MEC,sivaramakrishnansr/ryu,muzixing/ryu,Tesi-Luca-Davide/ryu,osrg/ryu... | ryu/lib/ip.py | ryu/lib/ip.py | from ryu.lib import addrconv
def ipv4_arg_to_bin(w, x, y, z):
"""Generate unsigned int from components of IP address
returns: w << 24 | x << 16 | y << 8 | z"""
return (w << 24) | (x << 16) | (y << 8) | z
def ipv4_to_bin(ip):
'''
Parse an IP address and return an unsigned int.
The ... | import struct
def ipv4_arg_to_bin(w, x, y, z):
"""Generate unsigned int from components of IP address
returns: w << 24 | x << 16 | y << 8 | z"""
return (w << 24) | (x << 16) | (y << 8) | z
def ipv4_to_bin(ip):
'''
Parse an IP address and return an unsigned int.
The IP address is i... | apache-2.0 | Python |
f189137d52b9f44db0e82723b0e7a16a602c6523 | Create duplicate_encoder.py | Kunalpod/codewars,Kunalpod/codewars | duplicate_encoder.py | duplicate_encoder.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Duplicate Encoder
#Problem level: 6 kyu
def duplicate_encode(word. st=""):
for char in word.lower():
if word.lower().count(char)>1: st = st + ')'
else: st = st + '('
return st
| mit | Python | |
488717ab6c84c771737a3b2ccfe8cbf4d270c9b7 | Implement dragon class | reinikai/mugloar | mugloar/dragon.py | mugloar/dragon.py | import json
class Dragon:
# By default, stay home.
scaleThickness = 0
clawSharpness = 0
wingStrength = 0
fireBreath = 0
def __init__(self, weather_code):
if weather_code == 'T E':
# Draught requires a 'balanced' dragon, ha ha
self.scaleThickness = 5
... | mit | Python | |
5f092edf48828f61042c78878474b8c85b62fbdd | Bump version to turn on SET_MAX_FPS. | jaruba/chromium.src,robclark/chromium,hgl888/chromium-crosswalk,Just-D/chromium-1,M4sse/chromium.src,pozdnyakov/chromium-crosswalk,patrickm/chromium.src,rogerwang/chromium,Jonekee/chromium.src,markYoungH/chromium.src,M4sse/chromium.src,hujiajie/pa-chromium,ondra-novak/chromium.src,littlstar/chromium.src,Jonekee/chromiu... | o3d/installer/win/o3d_version.py | o3d/installer/win/o3d_version.py | #!/usr/bin/python2.4
# Copyright 2008-9 Google Inc. All Rights Reserved.
# version = (major, minor, trunk, patch)
plugin_version = (0, 1, 43, 2)
sdk_version = plugin_version
| #!/usr/bin/python2.4
# Copyright 2008-9 Google Inc. All Rights Reserved.
# version = (major, minor, trunk, patch)
plugin_version = (0, 1, 43, 1)
sdk_version = plugin_version
| bsd-3-clause | Python |
beeb3065e2d366dd68021eb5f55c94e2c61684e4 | add experiment script | JasonWayne/avazu-essay,JasonWayne/avazu-essay | ftrl/single_feature_experiment.py | ftrl/single_feature_experiment.py | import subprocess
for i in range(3, 23):
print "\n\n\nrun field " + str(i) + "\n"
subprocess.call("python ftrl/ftrl.py train.raw.csv test.raw.csv submission.csv {0}".format(i).split(" "), shell=True) | mit | Python | |
e5f130c1f006d2b96ca81be5a9f66c15b97b8793 | Create sol2.py | TheAlgorithms/Python | project_euler/problem_12/sol2.py | project_euler/problem_12/sol2.py | def triangle_number_generator():
for n in range(1,1000000):
yield n*(n+1)//2
def count_divisors(n):
return sum([2 for i in range(1,int(n**0.5)+1) if n%i==0 and i*i != n])
print(next(i for i in triangle_number_generator() if count_divisors(i) > 500))
| mit | Python | |
5938a5d751bcac40eac2bf7f7090e1970f097ebc | Add py-rq (#19175) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-rq/package.py | var/spack/repos/builtin/packages/py-rq/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyRq(PythonPackage):
"""RQ (Redis Queue) is a simple Python library for queueing
jo... | lgpl-2.1 | Python | |
be3428c9fe6de7741cec7f3899bcc71049b113ca | Create HR_IntroToConditionalStatements.py | bluewitch/Code-Blue-Python | HR_IntroToConditionalStatements.py | HR_IntroToConditionalStatements.py | #!/bin/python3
import math
import os
import random
import re
import sys
if __name__ == '__main__':
#N = int(input())
# One liner in a lambda function
print((lambda N:'Weird' if N % 2 else 'Not Weird')(int(input())))
| mit | Python | |
9f2fc78155dc725842ebbc82203994e26d1c7333 | Add marv_ros skeleton for ROS specific code | ternaris/marv-robotics,ternaris/marv-robotics | code/marv-robotics/marv_ros/__init__.py | code/marv-robotics/marv_ros/__init__.py | # Copyright 2019 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
| agpl-3.0 | Python | |
cb29ce461eb143dc44b244576b153a0b7a3b1a7d | Create missing_element.py | HeyIamJames/CodingInterviewPractice,HeyIamJames/CodingInterviewPractice | missing_element.py | missing_element.py | """
There is an array of non-negative integers.
A second array is formed by shuffling the elements of the first array and deleting a random element.
Given these two arrays, find which element is missing in the second array.
http://www.ardendertat.com/2012/01/09/programming-interview-questions/
"""
| mit | Python | |
527288828306c3620442e611fc9fb23180ee09fe | Add remove-nth-node-from-end-of-list | ibigbug/leetcode | remove-nth-node-from-end-of-list.py | remove-nth-node-from-end-of-list.py | # Link: https://leetcode.com/problems/remove-nth-node-from-end-of-list/
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode} head
# @param {integer} n
# @return {ListNode}
def removeNthF... | mit | Python | |
90218ad99cf9d9f4599f065790ac4d388adc3521 | Add markup template filter. | ubernostrum/blog | blog/templatetags/markup.py | blog/templatetags/markup.py | from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from blog.models import markup
register = template.Library()
@register.filter
@stringfilter
def markup(value):
result = markup(value)
return mark_safe(result)
| bsd-3-clause | Python | |
28ed25a30ed495cce2d5ace3ac12c00f35f9dbcd | Add AmazonDriver | cloudcomputinghust/CAL | calplus/v1/object_storage/drivers/amazon.py | calplus/v1/object_storage/drivers/amazon.py | import boto3
from calplus.v1.object_storage.drivers.base import BaseDriver, BaseQuota
PROVIDER = 'AMAZON'
class AmazonDriver(BaseDriver):
"""AmazonDriver for Object Storage"""
def __init__(self, cloud_config):
super(AmazonDriver, self).__init__()
self.aws_access_key_id = cloud_config['aws_... | apache-2.0 | Python | |
b78518df363fb1cb398c70920f219ca9be78f816 | Test another implementation of scipy's _spectral | pombredanne/pythran,pombredanne/pythran,serge-sans-paille/pythran,serge-sans-paille/pythran,pombredanne/pythran | pythran/tests/scipy/_spectral.py | pythran/tests/scipy/_spectral.py | # Author: Pim Schellart
# 2010 - 2011
"""Tools for spectral analysis of unequally sampled signals."""
import numpy as np
#pythran export _lombscargle(float64[], float64[], float64[])
##runas import numpy; x = numpy.arange(2., 12.); y = numpy.arange(1., 11.); z = numpy.arange(3., 13.); _lombscargle(x, y, z)
def _lom... | bsd-3-clause | Python | |
a1e679b4b0802f1c40d08f1f7cba212b13de61a4 | Create testing2.py | aldmbmtl/toolbox | myPack/testing2.py | myPack/testing2.py | import aldmbmtl
aldmbmtl.toolbox.myPack.testing.test()
| mit | Python | |
0ae07ef204806ab45b746df16371c3925ea894e9 | Create problem6.py | CptDemocracy/Python | Project-Euler/Problem6/problem6.py | Project-Euler/Problem6/problem6.py | """
[ref.href] https://projecteuler.net/problem=6
Sum square difference.
The sum of the squares of the first ten natural numbers is:
1^2 + 2^2 + ... + 10^2 = 385
The square of the sum of the first ten natural numbers is:
(1 + 2 + ... + 10)^2 = 55^2 = 3025
Hence the difference between the sum of the square... | mit | Python | |
a8b07a61b56f87509f33cd3f79e7800837ef4f29 | Add lc0189_rotate_array.py | bowen0701/algorithms_data_structures | lc0189_rotate_array.py | lc0189_rotate_array.py | """Leetcode 189. Rotate Array
Easy
URL: https://leetcode.com/problems/rotate-array/
Given an array, rotate the array to the right by k steps, where k is non-negative.
Example 1:
Input: [1,2,3,4,5,6,7] and k = 3
Output: [5,6,7,1,2,3,4]
Explanation:
rotate 1 steps to the right: [7,1,2,3,4,5,6]
rotate 2 steps to the ri... | bsd-2-clause | Python | |
7bae6e3f490f4986f07ce45bf333a5982b505bd4 | add 255 | ufjfeng/leetcode-jf-soln,ufjfeng/leetcode-jf-soln | python/255_verify_preorder_sequence_in_binary_search_tree.py | python/255_verify_preorder_sequence_in_binary_search_tree.py | """
Given an array of numbers, verify whether it is the correct preorder traversal
sequence of a binary search tree.
You may assume each number in the sequence is unique.
Follow up:
Could you do it using only constant space complexity?
"""
class Solution(object):
def verifyPreorder(self, preorder):
"""
... | mit | Python | |
86686926809bfef55b71618888eec6667faaeec9 | complete 26 reciprocal cycles | dawran6/project-euler | 26-reciprocal-cycles.py | 26-reciprocal-cycles.py | """Based on chillee's answer at Fri, 6 Jan 2017, 05:06:
There's so many convoluted substring solutions.
1/3 = 3/9 = 0.(3)
1/7 = 148257/999999 = 0.(148257)
Therefore, the length of the repeating portion is length of the numerator when
you set the denominator equal to some string of 9s.
There's one other thing to keep... | mit | Python | |
4c6442382adcb716ea817fbc781a402dec36aac9 | set app.debug = True. | total-impact/software,Impactstory/impactstory-tng,total-impact/depsy,total-impact/depsy,total-impact/software,total-impact/depsy,Impactstory/biomed,total-impact/software,Impactstory/depsy,Impactstory/impactstory-tng,Impactstory/impactstory-tng,total-impact/biomed,Impactstory/oadoi,Impactstory/oadoi,Impactstory/biomed,I... | app.py | app.py | from flask import Flask
import redis
import os
from rq import Queue
app = Flask(__name__)
app.debug = True
my_redis = redis.from_url(
os.getenv("REDIS_URL", "redis://127.0.0.1:6379"),
db=10
)
redis_rq_conn = redis.from_url(
os.getenv("REDIS_URL", "redis://127.0.0.1:6379"),
db=14
)
scopus_queue = Que... | from flask import Flask
import redis
import os
from rq import Queue
app = Flask(__name__)
my_redis = redis.from_url(
os.getenv("REDIS_URL", "redis://127.0.0.1:6379"),
db=10
)
redis_rq_conn = redis.from_url(
os.getenv("REDIS_URL", "redis://127.0.0.1:6379"),
db=14
)
scopus_queue = Queue("scopus", conn... | mit | Python |
3cd4a151f9f03ecf2674348e9377e00346bbd849 | add first revision of the script | falsovsky/RTPapd | rtp.py | rtp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib2
import re
import unicodedata
import os
import string
validFilenameChars = "-_. %s%s" % (string.ascii_letters, string.digits)
def removeDisallowedFilenameChars(filename):
cleanedFilename = unicodedata.normalize('NFKD', file... | bsd-2-clause | Python | |
8947167b0442b8d03cfd328fd77961a864f54638 | Create double.py | NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference | CodeWars/8kyu/double.py | CodeWars/8kyu/double.py | def doubleInteger(i):
return i + i
| mit | Python | |
3f2a1aa0ce76dc50662e11da50149d0de231c848 | add keys | daya0576/matelook_mini-facebook,daya0576/matelook_mini-facebook,daya0576/matelook_mini-facebook | keys.py | keys.py | G_EMAIL_KEY = ""
| mit | Python | |
cec1cc8082854a0fd61ea83bb69ba1e9d013b089 | Create libs.py | ink-ru/sublime-triks,ink-ru/sublime-triks | libs.py | libs.py | # coding: utf-8
'''Библиотеки SEO модуля'''
import sublime, sublime_plugin, re, urllib
class xenuTools:
def download_url_to_string(url):
request = urllib.request.Request(url)
response = urllib.request.urlopen(request)
html = response.read()
return html
def getrobots(url):
#TODO: split single line files... | cc0-1.0 | Python | |
25d90937ecce5e18e32a9f7e14b5744d21c14cfb | add simple box zoom example | huongttlan/mpld3,giserh/mpld3,danielballan/mpld3,jakevdp/mpld3,litaotao/mpld3,jayhetee/mpld3,mlovci/mpld3,e-koch/mpld3,aflaxman/mpld3,void32/mpld3,jakevdp/mpld3,CrazyGuo/mpld3,fdeheeger/mpld3,void32/mpld3,ahnitz/mpld3,jakirkham/mpld3,jrkerns/mpld3,fdeheeger/mpld3,linearregression/mpld3,aflaxman/mpld3,CrazyGuo/mpld3,kdh... | examples/box_zoom.py | examples/box_zoom.py | import mpld3
from mpld3.plugins import PluginBase
class BoxZoomPlugin(PluginBase):
"""Box Zoom"""
JAVASCRIPT = r"""
mpld3.BoxZoomPlugin = function(fig, prop){
this.fig = fig;
this.prop = mpld3.process_props(this, prop, {}, []);
// add a button to enable/disable box zoom
mpld3.ButtonFactory({
t... | bsd-3-clause | Python | |
c04610422ffd6e0fe87c62d7a8039116f804467c | Add jupyterhub config | everware/everware,betatim/everware,astiunov/everware,everware/everware,astiunov/everware,astiunov/everware,astiunov/everware,ibab/everware,everware/everware,sashabaranov/everware,ibab/everware,betatim/everware,sashabaranov/everware,ibab/everware,betatim/everware,everware/everware,sashabaranov/everware,sashabaranov/ever... | jupyterhub_config.py | jupyterhub_config.py | import os
import everware
import jupyterhub.handlers.pages
jupyterhub.handlers.pages.HomeHandler.get = everware.HomeHandler.get
jupyterhub.handlers.pages.HomeHandler.post = everware.HomeHandler.post
c = get_config()
# spawn with custom docker containers
c.JupyterHub.spawner_class = 'everware.CustomDockerSpawner'
# ... | bsd-3-clause | Python | |
010f19ab2f9c0f3305d7f2eabcbbd33952a58fdd | Add a dir | karnikamit/python,llluiop/python-1,Mark24Code/python,whix/python,ZSeaPeng/python,EricSekyere/python,JiYouMCC/python,DanielShangHai/python,merfii/PythonExercises,merfii/PythonExercises,wangjun/python,tzq668766/python,JiYouMCC/python,Show-Me-the-Code/python,snailwalker/python,hooting/show-me-the-code-python,renzongxian/S... | stingroc/0002/0002.py | stingroc/0002/0002.py | print "0002"
| mit | Python | |
1c6aebcf02d698c6a1722476978fb88fbf6c218d | Add CartPole TF HighLevel | AlwaysLearningDeeper/OpenAI_Challenges,AlwaysLearningDeeper/Project | src/CartPole-v0/TF_High_Level_NN.py | src/CartPole-v0/TF_High_Level_NN.py | import gym
import time
import random
import numpy as np
import tensorflow as tf
from statistics import median, mean
from collections import Counter
import os
tf.logging.set_verbosity(tf.logging.FATAL)
LR = 1e-3
env = gym.make("CartPole-v0")
env.reset()
goal_steps = 500
score_requirement = 50
initial_games = 10000
... | mit | Python | |
287a89307af6ad720978682f49c01e39259303ec | Create censys_monitor.py | nremynse/Automation-Scripts | censys_monitor.py | censys_monitor.py | import censys.certificates
import json
import requests
import os
import random
#UID = ""
#SECRET = ""
#api for remynseit and remynse
UIDS = ["UID1", "UID2", "UID3"]
SECRETS = {"secret": "value", "secret2": "value2"}
'''
Search
(utah.edu.*) AND NOT parsed.subject_dn.raw:/.*utah.edu/
'''
alert_webhook = ''
known_cer... | mit | Python | |
731118d82aa41689f12adb32ea37be55be89a757 | Add gpu_buffer.py | Kupoman/Fafnir | fafnir/gpu_buffer.py | fafnir/gpu_buffer.py | import panda3d.core as p3d
class GpuBuffer:
def __init__(self, name, count, data_type, data_format):
self.buffer = p3d.Texture(name)
self.data_type = data_type
self.data_format = data_format
self.resize(count)
def resize(self, count):
self.buffer.setup_buffer_texture(
... | apache-2.0 | Python | |
3cb7c1cd73dfb73d96af15a183d4e7ef6a9369e8 | create src | HeavenH/teleGit | src/GitApi.py | src/GitApi.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from requests import get
from json import loads
from argparse import ArgumentParser
class GitHub():
def GetRepos(self, user):
self.msg = ""
req = loads(get('https://api.github.com/users/' +
user + '/repos').text)
self.m... | mit | Python | |
4f751298176bf2118d4a638e106d5e9572725178 | Add utility class | fastner/konstrukteur,fastner/konstrukteur,fastner/konstrukteur | konstrukteur/Util.py | konstrukteur/Util.py | #
# Konstrukteur - Static website generator
# Copyright 2013 Sebastian Fastner
#
import re
import unidecode
def fixCoreTemplating(content):
""" This fixes differences between core JS templating and standard mustache templating """
# Replace {{=tagname}} with {{&tagname}}
content = re.sub(r"{{=(?P<tag>.+?)}}", "{{... | mit | Python | |
fea74aa88af88ea352b72525ecbf22a0fbd4e3db | Make a histogram and visualize it | naoyak/Agile_Data_Code_2,naoyak/Agile_Data_Code_2,rjurney/Agile_Data_Code_2,naoyak/Agile_Data_Code_2,rjurney/Agile_Data_Code_2,rjurney/Agile_Data_Code_2,rjurney/Agile_Data_Code_2,naoyak/Agile_Data_Code_2 | ch02/histogram.py | ch02/histogram.py | # Load the parquet file containing flight delay records
on_time_dataframe = spark.read.parquet('data/on_time_performance.parquet')
# Register the data for Spark SQL
on_time_dataframe.registerTempTable("on_time_performance")
# Compute a histogram of departure delays
on_time_dataframe\
.select("DepDelay")\
.rdd\
... | mit | Python | |
168f6a9d557d1813649fd060dbfa1217355443df | Implement main for entry | chhsiao90/cheat-ext | cheat_ext/main.py | cheat_ext/main.py | from __future__ import print_function
import argparse
from cheat_ext.installer import (
install, upgrade, remove
)
from cheat_ext.linker import link
def _install(args):
install(args.repository)
link(args.repository)
def _upgrade(args):
upgrade(args.repository)
def _remove(args):
remove(args.r... | mit | Python | |
fadae1b5213f9c2b08e061376fcb3a0c519c0e93 | sort of working | bhpayne/domino_tile_floor,bhpayne/domino_tile_floor,bhpayne/domino_tile_floor | domino_tiles_transition_graph.py | domino_tiles_transition_graph.py |
def create_transition_dic(width,height):
transition_dic={}
transition_dic[1]=[2,4]
transition_dic[2]=[1,5,3]
transition_dic[3]=[2,6]
transition_dic[4]=[1,5]
transition_dic[5]=[4,2,6]
transition_dic[6]=[3,5]
return transition_dic
def print_list_of_transitions(list_of_transitions):
... | apache-2.0 | Python | |
91bb20158513e5ba2a8fbaccb0c7b80ffabdb36b | Add demo for PyCUDA IAF trig-poly decoder. | bionet/ted.python | demos/iaf_trig_cuda_demo.py | demos/iaf_trig_cuda_demo.py | #!/usr/bin/env python
"""
Demos for basic time encoding and decoding algorithms that use
IAF neurons. The decoding algorithms assume a trigonometric polynomial
approximation of the input signals.
"""
import sys
import numpy as np
# Set matplotlib backend so that plots can be generated without a
# display:
import mat... | bsd-3-clause | Python | |
6420dc0127f0f33036fe0f9258d5350da5faef6d | Create filtering.py | krzjoa/sciquence,krzjoa/sciquence | sciquence/sequences/filtering.py | sciquence/sequences/filtering.py | def parallel_filter(condition, *lists):
'''
Parallelly filter multiple lists.
Parameters
----------
condition: callable
A function, which has as many arguments as the number of lists
lists: list of list
Returns
-------
filtered_lists:
Filtered accordingly s... | mit | Python | |
0bd93c02ab7917d570a74cf151dfb5789c3bf174 | Add a brutal script for removing concepts in bulk while testing | fzadow/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,fzadow/CATMAID | scripts/remove_concepts_after.py | scripts/remove_concepts_after.py | # An entirely untested script to delete all the concepts in the
# CATMAID database for a particular project.
# Mark Longair 2010
import os
from jarray import array
from java.sql import DriverManager, Connection, SQLException, Types
# FIXME: Just hardcode the user_id and project_id for the moment
user_id = 3
proje... | agpl-3.0 | Python | |
39b156cb3e208c3d06ced6fb086ab171209ac346 | add ctable fixture | SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,p... | psi/ctable_mappings.py | psi/ctable_mappings.py | from ctable.fixtures import CtableMappingFixture
from ctable.models import ColumnDef, KeyMatcher
class EventsMapping(CtableMappingFixture):
name = 'events'
domains = ['psi-unicef', 'psi']
couch_view = 'psi/events'
schedule_active = True
@property
def columns(self):
columns = [
... | bsd-3-clause | Python | |
f3a02b3570724964f60d10a8112e0d8eb32dddc7 | Add 4chan download script | codepony/useful-stuff,codepony/useful-stuff,codepony/useful-stuff | 4chan.py | 4chan.py | #!/usr/bin/python
# Protip: want to monitor a thread and download all new images every 5 seconds?
# while x= 0 ; do 4c [-nf] url; sleep 5; done
import re, urllib, urllib2, argparse, os
parser = argparse.ArgumentParser(description='Downloads all full-size images in one or more arbitrary 4chan threads.')
par... | mit | Python | |
b166caa9fb0efa4aceab315fd6a945d2fe6922e4 | Patch fixed | geekroot/erpnext,gsnbng/erpnext,indictranstech/erpnext,geekroot/erpnext,njmube/erpnext,njmube/erpnext,geekroot/erpnext,gsnbng/erpnext,indictranstech/erpnext,geekroot/erpnext,indictranstech/erpnext,Aptitudetech/ERPNext,indictranstech/erpnext,gsnbng/erpnext,njmube/erpnext,gsnbng/erpnext,njmube/erpnext | erpnext/patches/v7_2/update_salary_slips.py | erpnext/patches/v7_2/update_salary_slips.py | import frappe
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
def execute():
salary_slips = frappe.db.sql("""select fiscal_year, month, name from `tabSalary Slip`
where (month is not null and month != '')
and (fiscal_year is not null and fiscal_year != '') and
(start_dat... | import frappe
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
def execute():
salary_slips = frappe.db.sql("""select fiscal_year, month, name from `tabSalary Slip`
where (month is not null and month != '')
and (fiscal_year is not null and fiscal_year != '') and
(start_dat... | agpl-3.0 | Python |
c2151ae33c44f29d15d494d4862645beb33671cb | Add comments tests | bcroq/kansha,Net-ng/kansha,Net-ng/kansha,Net-ng/kansha,bcroq/kansha,bcroq/kansha,Net-ng/kansha,bcroq/kansha | kansha/card_addons/comment/tests.py | kansha/card_addons/comment/tests.py | # -*- coding:utf-8 -*-
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
from nagare import security
from kansha.cardextension.tests import CardExt... | bsd-3-clause | Python | |
29a05075e500635b10a25931045702888b12618f | add main file | Agiroq/VW | main.py | main.py | import gas
GASANALOG = 0
ALARMLED = 13
gas = machine.ADC(GASANALOG)
gasLED = machine.Pin(ALARMLED, machine.Pin.OUT)
g = gas.CheckGas(led=gasLED, sensor=gas, time=1000)
| cc0-1.0 | Python | |
6b96008b3e89e3ff6a5616a68e49af3e41b2bc0b | Create main.py | Myselfminer/nCuberPlug | main.py | main.py | #!/usr/bin/python
"""
__version__ = "$Revision: 1.3 $"
__date__ = "$Date: 2004/04/14 02:38:47 $"
"""
import nID
import plugin
import os
repository_nid="all_url:https://www.dropbox.com/s/tvyxx5iidodidz2/nid_sample_list.txt?dl=1@name:Sample Repo Name@owner:myselfminer"
from PythonCard import model
class MyBackground... | apache-2.0 | Python | |
ec0ac308420a6cfd24b4093ef279deeb1f8728ec | Add a huge start-to-finish integration test. | cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO | tests/integration/test_full_integration.py | tests/integration/test_full_integration.py | #!/usr/bin/env python2.7
'''Test the full client access sequence.
It is pretty much the anti-pattern of testing.
'''
import unittest
from tornado.web import Application
from tornado.testing import AsyncHTTPTestCase
import sys
sys.path.append(".")
import json
from urllib import urlencode
from authserver import PingH... | agpl-3.0 | Python | |
9e388ad5b78967f87a0b3b55235bd1e19183c152 | Test for the PaladinSpellSchema values | Enether/python_wow | tests/models/spells/test_paladin_spells.py | tests/models/spells/test_paladin_spells.py | import unittest
from tests.delete_test_db import delete_test_db # module that deletes the DB :)
import database.main
from tests.create_test_db import engine, session, Base
database.main.engine = engine
database.main.session = session
database.main.Base = Base
import models.main
from models.spells.paladin_spells_tem... | mit | Python | |
8303188f2378bace2974c5eac65fda8433629935 | Add exercise 3 checking code | Kaggle/learntools,Kaggle/learntools | learntools/deep_learning_new/ex3.py | learntools/deep_learning_new/ex3.py | from learntools.core import *
_inputs = 50
# Data Preparation
class Q1(CodingProblem):
_hint = ""
_solution = ""
def check(self):
pass
class Q2(CodingProblem):
_var = "input_shape"
_hints = [
"Think about whether you should look at the processed data `X_train` or the original data... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.