commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
b94e4f369b5881f579ca47e48ae191324c19990e | Add .bmp image encoder | image-generation/bmp.py | image-generation/bmp.py | #!/usr/bin/python3
import struct
def encode_bmp(f, width, height, data, bpp=24):
# 'bpp' stands for "bits per pixel" (usually 24 for RGB, 8+8+8)
# 'data' should be a bi-dimensional array matching 'width' and 'height'
# Calculate the BMP data size and the required padding (% 4)
bytes_per_row = wi... | Python | 0 | |
009bf3d7ffc6545cb2d37a36bc327de2bebd283d | Comment admin ought to have a better preview; #444 | judge/admin/comments.py | judge/admin/comments.py | from django.forms import ModelForm
from django.urls import reverse_lazy
from django.utils.html import format_html
from django.utils.translation import ungettext, ugettext_lazy as _
from reversion.admin import VersionAdmin
from judge.models import Comment
from judge.widgets import HeavyPreviewAdminPageDownWidget, Heavy... | from django.forms import ModelForm
from django.utils.html import format_html
from django.utils.translation import ungettext, ugettext_lazy as _
from reversion.admin import VersionAdmin
from judge.models import Comment
from judge.widgets import MathJaxAdminPagedownWidget, HeavySelect2Widget
class CommentForm(ModelFor... | Python | 0 |
59837bda53b958c7fdb50a3b2808a42fd667cd96 | Create z07-dnn_autoencoder_iris.py | skflow-examples/z07-dnn_autoencoder_iris.py | skflow-examples/z07-dnn_autoencoder_iris.py | # Copyright 2015-present The Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | Python | 0.000016 | |
96eba676abeb8c70dcaddb692133a9314e2255c3 | Add harvester for pcom | scrapi/harvesters/pcom.py | scrapi/harvesters/pcom.py | '''
Harvester for the DigitalCommons@PCOM for the SHARE project
Example API call: http://digitalcommons.pcom.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class PcomHarvester(OAIHarvester):
short_name = 'pcom'
long_name = ... | Python | 0 | |
e0b93ff74ee6eeabf29567a13d2e31de11a3b68a | Make migration | cms_lab_carousel/migrations/0003_auto_20150827_0111.py | cms_lab_carousel/migrations/0003_auto_20150827_0111.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import filer.fields.image
class Migration(migrations.Migration):
dependencies = [
('cms_lab_publications', '0001_initial'),
('cms_lab_carousel', '0002_auto_20150508_1300'),
]
operati... | Python | 0.991368 | |
aefd4009393e5ebf05ea9e485a1723776689ed70 | add node and node to container link | tests/acceptance/mapping/node_at.py | tests/acceptance/mapping/node_at.py | # Ariane CLI Python 3
# Node acceptance tests
#
# Copyright (C) 2015 echinopsii
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) an... | Python | 0 | |
84ae279c0044e63e00c7d21823c3159e34c73d03 | Add a memory test script | scripts/uvfits_memtest.py | scripts/uvfits_memtest.py | #!/usr/bin/env python2.7
# -*- mode: python; coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from memory_profiler import profile
import numpy as np
from astropy import constants as const
from astropy.io import fits
from pyuvdata import UVData
@profile
def read_uvfits():
filena... | Python | 0.000003 | |
6bb1d3939a076d7b7fe799cdac8885a5f67219e3 | add ex32 | ex32.py | ex32.py | the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
# this first kind of for-loop goes through a list for number in the_count
for number in the_count:
print "This is count %d" % number
#same as above
for fruit in fruits:
print "A f... | Python | 0.000637 | |
ef21221842ac401bfd083614d879a7b6c19b816a | add song.py: add Song class | song/song.py | song/song.py | # -*- coding: utf-8 -*-
"""
Author
------
Bo Zhang
Email
-----
bozhang@nao.cas.cn
Created on
----------
- Fri Feb 24 16:00:00 2017
Modifications
-------------
-
Aims
----
- Song class
"""
import glob
import sys
import numpy as np
from astropy.io import fits
from astropy.table import Table, Column
from tqdm imp... | Python | 0.000002 | |
46a71071ed4982b02d0e49818a678dc2744c1b23 | Bump version number to 1.0 | flask/__init__.py | flask/__init__.py | # -*- coding: utf-8 -*-
"""
flask
~~~~~
A microframework based on Werkzeug. It's extensively documented
and follows best practice patterns.
:copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details.
"""
__version__ = '1.0'
# utilities we import from Werkzeug and Ji... | # -*- coding: utf-8 -*-
"""
flask
~~~~~
A microframework based on Werkzeug. It's extensively documented
and follows best practice patterns.
:copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details.
"""
__version__ = '1.0-dev'
# utilities we import from Werkzeug an... | Python | 0.000074 |
4026587594fee9dd150c7afefe28066a27bfd1bd | Add the calibration module. | forestci/calibration.py | forestci/calibration.py | """
Calibration based on empirical Bayes estimation [Efron2014]_.
This calibration procedure can be useful when the number of trees in the
random forest is small.
.. [Efron2014] B Efron. "Two modeling strategies for empirical Bayes
estimation." Stat. Sci., 29(2): 285–301, 2014.
"""
import functools
... | Python | 0 | |
59b1995789ede7da1757f23b5920e627e1d7818d | add maximum product subarray | interview/amazon/mps.py | interview/amazon/mps.py | class Solution:
def maxProduct(self, A):
r = A[0]
n = len(A)
imin = r
imax = r
for i in xrange(1, n):
if A[i] < 0:
imax, imin = imin, imax
imax = max(A[i], imax * A[i])
imin = min(A[i], imin * A[i])
r = max(r,... | Python | 0.000029 | |
3d2ad56b5d24405eb6f261b32b0347a7e7d8785a | use make_muc_presence | tests/twisted/muc/test-muc-alias.py | tests/twisted/muc/test-muc-alias.py | """
Test that our alias is used to create MUC JIDs.
Mash-up of vcard/test-set-alias.py and muc/test-muc.py.
"""
import dbus
from twisted.words.xish import domish
from gabbletest import go, make_result_iq, acknowledge_iq, exec_test, make_muc_presence
from servicetest import call_async, lazy, match, EventPattern
def ... | """
Test that our alias is used to create MUC JIDs.
Mash-up of vcard/test-set-alias.py and muc/test-muc.py.
"""
import dbus
from twisted.words.xish import domish
from gabbletest import go, make_result_iq, acknowledge_iq, exec_test
from servicetest import call_async, lazy, match, EventPattern
def test(q, bus, conn, ... | Python | 0.000008 |
4c9af992891ac5d39be50f9876a807f131a922e4 | prepare the organism annotation details | gfftools/gff_db.py | gfftools/gff_db.py | #!/usr/bin/env python
"""
Fetch the details about the features explained in a GFF type file.
Usage: python feature_info.py in.gff
Requirements:
gfftools : https://github.com/vipints/genomeutils/blob/master/gfftools
"""
import re
import sys
import GFFParser
def Intron_det(TDB):
"""
get the intron feature... | Python | 0.000001 | |
a7787c60af7059f3b1a4dc3773da04dfc72631e2 | Add tools.ping | grab/tools/ping.py | grab/tools/ping.py | from grab import Grab
import logging
import os
from grab.tools import html
from grab.tools.pwork import make_work
from grab.tools.encoding import smart_str
PING_XML = """<?xml version="1.0"?>
<methodCall>
<methodName>weblogUpdates.ping</methodName>
<params>
<param><value>%(name)s</value></param>
<p... | Python | 0.000001 | |
f31a735ce54f74e7a38edaeb7c404a2dec8e5584 | add script | MeowRTC/cloud/stack/python/scripts/sample-p2p.py | MeowRTC/cloud/stack/python/scripts/sample-p2p.py | import logging
import jinja2
import webapp2
import os
import random
import json
from google.appengine.api import channel
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
logging.getLogger().setLevel(logging.DEBUG)
users = set()
def random_string():
str = ''
for _... | Python | 0.000001 | |
4c60f8f643fe05b69ca475242d8c46b02697d5d4 | Add example for type-checking chain | examples/howto/type_chain.py | examples/howto/type_chain.py | from thinc.api import chain, ReLu, MaxPool, Softmax, chain
# This example should be run with mypy. This is an example of type-level checking
# for network validity.
#
# We first define an invalid network.
# It's invalid because MaxPool expects Floats3d as input, while ReLu produces
# Floats2d as output. chain has typ... | Python | 0.000001 | |
f6bdab51054b08d203251b0e7e73ed7818613c8d | add models.py file so test runner will recognize the app | eca_catalogue/text/models.py | eca_catalogue/text/models.py | # Hello test runner
| Python | 0 | |
ce792a1b167b268ba1f798b3b08e08679d962d02 | Create distributeOnSurface.py | af_scripts/tmp/distributeOnSurface.py | af_scripts/tmp/distributeOnSurface.py | import random
import maya.mel
class distributeOnSurface(object):
def __init__(self):
pass
def _UI(self):
if cmds.window('dosWin',exists=True):
cmds.deleteUI('dosWin',window=True)
w=300
w2=180
cmds.window('dosWin',t="Distribute On Surface",s=0,rtf=1... | Python | 0 | |
e484b67372be22dae78a526c21e62661e4602913 | Add todo files with incomplete fixes | test/todo.py | test/todo.py | raise KeyError, key
def foo(a
, b):
pass
| Python | 0 | |
c669d498fa81ffb399d7d7c42654f5ac69428a28 | Update templates.py | infra/templates.py | infra/templates.py | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Python | 0.000001 |
47f7fa72ab3ba75ad4182592f6413702fd509ba7 | Create middleware to redirect users when accessing certain paths | iogt/middleware.py | iogt/middleware.py | from django.conf import settings
from django.http import HttpResponsePermanentRedirect
class SSLRedirectMiddleware(object):
def process_request(self, request):
HTTPS_PATHS = getattr(settings, 'HTTPS_PATHS', [])
response_should_be_secure = self.response_should_be_secure(
request, HTTPS_... | Python | 0 | |
eeab27ecc6843136938e7607a619baef8626118a | Make contest_ranking visible | judge/views/contests.py | judge/views/contests.py | from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from judge.comments import comment_form, contest_comments
from judge.models import Contest
__all__ = ['contest_list', 'c... | from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from judge.comments import comment_form, contest_comments
from judge.models import Contest
__all__ = ['contest_list', 'c... | Python | 0.000073 |
65e4659ccd3f22f817403dc39869626873f9fb34 | Add test_runner.py | test/test_runner.py | test/test_runner.py | from microscopes.lda.definition import model_definition
from microscopes.lda import model, runner
from microscopes.common.rng import rng
def test_runner_simple():
defn = model_definition(n=10, v=20)
r = rng()
data = [[1, 2, 3, 4, 5], [2, 3, 4]]
view = data
latent = model.initialize(defn=defn, data... | Python | 0.000014 | |
2bd52d823c9ae039dd0cc0adbabe7a47f003138e | Add unit tests | examples/ppo/unit_tests.py | examples/ppo/unit_tests.py |
import jax
import flax
from flax import nn
import numpy as onp
import numpy.testing as onp_testing
from absl.testing import absltest
#test GAE
from main import gae_advantages
class TestGAE(absltest.TestCase):
def test_gae_random(self):
# create random data, simulating 4 parallel envs and 20 time_steps
envs... | Python | 0.000001 | |
f6fb9266ec9a2acebae31b042647437e922648d1 | Add spinning cube example with texture From Euroscipy tutorial | examples/spinning-cube2.py | examples/spinning-cube2.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Show spinning cube using VBO's, and transforms, and texturing.
"""
import numpy as np
from vispy import app, gl, oogl, io
from transforms import perspective, translate, rotate
VERT_CODE = """
uniform mat4 u_model;
uniform mat4 u_view;
uniform mat4 u_projection;... | Python | 0 | |
4c76f9bc68451eb41338173ffbda460098d1e24e | make form reprocessing more error tolerant and verbose | corehq/apps/cleanup/management/commands/reprocess_error_forms.py | corehq/apps/cleanup/management/commands/reprocess_error_forms.py | from django.core.management.base import BaseCommand, CommandError, LabelCommand
from corehq.apps.cleanup.xforms import iter_problem_forms, reprocess_form_cases
from optparse import make_option
from dimagi.utils.parsing import string_to_datetime
class Command(BaseCommand):
args = '<domain> <since>'
help = ('Rep... | from django.core.management.base import BaseCommand, CommandError, LabelCommand
from corehq.apps.cleanup.xforms import iter_problem_forms, reprocess_form_cases
from optparse import make_option
from dimagi.utils.parsing import string_to_datetime
class Command(BaseCommand):
args = '<domain> <since>'
help = ('Rep... | Python | 0.000004 |
b30a159d216113ce122506359ccf1d11767422bb | Handle non-string keys | src/sentry/utils/data_scrubber.py | src/sentry/utils/data_scrubber.py | """
sentry.utils.data_scrubber
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import re
import six
from sentry.constants import DEFAULT_SCRUBBED_FIELDS
def varmap(func, va... | """
sentry.utils.data_scrubber
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import re
import six
from sentry.constants import DEFAULT_SCRUBBED_FIELDS
def varmap(func, va... | Python | 0.025655 |
d344c91008198927d45cd7a3330915bd9e8fd89f | Add The Fucking Weather module from yano | willie/modules/fuckingweather.py | willie/modules/fuckingweather.py | """
fuckingweather.py - Willie module for The Fucking Weather
Copyright 2013 Michael Yanovich
Copyright 2013 Edward Powell
Licensed under the Eiffel Forum License 2.
http://willie.dftba.net
"""
from willie import web
import re
def fucking_weather(willie, trigger):
text = trigger.group(2)
if not text:
... | Python | 0 | |
27c955963bfc640f5e91d103a4aff8e2a897597c | Implement profiling | jtgpy/profiling.py | jtgpy/profiling.py | from datetime import datetime
import logging
def log_time(target, message, log_method=None, target_args=None, target_kwargs=None):
"""Execute target and log the start/elapsed time before and after execution"""
logger = logging.info
if log_method is not None:
logger = log_method
start_time = datetime.now()
lo... | Python | 0.000015 | |
d9a6ea57ad7bb1d7f3716fe16a49a8a24edceb67 | Fix migrations for python3 | registrations/migrations/0010_auto_20180212_0802.py | registrations/migrations/0010_auto_20180212_0802.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2018-02-12 08:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registrations', '0009_auto_20171027_0928'),
]
operations = [
migrations.Alte... | Python | 0.000012 | |
e3c6ebd09af5292c496e3a69af499d2a507ce7dd | add demo main file | demos/blog/main.py | demos/blog/main.py | import asyncio
import logging
import pathlib
import yaml
import aiopg.sa
import aiohttp_jinja2
import jinja2
from aiohttp import web
import aiohttp_admin
from aiohttp_admin.backends.sa import SAResource
import db
PROJ_ROOT = pathlib.Path(__file__).parent.parent
TEMPLATES_ROOT = pathlib.Path(__file__).parent / 'templ... | Python | 0 | |
c4ee87fa4398eca3193331888086cb437436722e | Add some tests for hil_client | test/hil_client_test.py | test/hil_client_test.py | """
General info about these tests
The tests assusme that the nodes are in the <from_project> which is set to be the
"slurm" project, since that is what we are testing here.
If all tests pass successfully, then nodes are back in their original state.
Class TestHILReserve moves nodes out of the slurm project and into... | Python | 0 | |
ed3ea4c4a03927bc351951aa325958db8103441c | Test CLI | test/base.py | test/base.py | #!/usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... | Python | 0.000001 | |
63b6dca1f3c72e81468a79afde19bb6a84d14791 | Add Landscape inventory plugin | plugins/inventory/landscape.py | plugins/inventory/landscape.py | #!/usr/bin/env python
# (c) 2015, Marc Abramowitz <marca@surveymonkey.com>
#
# This file is part of Ansible.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (... | Python | 0 | |
085817b8444470c1e17ea25d4a406ce9fbcae2fc | fix previous fix. hello monday morning | test/test_freeze_app.py | test/test_freeze_app.py | # coding: utf-8
"""
Test CLI following the recipe at http://dustinrcollins.com/testing-python-command-line-apps
"""
import os
import unittest
from tempfile import mkdtemp
from shutil import rmtree
from copy import copy
from six import StringIO
from dataset import connect
from dataset.util import FreezeException
from ... | # coding: utf-8
"""
Test CLI following the recipe at http://dustinrcollins.com/testing-python-command-line-apps
"""
import os
from unittest import TestCase
from tempfile import mkdtemp
from shutil import rmtree
from copy import copy
from six import StringIO
from dataset import connect
from dataset.util import FreezeE... | Python | 0.999999 |
68aa95a159a3c567b8aae32658092c99b94c60cf | add mail.py | test/mail.py | test/mail.py | #!/usr/bin/env python2.7
import os;
import sys;
import smtplib
import time
def smtp_test(host, port, user, passwd, touser):
smtp = smtplib.SMTP()
smtp.set_debuglevel(1)
smtp.connect("smtp.sina.com", "25")
smtp.login("zhch_todo@sina.com", "yuanzc")
smtp.sendmail("zhch_todo@sina.com", "zhch_todo@si... | Python | 0.000002 | |
4f036669d604a902530e00ecc800b9baca6e69d1 | Initialize stream getter for current dates games | streams.py | streams.py | import praw
import collections
r = praw.Reddit('Getter for stream links from /r/nbastreams by /u/me')
| Python | 0 | |
50383f51794babceb89503d091d520c5c3032db3 | add gc testing code | tests/_andre/test_gc.py | tests/_andre/test_gc.py |
__author__ = "Andre Merzky"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__ = "MIT"
import gc
import sys
import saga
from pprint import pprint as pp
try :
if True :
js1 = saga.job.Service ('ssh://localhost/bin/sh')
print sys.getrefcount (js1)
pp (gc.get_referr... | Python | 0.000001 | |
b04e10af3c0ecc3258b476dbe58c758ece888349 | add migration file required by new paperclip/mapentity | geotrek/common/migrations/0002_auto_20170323_1433.py | geotrek/common/migrations/0002_auto_20170323_1433.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import embed_video.fields
class Migration(migrations.Migration):
dependencies = [
('common', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='attachment... | Python | 0 | |
c556ac78efe4b9a9453016dfdf39219852b42676 | test app, certain to fail | tests/app.py | tests/app.py | import tornado.ioloop
import tornado.web
from graphnado import GraphQLHandler
if __name__ == '__main__':
application = tornado.web.Application([
(r'/graphql', GraphQLHandler)
])
application.listen(8888)
tornado.ioloop.IOLoop.current().start()
| Python | 0 | |
15eb41ba9ac22eb2ecc60b82807ca7f333f578b9 | Add basic methods for accessing user data | iatidq/dqusers.py | iatidq/dqusers.py |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | Python | 0.000005 | |
8c287ca7b3f184c692356c81a93007936a7a5b01 | fix import torngas but not found tornado | torngas/__init__.py | torngas/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'mqingyn'
__version__ = '1.8.2'
version = tuple(map(int, __version__.split('.')))
try:
from settings_manager import settings
from webserver import Server, run
from exception import ConfigError, ArgumentError
from urlhelper import Url, route, in... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'mqingyn'
__version__ = '1.8.1'
version = tuple(map(int, __version__.split('.')))
from settings_manager import settings
from webserver import Server, run
from exception import ConfigError, ArgumentError
from urlhelper import Url, route, include
from utils imp... | Python | 0 |
04fde8a3ca20748fda383ef5a63e885131887ea2 | Add script for downloading the integrated runtime (IRT) library | build/download_nacl_irt.py | build/download_nacl_irt.py | #!/usr/bin/env python
# Copyright (c) 2011 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.
import hashlib
import optparse
import os
import urllib2
import sys
import time
# Print a dot every time this number of bytes is r... | Python | 0.011125 | |
19b588e4ac9811879fba7e98943cf5925a774a00 | add migration 102bbf265d4 | migrations/versions/102bbf265d4_.py | migrations/versions/102bbf265d4_.py | """empty message
Revision ID: 102bbf265d4
Revises: 3d1138bbc68
Create Date: 2015-06-12 01:35:12.398937
"""
# revision identifiers, used by Alembic.
revision = '102bbf265d4'
down_revision = '3d1138bbc68'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | Python | 0.000004 | |
dd25e263b099b86e7b9538e474ad875798514be5 | Add StorageDevice class | Cura/StorageDevice.py | Cura/StorageDevice.py |
## Encapsulates a number of different ways of storing file data.
#
class StorageDevice(object):
def __init__(self):
super(StorageDevice, self).__init__()
self._properties = {}
## Open a file so it can be read from or written to.
# \param file_name The name of the file to open. Can be ... | Python | 0 | |
a4a54ee5c86a09b5f01efe57b013fdc25648d326 | Add morango full facility sync management command. | kolibri/auth/management/commands/fullfacilitysync.py | kolibri/auth/management/commands/fullfacilitysync.py | from django.utils.six.moves import input
from kolibri.auth.models import FacilityUser
from kolibri.core.device.utils import device_provisioned
from kolibri.core.device.models import DevicePermissions, DeviceSettings
from kolibri.tasks.management.commands.base import AsyncCommand
from morango.controller import MorangoPr... | Python | 0 | |
dbc1e4c5348e1a64279018910d1e73542c016313 | Fix TestAccountElsewhere.test_github_oauth_url_not_susceptible_to_injection_attack. | tests/test_elsewhere.py | tests/test_elsewhere.py | from __future__ import print_function, unicode_literals
from aspen.website import Website
from gittip.elsewhere.twitter import TwitterAccount
from gittip.testing import Harness
from gittip.elsewhere import bitbucket, github, twitter
# I ended up using TwitterAccount to test even though this is generic
# functionality... | from __future__ import print_function, unicode_literals
from aspen.website import Website
from gittip.elsewhere.twitter import TwitterAccount
from gittip.testing import Harness
from gittip.elsewhere import bitbucket, github, twitter
# I ended up using TwitterAccount to test even though this is generic
# functionality... | Python | 0 |
0543bfa278e1bb2a8eb37bc0c8f065ddde2ed21f | Add object doubling as lxml Element and string #274 | judge/lxml_tree.py | judge/lxml_tree.py | from lxml import html
class HTMLTreeString(object):
def __init__(self, str):
self.tree = html.fromstring(str)
def __getattr__(self, attr):
return getattr(self.tree, attr)
def __unicode__(self):
return html.tostring(self.tree)
| Python | 0 | |
7082a99135811815c27c3d6ef484a7ee89e84008 | Manually backfill lti_config dicts | lti_consumer/migrations/0010_backfill-empty-string-lti-config.py | lti_consumer/migrations/0010_backfill-empty-string-lti-config.py | """
Backfill empty lti_config records
We need to do this with raw SQL,
otherwise the model fails upon instantiation,
as the empty string is an invalid JSON dictionary.
"""
import uuid
from django.db import connection
from django.db import migrations
sql_forward = """\
UPDATE
lti_consumer_lticonfiguration
SET
... | Python | 0.999895 | |
cf664a5dce20da4af5ce1962f38613c8122cb111 | reverse iqtreenames | iqtree_namefix.py | iqtree_namefix.py | #!/usr/bin/env python
import sys
import os
import re
from sys import argv
def name_catalog(logFile):
catalog = {}
switch = 0
try:
log= open(logFile, 'r')
except:
print "There was a problem reading the file %s" %logFile
exit(1)
for line in log:
if line == "WARNING: ... | Python | 0.999495 | |
c88c7aedcba45b59ea6ecc2efb3a0bf9a1b7efe4 | Add tests for versionmgr in the mint testsuite | mint_test/djangotest/inventorytest/versionmgrtest.py | mint_test/djangotest/inventorytest/versionmgrtest.py | #!/usr/bin/python
import testsuite
import os
import sys
import time
import testsetup
from testutils import mock
from conary import versions
from conary.deps import deps
from mint_test import djangotest
class VersionMgrTest(djangotest.DjangoTest):
def setUp(self):
djangotest.DjangoTest.setUp(self)
... | Python | 0 | |
1d5f23bf090e4a6d51beb310b5ecf4048afcc347 | add debug runner | tools/debug_run_game.py | tools/debug_run_game.py | import logging
import sys
from mpf.core.config_loader import YamlMultifileConfigLoader
from mpf.core.machine import MachineController
machine_path = sys.argv[1]
config_loader = YamlMultifileConfigLoader(machine_path, ["config.yaml"], False, False)
config = config_loader.load_mpf_config()
options = {
'force_plat... | Python | 0.000001 | |
5468beaaf18ea8ac1b955b25bcea0aea1c650af0 | Add test for linear model | thinc/tests/linear/test_linear.py | thinc/tests/linear/test_linear.py | from __future__ import division
import numpy
import pytest
import pickle
import io
from ...linear.linear import LinearModel
from ...neural.optimizers import SGD
from ...neural.ops import NumpyOps
from ...neural.util import to_categorical
@pytest.fixture
def instances():
lengths = numpy.asarray([5,4], dtype='int... | Python | 0.000035 | |
d4a5feaaddb88b79809646b7ddab36d29ebf0830 | Create swig.py | wigs/swig.py | wigs/swig.py | class swig(Wig):
tarball_uri = 'https://github.com/swig/swig/archive/rel-$RELEASE_VERSION$.tar.gz'
last_release_version = 'v3.0.10'
git_uri = 'https://github.com/swig/swig'
| Python | 0.000002 | |
956aff18c4791e0fda10b8e0a1103f3a0d53e4f1 | Add simple performance test suite | tests/perf/perf.py | tests/perf/perf.py | import redact
class Prisoner(redact.BaseModel):
def __init__(self, key, name=None, password=None):
super(Prisoner, self).__init__(key)
self.name = redact.KeyValueField('n', name)
self.password = redact.KeyValueField('p', password)
i = 0
def save_model():
global i
prisoner = Pris... | Python | 0.000001 | |
68c664117612b15dab5add78e7b5614daf1c2c18 | Add missing __init__.py | ivi/agilent/test/__init__.py | ivi/agilent/test/__init__.py | """
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014 Alex Forencich
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 righ... | Python | 0.999965 | |
4f1b7b2a29fcb8802fbdee6ce832d9c5fb4a6f89 | add jobq tests | tests/test_jobq.py | tests/test_jobq.py | """
Test JobQ
"""
from hstestcase import HSTestCase
class ActivityTest(HSTestCase):
def setUp(self):
super(ActivityTest, self).setUp()
self.jobq = self.hsclient.get_jobq(self.projectid)
def test_basic(self):
#authpos(JOBQ_PUSH_URL, data="", expect=400)
spider1 = self.jobq.pus... | Python | 0.000001 | |
ff698bf20eb400f9e6f6cadb3e809fcb684bdcc9 | Add simple main test | tests/test_main.py | tests/test_main.py | from unittest import TestCase
from src.main.main import main
class TestMain(TestCase):
def test_read_commands(self):
s0 = main([])
s1 = main(["one"])
s2 = main(["one", "-2"])
self.assertTrue(0 == 0, "Testing if 0 equals 0.")
self.assertFalse(0 == 1, "Testing if 0 doesn't e... | Python | 0 | |
a22f713ff4a366c0f05ffd6a7e513bc8fda7aa26 | add a maxcall test | tests/test_misc.py | tests/test_misc.py | import numpy as np
import dynesty
"""
Run a series of basic tests of the 2d eggbox
"""
# seed the random number generator
np.random.seed(56432)
nlive = 100
def loglike(x):
return -0.5 * np.sum(x**2)
def prior_transform(x):
return (2 * x - 1) * 10
def test_maxcall():
# hard test of dynamic sampler wi... | Python | 0 | |
0ce616d3c787060c6d1bfeacb0a53c5085494927 | Create tutorial2.py | tutorial2.py | tutorial2.py | placeholder
| Python | 0 | |
287cd795c92a86ee16a623230d0c59732a2f767d | Add demo on how to write unstructured point meshes in Vtk. | examples/vtk-unstructured-points.py | examples/vtk-unstructured-points.py | import numpy as np
from pyvisfile.vtk import (
UnstructuredGrid, DataArray,
AppendedDataXMLGenerator,
VTK_VERTEX, VF_LIST_OF_VECTORS, VF_LIST_OF_COMPONENTS)
n = 5000
points = np.random.randn(n, 3)
data = [
("p", np.random.randn(n)),
("vel", np.random.randn(3, n)),
]
file_name = "points.vt... | Python | 0 | |
8b050af9c5f680c67412271cd5744a2c60b288d5 | Remove test case for linux-32. | conda_smithy/tests/test_configure_feedstock.py | conda_smithy/tests/test_configure_feedstock.py | from contextlib import contextmanager
import os
import shutil
import tempfile
import unittest
import conda_build.metadata
import conda.api
import conda_smithy.configure_feedstock as cnfgr_fdstk
from conda_build_all.resolved_distribution import ResolvedDistribution
@contextmanager
def tmp_directory():
tmp_dir = ... | from contextlib import contextmanager
import os
import shutil
import tempfile
import unittest
import conda_build.metadata
import conda.api
import conda_smithy.configure_feedstock as cnfgr_fdstk
from conda_build_all.resolved_distribution import ResolvedDistribution
@contextmanager
def tmp_directory():
tmp_dir = ... | Python | 0 |
11111351f67afd3dc8ee2ec904a9cea595d68fb3 | Add script to calculate perplexity results | DilipadTopicModelling/experiment_calculate_perplexity.py | DilipadTopicModelling/experiment_calculate_perplexity.py | import pandas as pd
import logging
from CPTCorpus import CPTCorpus
from CPT_Gibbs import GibbsSampler
logger = logging.getLogger(__name__)
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO)
# load corpus
data_dir = '/home/jvdzwaan/data/tmp/generated/test_exp/'
corpus = CPTCorpus.load('{}c... | Python | 0 | |
2ed913c0add7740b9c8eb6ee8320b6924907e48f | Create q5.py | work/q5.py | work/q5.py | import itertools
def max_array():
return [x for x in range(0, 10)]
def compute():
return ['+', '-', '']
def sum(arr):
for i in itertools.product(compute(), repeat=10):
result = ''.join(map(str, union(max_array(), i)))
if result[len(result) - 1] in compute():
result = result[:le... | Python | 0.00005 | |
240274ea82db24dca578692a609a262497107ccc | Prepare for interview questions | decorator_examples.py | decorator_examples.py | def identity_decorator(fn):
def wrapper(*args):
return fn(*args)
return wrapper
@identity_decorator
def stringify(obj):
return str(obj)
print(stringify(78))
def uppercase(fn):
def wrapper(*args):
result = fn(*args)
return result.upper()
return wrapper
@uppercase
def s... | Python | 0.000002 | |
caf8ab5d11d63a3850c5ad4f87e7334422014c88 | Break out HLS fetcher to module | lib/svtplay/hls.py | lib/svtplay/hls.py | import sys
import os
import re
import time
from datetime import timedelta
from svtplay.utils import get_http_data, select_quality
from svtplay.output import progressbar, progress_stream
from svtplay.log import log
if sys.version_info > (3, 0):
from io import BytesIO as StringIO
else:
from StringIO import Stri... | Python | 0 | |
cd85c85b492de74a5dd049e610efeb85e2222326 | Create FoundationPlist.py | FoundationPlist/FoundationPlist.py | FoundationPlist/FoundationPlist.py | #!/usr/bin/python
# encoding: utf-8
#
# Copyright 2009-2014 Greg Neagle.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | Python | 0 | |
71a55a1252ef87629f10e48c1041416c34742ea7 | Add input handling for ssh connections | modules/juliet_input.py | modules/juliet_input.py | from threading import Thread
class Juliet_Input (Thread):
def __init(self):
Thread.__init(self)
def run(self):
while True:
char = raw_input()
if char == 'q':
break
| Python | 0 | |
02887eb26b1c95abf6e26f30228c524d61335e40 | Add download_protected_file view | downloads/views.py | downloads/views.py | from sendfile import sendfile
from django.conf import settings
from django.core.exceptions import PermissionDenied
def download_protected_file(request, model_class, path_prefix, path):
"""
This view allows download of the file at the specified path, if the user
is allowed to. This is checked by calling th... | Python | 0.000001 | |
0115d088061595fe6c6f8589d0599d1b8e970813 | Add dummy Keras inputs builder | scripts/lwtnn-build-dummy-inputs.py | scripts/lwtnn-build-dummy-inputs.py | #!/usr/bin/env python3
"""Generate fake NN files to test the lightweight classes"""
import argparse
import json
import h5py
import numpy as np
def _run():
args = _get_args()
_build_keras_arch("arch.json")
_build_keras_inputs_file("inputs.json")
_build_keras_weights("weights.h5", verbose=args.verbose)... | Python | 0.000001 | |
fdcfd4fbd2f94e646ba3716c20f7518c28e5a0c5 | Add files via upload | python/GenBankParser.py | python/GenBankParser.py | from sys import argv
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC
from Bio.SeqFeature import FeatureLocation, SeqFeature
import random
startCodons = ["ATG", "GTG", "TTG"]
revStartCodons = ["CAT", "CAC", "CAA"]
def randShiftForward(seqLoc, genomeSeq):... | Python | 0 | |
ad1defca2f4d16cc5e13c579c945858b9f77c450 | Rename script | snippets/clean_users_data_frames.py | snippets/clean_users_data_frames.py | import pandas as pd
train_users = pd.read_csv('../datasets/processed/processed_train_users.csv')
test_users = pd.read_csv('../datasets/processed/processed_test_users.csv')
percentage = 0.95
train_mask = train_users.isnull().sum() > train_users.shape[0] * percentage
train_to_remove = list(train_users.isnull().sum()[t... | Python | 0.000001 | |
874323b53790ee2121b82bd57b9941d4562995d0 | Add reddit downvoting script | reddit-downvoter.py | reddit-downvoter.py | #!/usr/bin/env python
import praw
import time
settings = {
'username': 'username',
'password': 'password',
'user_agent': 'angry /r/politics robot',
'subreddit': 'politics',
}
r = praw.Reddit(user_agent=settings['user_agent'])
r.login(settings['username'], settings['password'])
submissions = r.get_s... | Python | 0.000002 | |
d7b7056b483d52e4d94321019f8e520c166511be | Add singleton decorator. | comrade/core/decorators.py | comrade/core/decorators.py | def singleton(cls):
instances = {}
def getinstance():
if cls not in instances:
instances[cls] = cls()
return instances[cls]
return getinstance
| Python | 0 | |
4bcc8ddb7df762155402cb1229f16849c03666c1 | Check DB consistence | DB_consist.py | DB_consist.py | from mysql import mysql
from env_init import create_data_type
import os
def create_user_data_file():
print("check user_data dir and file...")
try:
if not os.path.exists("static/user_data"):
print('create dir "static/user_data"')
os.makedirs('static/user_data')
if not os.... | Python | 0 | |
cb98b4a1580e4976de375722012483bf51ef9254 | Add interactive script to get papers from Mendeley API | scripts/get_mendeley_papers.py | scripts/get_mendeley_papers.py | ###
# Copyright 2015-2020, Institute for Systems Biology
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Python | 0 | |
8ab0a37794cd131d4baef5f6ceecffc568947505 | Create FocusStack.py | FocusStack.py | FocusStack.py | """
Simple Focus Stacker
Author: Charles McGuinness (charles@mcguinness.us)
Copyright: Copyright 2015 Charles McGuinness
License: Apache License 2.0
This code will take a series of images and merge them so that each
pixel is taken from the image with the sharpest focus at that location.
The log... | Python | 0 | |
731bc1308e94cdb341511618ba5739f6fd37b0b7 | Add a base regressions package | regressions/__init__.py | regressions/__init__.py | # regressions
"""A package which implements various forms of regression."""
import numpy as np
try:
import scipy.linalg as linalg
linalg_source = 'scipy'
except ImportError:
import numpy.linalg as linalg
linalg_source = 'numpy'
class ParameterError(Exception):
"""Parameters passed to a regression... | Python | 0 | |
2cdece43768e6bf9613020ae71785f9f158fd72d | Add lc0443_string_compression.py | lc0443_string_compression.py | lc0443_string_compression.py | """Leetcode 443. String Compression
Easy
URL: https://leetcode.com/problems/string-compression/
Given an array of characters, compress it in-place.
The length after compression must always be smaller than or equal to the
original array.
Every element of the array should be a character (not int) of length 1.
After ... | Python | 0.000005 | |
e88ef8f047fc1c6d005f78a40da864a575c1cbe7 | Add tests from `index_brief` | tests/test_brief_utils.py | tests/test_brief_utils.py | import mock
from app.brief_utils import index_brief
from app.models import Brief, Framework
from tests.bases import BaseApplicationTest
@mock.patch('app.brief_utils.index_object', autospec=True)
class TestIndexBriefs(BaseApplicationTest):
def test_live_dos_2_brief_is_indexed(self, index_object, live_dos2_framewor... | Python | 0 | |
b9593297bef14fba20a0eaa4ce384c76447aa3ce | Add tests for deepgetattr | tests/test_deepgetattr.py | tests/test_deepgetattr.py | from lumbda.collection import deepgetattr
class MyClass(object):
def __init__(self, **kwargs):
for key, value in kwargs.iteritems():
setattr(self, key, value)
def test_object_hasattr():
"""
Test that the looked for attribute is found when present
"""
my_object = MyClass(attri... | Python | 0 | |
7abd4c3893e8c1ced664315ee561ae19d3b04191 | Add test_mods_import.py | tests/test_mods_import.py | tests/test_mods_import.py | import pytest
import os
from pathlib import Path
from importlib import import_module
HMMs = []
for root, dir, files in os.walk("."):
if "mods" in root:
for f in files:
if f.endswith(".py"):
filepath = Path(root) / f
lines = "".join(open(filepath).readlines())
... | Python | 0.000003 | |
c6c87e1aafa6b8a4f7929c491398574921417bd4 | Add initial framerate webcam test structure | tests/webcam_framerate.py | tests/webcam_framerate.py | #!/usr/bin/env python
import qrtools, gi, os
gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0')
from gi.repository import Gtk, Gst
from avocado import Test
from utils import webcam
class WebcamReadQR(Test):
"""
Uses the camera selected by v4l2src by default (/dev/video0) to get the
framerat... | Python | 0 | |
764f819d5288abcece33c75934bbaa43bf29e055 | Add merge migration | corehq/apps/users/migrations/0017_merge_20200608_1401.py | corehq/apps/users/migrations/0017_merge_20200608_1401.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-06-08 14:01
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0016_webappspermissions'),
('users', '0016_hqapikey'),
]
operations = [
... | Python | 0.000001 | |
278bfd665c2537587b7743783e1da17772a4b1d9 | Implement q:lines | txircd/modules/core/bans_qline.py | txircd/modules/core/bans_qline.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.modules.xlinebase import XLineBase
from txircd.utils import durationToSeconds, ircLower, now
from zope.interface import implements
from fnmatch import fnm... | Python | 0.999441 | |
0d67251672b6bfd818e6c1f9391f77a35fce9e0e | Create words2vec.py | words2vec.py | words2vec.py | """
V is an object behaving like a function.
V("rabbit") is the 300-element vector for rabbit.
You can also query whether strings are in the word2vec database:
> "rabbit" in V
(V also kind of behaves like a dict -- V[word] returns the word's location
in the big file -- but ignore that.)
nd is the normalized... | Python | 0.999844 | |
b522fed0a1ca2570b8652ddb64b8c847d5964d11 | Add a script to generate all known codes and their decoding | list_all_codes.py | list_all_codes.py | #!/usr/bin/env python
import lsi_decode_loginfo as loginfo
def generate_values(data):
title = data[0]
mask = data[1]
sub = data[2]
for key in sub.keys():
v = sub[key]
key_name = v[0]
key_sub = v[1]
key_detail = v[2]
if key_sub is None:
yield [(title... | Python | 0.000002 | |
a86150c016fd88da9849c8abe58e7a3cf9233521 | Add sleepytime plugin | smartbot/plugins/sleepytime.py | smartbot/plugins/sleepytime.py | from datetime import datetime, timedelta
import smartbot.plugin
class Plugin(smartbot.plugin.Plugin):
"""Check when you should wake up."""
names = ['sleepytime', 'sleepyti.me']
@staticmethod
def calculate_wake_up_times(now=None, time_to_sleep=14,
sleep_cycle_duration... | Python | 0 | |
86ea6884d381f9153d088c634f5353537b967403 | solve 1 problem | solutions/binary-tree-paths.py | solutions/binary-tree-paths.py | #!/usr/bin/env python
# encoding: utf-8
"""
binary-tree-paths.py
Created by Shuailong on 2016-03-04.
https://leetcode.com/problems/binary-tree-paths/.
"""
from collections import deque
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = ... | Python | 0.000027 | |
4f4ea5b8c76f35e70368fef0e932f1630788a64a | read json data from file and parse out the good stuff | parse_info_from_json.py | parse_info_from_json.py | import json
from pprint import pprint
import re
json_data=open('crashlacma.20140524-102001.json')
data = json.load(json_data)
# TODO: handle test cases
# testcases:
# hollywood & vine, hollywood and vine
# order of operations: hashtag, img, address, other text.
# hashtag allcaps or lowercase
# uploaded image, link t... | Python | 0.000001 | |
510adb95228852456e7a8074aee10d6d1dad167a | add metadata class for handling guppy geometry attributes | vector/metadata.py | vector/metadata.py | """ Metadata management """
# Metadata objects should
# - maintain internal consistency
# - be concatenable
# - be iterable
import copy
class GeoMetadata(object):
""" Class for handling collections of metadata """
_dict = {}
_fieldtypes = []
def __init__(self, data):
""" Create a colle... | Python | 0 | |
699f77e490d99c70582d93f517ff9352a5f442ee | Add conf file for KoomBook | ideasbox/conf/koombook_bsfcampus.py | ideasbox/conf/koombook_bsfcampus.py | # -*- coding: utf-8 -*-
"""Django settings for ideasbox project.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
import subprocess
from django.utils.tra... | Python | 0 | |
fb1d3cd2898a37049ac5be11462bdb54727065e6 | Test auditlog auth. | test/test_authorization/test_auditlog_auth.py | test/test_authorization/test_auditlog_auth.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2014 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | Python | 0 | |
093a029ae8607f15b9b446f54293e15f13d44c0e | Create led.py | Python/led.py | Python/led.py | import RPi.GPIO as GPIO
import time
# blinking function
def blink(pin):
GPIO.output(pin,GPIO.HIGH)
time.sleep(1)
GPIO.output(pin,GPIO.LOW)
time.sleep(1)
return
# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
# set up GPIO output channel
GPIO.setup(21, GPIO.OUT... | Python | 0 | |
9509c1006451b14e42df364ba61eb5f412d5ae3a | new package | var/spack/repos/builtin/packages/octopus/package.py | var/spack/repos/builtin/packages/octopus/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0.999675 | |
38452a8a2f95852f8ab7f0910ff875a5b894c2c9 | add shell_builder.py | build/fbcode_builder/shell_builder.py | build/fbcode_builder/shell_builder.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'''
shell_builder.py allows running the fbcode_builder logic
on the host rather than in a container.
It emits a bash script with set -exo pipefail ... | Python | 0.000001 | |
6207b552fecac01477860fbf6087282bbcb2687c | Make parsing work for all fiscal years (2000 to 2012) | localgouv/account_parsing.py | localgouv/account_parsing.py | # -*- coding: utf-8 -*-
from collections import defaultdict
from scrapy.selector import HtmlXPathSelector
from .account_network import city_account
def parse_city_page_account(icom, dep, year, response):
"""Parse html account table of a city for a given year
crawled from http://alize2.finances.gouv.fr.
... | Python | 0.000618 | |
30bc00ce84355cc40e62b1f46d32a17c6b07ac0c | Create GreenHat.py | GreenHat.py | GreenHat.py | # Copyright (c) 2015 Angus H. (4148)
# Distributed under the GNU General Public License v3.0 (GPLv3).
from datetime import date, timedelta
from random import randint
from time import sleep
import sys
import subprocess
import os
# returns a date string for the date that is N days before STARTDATE
def get_date_string(n... | Python | 0.000001 | |
985f23ee5e107c647d5f5e5b245c3fb7ff2d411b | Write script to convert PMF-based result to expected value | bin/to_expected.py | bin/to_expected.py | #!/usr/bin/env python
import argparse
import numpy as np
import pandas as pd
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Convert result from PMF'
' to expected value')
parser.add_argument('file', type=str,
help='Result... | Python | 0.000001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.