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 |
|---|---|---|---|---|---|---|---|
20b31aa5faa155639df8c206de2864af80924254 | add setup.py script | setup.py | setup.py | from distutils.core import setup
setup(
name='attention',
version='0.1.0',
author='tllake',
author_email='thom.l.lake@gmail.com',
packages=['attention'],
description='An attention function for PyTorch.',
long_description=open('README.md').read()) | Python | 0.000001 | |
5df5a19cba3bd543bcadd92d57fdd07d84b38339 | update project page link in setup script | setup.py | setup.py | import os, sys
from distutils.core import setup
setup(
# metadata
name='pycparser',
description='C parser in Python',
long_description="""
pycparser is a complete parser of the C language, written in
pure Python using the PLY parsing library.
It parses C code into a... | import os, sys
from distutils.core import setup
setup(
# metadata
name='pycparser',
description='C parser in Python',
long_description="""
pycparser is a complete parser of the C language, written in
pure Python using the PLY parsing library.
It parses C code into a... | Python | 0 |
229c54fa4122f9c08aae9b31dc6720e78daaf90d | add setup | setup.py | setup.py | #!/user/bin/env python
from setuptools import setup
setup(
name='py-readability',
version='0.0.1',
description='Calculate readability scores. e.g. Gunning Fog',
author='Carmine DiMAscio',
url='https://github.com/cdimascio/py-readability',
packages=['py-readabilitiy-metrics'],
install_requi... | Python | 0 | |
9066250b4ccdd98cd6b7cc644e829c0cfacc0a02 | serpent for CI | setup.py | setup.py |
from setuptools import setup, find_packages
console_scripts = ['eth=pyethereum.eth:main',
'pyethtool=tools.pyethtool_cli:main']
setup(name="pyethereum",
version='0.0.1',
packages=find_packages("."),
install_requires=[
'six', 'leveldb', 'bitcoin', 'pysha3',
'et... |
from setuptools import setup, find_packages
console_scripts = ['eth=pyethereum.eth:main',
'pyethtool=tools.pyethtool_cli:main']
setup(name="pyethereum",
version='0.0.1',
packages=find_packages("."),
install_requires=[
'six', 'leveldb', 'bitcoin', 'pysha3',
'mi... | Python | 0.999999 |
e3cd2d3880dbc00e254ac503d5f5c84ab77edc4f | Add Invoke tasks for cleaning and building docs. | tasks.py | tasks.py | from invoke import task, run
@task
def clean():
run("rm -rf docs/_build")
@task('clean')
def build():
run("sphinx-build docs docs/_build")
| Python | 0 | |
75131bdf806c56970f3160de3e6d476d9ecbc3a7 | Add problem delete note in a linked list | python/deleteNodeInALinkedList.py | python/deleteNodeInALinkedList.py | # https://leetcode.com/problems/delete-node-in-a-linked-list/
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteNode(self, node):
"""
:type node: ListNode
:rtype: v... | Python | 0 | |
1c59296f6819c5d8e6222c237afa9146ddf6a56b | add new status poller | data_collectors/general/csstatus.py | data_collectors/general/csstatus.py | import multiprocessing
from multiprocessing import Process
import logging
import time
import sys
import os
from cloudscheduler.lib.csv2_config import Config
from cloudscheduler.lib.poller_functions import \
start_cycle, \
wait_cycle
import htcondor
import classad
from sqlalchemy import create_engine
from sqla... | Python | 0 | |
1a8c361d90243c44a877ebdc4ae92fbfb3226b40 | add test file for words | day1/words_test.py | day1/words_test.py | import unittest
import words
class TestWordsCode(unittest.TestCase):
def test_has_no_e(self):
self.assertEqual(words.has_no_e("bet"), False)
self.assertEqual(words.has_no_e("bit"), True)
def test_uses_only(self):
self.assertEqual(words.uses_only("ababab", "a"), False)
self.assertEqual(words.uses_... | Python | 0.000001 | |
53d7eebd95644067aabfca4ef48cb1f91af4d16c | Add my code for naive bayes without gaussian | src/NBcode/chinmay_nb/NaiveBayes.py | src/NBcode/chinmay_nb/NaiveBayes.py | #!/usr/bin/python
'''
This program is used to implement the Naive Bayes Algorithm for classification.
To run the program, type the following command:
python NaiveBayes.py <training_file> <test_file>
'''
import sys
import csv
label = "IsBadBuy"
'''This function mentions the correct usage for running the program.
... | Python | 0.000018 | |
6b92d9fe24fe682c357e3f5a5e6c19f1569bd29e | Add riak backend | nydus/db/backends/riak.py | nydus/db/backends/riak.py | """
nydus.db.backends.riak
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from __future__ import absolute_import
import socket
import httplib
from riak import RiakClient, RiakError
from nydus.db.backends import BaseConnection
class Riak(BaseCon... | Python | 0 | |
6b630687336de18bb0c9179b7002d310772b6871 | Add corpwiki/iptool | tools/check_nameserver_popularity.py | tools/check_nameserver_popularity.py | #!/usr/bin/env python
import os
import sys
import pickle
import time
import traceback
import yahoo.search
from yahoo.search.web import WebSearch
APP_ID = 'P5ihFKzV34G69QolFfb3nN7p0rSsYfC9tPGq.IUS.NLWEeJ14SG9Lei0rwFtgwL8cDBrA6Egdw--'
QUERY_MODIFIERS = '-site:txdns.net -site:sitedossier.com -mx -site:dataopedia.com -sit... | #!/usr/bin/env python
import os
import sys
import pickle
import time
import traceback
import yahoo.search
from yahoo.search.web import WebSearch
APP_ID = 'P5ihFKzV34G69QolFfb3nN7p0rSsYfC9tPGq.IUS.NLWEeJ14SG9Lei0rwFtgwL8cDBrA6Egdw--'
QUERY_MODIFIERS = '-site:txdns.net -site:sitedossier.com -mx -site:dataopedia.com -sit... | Python | 0 |
dc15986b0ff890250d21a36350b689809d535f44 | Create KMP.py | KMP.py | KMP.py | # Github username : yatingupta10
# Website : http://www.yatingupta.me/
# Find occurrences of pattern as a contiguous subsequence of the text.
# For the KMP versions the pattern must be a list or string, because we
# perform array indexing into it, but the text can be anything that can
# be used in a for-loop. The nai... | Python | 0 | |
51642c95ce9d7c7d95648952340d90f4ef2254f3 | Add test for record_panel | opal/tests/test_panels.py | opal/tests/test_panels.py | """
Tests create_singletons command
"""
from opal.core.test import OpalTestCase
from opal.templatetags import panels
from opal.tests.models import Demographics
class RecordPanelTestCase(OpalTestCase):
def test_record_panel(self):
expected = dict(
name='demographics',
singleton=Tru... | Python | 0 | |
d9959b9a8e38fc5c6b23618fdbd8a67423302e4e | include forgotten exceptions.py file | ddsc/exceptions.py | ddsc/exceptions.py | class DDSUserException(Exception):
"""
Exception with an error message to be displayed to the user on the command line.
"""
pass
| Python | 0 | |
45215b36e544f8d7a9ac21a825807d6e49d2ade9 | Add binarySearch function | DataStructuresAndAlgorithmsInPython/BinarySearch.py | DataStructuresAndAlgorithmsInPython/BinarySearch.py | ##-*- coding: utf-8 -*-
#!/usr/bin/python
""" Returns either the index of the location in the array,
or -1 if the array did not contain the targetValue
"""
import math
def binarySearch (array, targetValue):
minimum = 0;
maximum = len(array) - 1;
guess = -1;
guessesCount = 0;
while (maxim... | Python | 0.000002 | |
a9690962c579c64f1ab3fea39a0995b12d8f2507 | Add new ESC dataset wrapper | echonet/datasets/esc.py | echonet/datasets/esc.py | # -*- coding: utf-8 -*-
"""Dataset wrappers for the ESC dataset.
Work in progress...
"""
import os
import librosa
import numpy as np
import pandas as pd
import scipy.signal
import skimage as skim
import skimage.measure
from tqdm import tqdm
from echonet.datasets.dataset import Dataset
from echonet.utils.generics ... | Python | 0 | |
b423ea140a8f041bca84390ef698d13789a128df | Convert Numbers to words | number_to_words.py | number_to_words.py | """Convert Numbers to Words.
1001 - One thousand and One
"""
import math
class NumbersToWord(object):
"""Convert Numbers to words."""
hyphen = '-'
conjunction = ' and '
separator = ', '
negative = 'negative '
decimal = ' point '
space = ' '
dictionary = {
0: 'zero',
... | Python | 1 | |
0e43fce67c2c53fe2a7dbf233df86c042501e477 | Move explain_sam_flags.py to public repository | src/scripts/explain_sam_flags.py | src/scripts/explain_sam_flags.py | #!/usr/bin/env python
# The Broad Institute
# SOFTWARE COPYRIGHT NOTICE AGREEMENT
# This software and its documentation are copyright 2008 by the
# Broad Institute/Massachusetts Institute of Technology. All rights are
# reserved.
# This software is supplied without any warranty or guaranteed support
# whatsoever. Neit... | Python | 0.000001 | |
5352740a1cc508a6b902f447a80960fa237414aa | Add ProgressPathView | ui2/view_classes/ProgressPathView.py | ui2/view_classes/ProgressPathView.py | from objc_util import *
import ui
def _get_CGColor(color):
"""Get a CGColor from a wide range of formats."""
return UIColor.colorWithRed_green_blue_alpha_(
*ui.parse_color(color)
).CGColor()
class ProgressPathView(ui.View):
"""A view class which can turn a ui.Path into a progress bar.
... | Python | 0 | |
8738accb2a612a3c1e41cc00aa337d0be890f4a0 | add problem 052 | problem_052.py | problem_052.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
'''
import timeit
def loop(n):
for i in range(10, 10000000):
if str(i)[0] != '1':
continue
f = [1 for j in range(2, n+1) if sorted(list(str(i))) != sorted(str(i*j))]
if len(f) == 0:
return i
if __name__ == '__main__... | Python | 0.001304 | |
88f0e5ba8a404f0fcdaaaacc69109775182b7213 | Add squashed migrations | dj_experiment/migrations/0002_auto_20170802_1206_squashed_0004_auto_20170802_1230.py | dj_experiment/migrations/0002_auto_20170802_1206_squashed_0004_auto_20170802_1230.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-02 17:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
replaces = [('dj_experiment', '0002_auto_20170802_1206'), ('dj_experiment', '0003_auto... | Python | 0.000001 | |
26eba1f16c44ed6693b2a575a6a2c5ebef9401b5 | Create Movie object city_lights | entertainment_center.py | entertainment_center.py | # entertainment_center.py
import media
__author__ = 'vishal lama'
city_lights = media.Movie(
"City Lights",
"A tramp falls in love with a beautiful blind girl. Her family is in "
"financial trouble. The tramp's on-and-off friendship with a wealthy "
"man allows him to be the girl's benefactor and suit... | Python | 0.999489 | |
714537e1cff4009a5e8ba93da94954b84536127a | Add Teli API | api.py | api.py | import requests
class Teli:
TOKEN = ""
API = ""
def __init__(self, TOKEN):
self.TOKEN = TOKEN
self.API = "https://sms.teleapi.net/{}/send"
def send_sms(self, src, dest, message):
args = {
'token': self.TOKEN,
'source': src,
'destination': de... | Python | 0 | |
c4b2f86f5ae49b75dc47c8ced799d647d3bc70e1 | fix transport location | src/collectors/elasticsearch/elasticsearch.py | src/collectors/elasticsearch/elasticsearch.py | # coding=utf-8
"""
Collect the elasticsearch stats for the local node
#### Dependencies
* urlib2
"""
import urllib2
try:
import json
json # workaround for pyflakes issue #13
except ImportError:
import simplejson as json
import diamond.collector
class ElasticSearchCollector(diamond.collector.Colle... | # coding=utf-8
"""
Collect the elasticsearch stats for the local node
#### Dependencies
* urlib2
"""
import urllib2
try:
import json
json # workaround for pyflakes issue #13
except ImportError:
import simplejson as json
import diamond.collector
class ElasticSearchCollector(diamond.collector.Colle... | Python | 0.000006 |
8bdf94c29418a3826e5c6fd3a76f96051326bfe6 | Add management command extract votes #126 | datasets/management/commands/extract_votes.py | datasets/management/commands/extract_votes.py | from django.core.management.base import BaseCommand
import json
from datasets.models import CandidateAnnotation, Vote, TaxonomyNode, Dataset
class Command(BaseCommand):
help = 'Extract user votes' \
'Usage: python manage.py extract_votes <dataset_shor_name> <output_file>'
def add_arguments(self, p... | Python | 0 | |
21e80314c0b1a2b9f3e139520854ce913038dbfb | change docstring format | src/collectors/processmemory/processmemory.py | src/collectors/processmemory/processmemory.py | # coding=utf-8
"""
A Diamond collector that collects memory usage of each process defined in it's
config file by matching them with their executable filepath or the process name.
Example config file ProcessMemoryCollector.conf
```
enabled=True
unit=kB
[process]
[[postgres]]
exe=^\/usr\/lib\/postgresql\/+d.+d\/bin\/p... | # coding=utf-8
"""
A Diamond collector that collects memory usage of each process defined in it's
config file by matching them with their executable filepath or the process name.
Example config file ProcessMemoryCollector.conf
```
enabled=True
unit=kB
[process]
[[postgres]]
exe=^\/usr\/lib\/postgresql\/+d.+d\/bin\/p... | Python | 0.000001 |
399a19aa6b34376f66fd4feae0ef07121fa3a728 | test robustness of job_history when exceptions are thrown. Are preceding jobs always saved to the database? | ruffus/test/test_job_history_with_exceptions.py | ruffus/test/test_job_history_with_exceptions.py | #!/usr/bin/env python
"""
test_job_history_with_exceptions.py
Make sure that when an exception is thrown only the current and following tasks fail
"""
import unittest
import os
import sys
import shutil
from StringIO import StringIO
import time
import re
exe_path = os.path.split(os.path.abspath(sys.arg... | Python | 0 | |
1fe2fea7f7f35c61bb63c641042b9bf12f896fca | add module oslo_policy.common.sql | oslo_policy/common/sql.py | oslo_policy/common/sql.py | # Copyright 2012 OpenStack Foundation
#
# 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... | Python | 0.000001 | |
80935a126beabf05a4c8d54e9306d2b67995c81a | 373. Find K Pairs with Smallest Sums. Brute force | p373_bruteforce.py | p373_bruteforce.py | import unittest
class Solution(object):
def kSmallestPairs(self, nums1, nums2, k):
"""
:type nums1: List[int]
:type nums2: List[int]
:type k: int
:rtype: List[List[int]]
"""
tuples = []
for i in nums1:
for j in nums2:
tupl... | Python | 0.999931 | |
1ede9bd211cd8ea6aac4db6f8818804cb778a022 | Add a view that serves a single static file | dinosaurs/views.py | dinosaurs/views.py | import os
import tornado.web
import tornado.ioloop
class SingleStatic(tornado.web.StaticFileHandler):
def initialize(self, path):
self.dirname, self.filename = os.path.split(path)
super(SingleStatic, self).initialize(self.dirname)
def get(self, path=None, include_body=True):
super(Si... | Python | 0.000001 | |
3f7a03baad15da817e81a8524b87f32c9ca79c1b | Add image service tests | memegen/test/test_services_image.py | memegen/test/test_services_image.py | from unittest.mock import Mock
import pytest
class TestImageService:
def test_find_template(self, image_service):
mock_template = Mock()
image_service.template_store.read.return_value = mock_template
template = image_service.find_template('my_key')
assert image_service.template... | Python | 0.000001 | |
33a439d5b52036bb272c8866017b973bef18237d | Create tests.py | tests.py | tests.py | #...
| Python | 0.000001 | |
234897a36cdf5a5cf5b7550f6d176f4168d7a6c7 | add basic test suite | tests.py | tests.py | import os
import app
import unittest
class TestCase(unittest.TestCase):
def setUp(self):
self.
self.app = app.app.test_client()
def tearDown(self):
pass
def test_index(self):
resp = self.app.get('/')
assert 'Hello World!' in resp.data
if __name__ == '__main__':
... | Python | 0.000001 | |
7e283316050dd4e33f1f0a7182c13eef18c82039 | Create AmbyByeBye.py | home/AdolphSmith/AmbyByeBye.py | home/AdolphSmith/AmbyByeBye.py | arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM9")
mouth = Runtime.create("mouth","Speech")
s8 = Runtime.createAndStart("s8","Servo")
s9 = Runtime.createAndStart("s9","Servo")
s10 = Runtime.createAndStart("s10","Servo")
s11 = Runtime.createAndStart("s11","Servo")
s13 = Runtime.createAndSt... | Python | 0.000008 | |
4d3ed1ff13cde88abe695c724d7c8946578cde21 | Add py-docopt package (#8236) | var/spack/repos/builtin/packages/py-docopt/package.py | var/spack/repos/builtin/packages/py-docopt/package.py | ##############################################################################
# Copyright (c) 2013-2018, 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 | |
889b6254526b5b49cd27d2f7bf7603a60f4f64fe | Add py-geeadd package (#12366) | var/spack/repos/builtin/packages/py-geeadd/package.py | var/spack/repos/builtin/packages/py-geeadd/package.py | # Copyright 2013-2019 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 PyGeeadd(PythonPackage):
"""Google Earth Engine Batch Assets Manager with Addons."""
... | Python | 0 | |
06e7dd815a77739089b2ad0aed5cb9f01a194967 | Add script to normalize image using Ops | Normalize_Image.py | Normalize_Image.py | # @Dataset data
# @OpService ops
# @OUTPUT Img normalized
# Create normalized image to the [0, 1] range.
#
# Stefan Helfrich (University of Konstanz), 03/10/2016
from net.imglib2.type.numeric.real import FloatType
from net.imglib2.type.numeric.integer import ByteType
from net.imagej.ops import Ops
normalized = ops.c... | Python | 0 | |
b628eb4f737b7cb3c3becb17a6545ad400aab1a0 | Simplify the NOPASS test for PUBDEV-2981 | h2o-py/dynamic_tests/testdir_algos/kmeans/pyunit_NOPASS_PUBDEV_2981_kmeans_hanging.py | h2o-py/dynamic_tests/testdir_algos/kmeans/pyunit_NOPASS_PUBDEV_2981_kmeans_hanging.py | from __future__ import print_function
import sys
from builtins import range
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.kmeans import H2OKMeansEstimator
class Test_PUBDEV_2981_kmeans:
"""
PUBDEV-2981: Sometimes algos just hangs and seem to be doing nothing.... | from __future__ import print_function
import sys
from builtins import range
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.kmeans import H2OKMeansEstimator
class Test_PUBDEV_2981_kmeans:
"""
PUBDEV-2981: Sometimes algos just hangs and seem to be doing nothing.... | Python | 0.000095 |
b4fdb95ef8a88cfd2d283698ac005ce8d9ec3468 | Create fetch-wms-urls.py | scripts/fetch-wms-urls.py | scripts/fetch-wms-urls.py | #!/usr/bin/python
import requests
import json
url = "http://129.24.196.43/apps/my_app/search/datasets.json?version=3&model_run_uuid=20f303cd-624d-413d-b485-6113319003d4&model_set=outputs&model_set_type=vis"
r = requests.get(url)
data = json.loads(r.text)
for i in data["results"]:
full = i["services"][0]["wms"]
... | Python | 0.000002 | |
6d4efa0bd1199bbe900a8913b829ca7201dde6ab | Add migration to add new Juniper SASS vars to sites | openedx/core/djangoapps/appsembler/sites/migrations/0003_add_juniper_new_sass_vars.py | openedx/core/djangoapps/appsembler/sites/migrations/0003_add_juniper_new_sass_vars.py | # -*- coding: utf-8 -*-
import json
from django.db import migrations, models
def add_juniper_new_sass_vars(apps, schema_editor):
"""
This migration adds all the new SASS variabled added during the initial
pass of the Tahoe Juniper release upgrade.
"""
new_sass_var_keys = {
"$base-contain... | Python | 0 | |
46351669c279764e1b070943366d7c0ea84a243a | Build pipeline directly in build/action_maketokenizer.py. Review URL: http://codereview.chromium.org/67086 | webkit/build/action_maketokenizer.py | webkit/build/action_maketokenizer.py | #!/usr/bin/python
# Copyright (c) 2009 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.
# usage: action_maketokenizer.py OUTPUTS -- INPUTS
#
# Multiple INPUTS may be listed. The sections are separated by -- arguments.
#
#... | #!/usr/bin/python
# Copyright (c) 2009 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.
# usage: action_maketokenizer.py OUTPUTS -- INPUTS
#
# Multiple INPUTS may be listed. The sections are separated by -- arguments.
#
#... | Python | 0.000001 |
163c214f8d714e3f1dc08324f9d48a34f813d9fe | Add agency creation script. | regscrape/regscrape_lib/commands/create_agencies.py | regscrape/regscrape_lib/commands/create_agencies.py | def run():
from regscrape_lib.util import get_db
from regscrape_lib.search import get_agencies
from pymongo.errors import DuplicateKeyError
db = get_db()
new = 0
print 'Fetching agencies...'
agencies = get_agencies()
print 'Saving agencies...'
stop_words = ['the', 'and', ... | Python | 0 | |
eccd3fd74bf1ce76688fdf3a4471a9a04d4b7de2 | Add Variational autoencoder example | examples/variational_autoencoder.py | examples/variational_autoencoder.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import tensorflow as tf
import polyaxon as plx
from polyaxon.datasets import mnist
def create_experiment_json_fn(output_dir):
"""Creates an auto encoder on MNIST handwritten digits.
inks:
* [MNIST Dataset] http... | Python | 0.000077 | |
392125f2b3fae38b4f4d32877ad2abaa60ea6ffd | Add pony/orm/examples/demo.py | pony/orm/examples/demo.py | pony/orm/examples/demo.py | from decimal import Decimal
from pony.orm import *
db = Database("sqlite", "demo.sqlite", create_db=True)
class Customer(db.Entity):
id = PrimaryKey(int, auto=True)
name = Required(unicode)
email = Required(unicode, unique=True)
orders = Set("Order")
class Order(db.Entity):
id = PrimaryKey(int, a... | Python | 0 | |
d5ed0cf979fa393d45e2f719d3096618e0f723aa | Add utils.py file for util functions | utils.py | utils.py | """Utilities."""
import logging
def configure_logging(to_stderr=True, to_file=True, file_name='main.log'):
"""Configure logging destinations."""
root_logger = logging.getLogger()
root_logger.setLevel(logging.INFO)
format_str = '%(asctime)s - %(levelname)s - %(message)s'
formatter = logging.Formatter(format... | Python | 0.000001 | |
f2b97f029e61bd70b9f4ef5d79c875132907e45e | add missing file. | gunicorn/monkey.py | gunicorn/monkey.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
def patch_django():
""" monkey patch django.
This patch make sure that we use real threads to get the ident which
is going to happen if we are using gevent or eventlet.
"""
... | Python | 0.000001 | |
b0f8c27325c9b4cbc5cd5bc83ece6f3d7569f7da | Add gzip stream | gzipinputstream.py | gzipinputstream.py | import zlib
import string
BLOCK_SIZE = 16384
"""Read block size"""
WINDOW_BUFFER_SIZE = 16 + zlib.MAX_WBITS
"""zlib window buffer size, set to gzip's format"""
class GzipInputStream(object):
"""
Simple class that allow streaming reads from GZip files.
Python 2.x gzip.GZipFile relies on .seek() and .tell... | Python | 0 | |
95e5b80117b090ae0458df18e062bad50b0c0b5a | add module init file | io_exporter_zombye/__init__.py | io_exporter_zombye/__init__.py | # The MIT License (MIT)
#
# Copyright (c) 2015 Georg Schäfer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | Python | 0.000001 | |
19df1ece66f815d0aaaae5e7273117b2da9541ac | Create mpu9250_i2c_modi.py | mpu9250_i2c_modi.py | mpu9250_i2c_modi.py | import smbus
import time,timeit
#import RPi.GPIO as GPIO
# Global varible
i2c = smbus.SMBus(1)
addr = 0x68
c_t0 = time.clock()
t_t0 = time.time()
try:
device_id = i2c.read_byte_data(addr,0x75)
print "Device ID:" + str(hex(device_id))
print "MPU9250 I2C Connected."
except:
print "Connect failed"
i2c.write_byte_... | Python | 0 | |
7acd91331d97a9a4c2190c7d6c8844bd4b7ccfe3 | add cache to diagnostics/__init__.py | dask/diagnostics/__init__.py | dask/diagnostics/__init__.py | from .profile import Profiler
from .progress import ProgressBar
from .cache import Cache
| from .profile import Profiler
from .progress import ProgressBar
| Python | 0.000013 |
e383dc5c52db12aee5327743e26301b4d0f48af9 | Add files via upload | nearest_chat_bot.py | nearest_chat_bot.py |
import gensim
import pandas
import numpy as np
from sklearn.neighbors import NearestNeighbors
import pickle
def get_soap_data(location=None):
if type(location)==type(None):
location="D:\dialogue_agent\dr_word2vec_code\input_data\soaps_all.txt" #Change direcotry
f=open(location,mode="r")
... | Python | 0 | |
63318185d5477fbf99e570e5ccaba303ebe26493 | add testcases | jsmapper/tests/test_mapping.py | jsmapper/tests/test_mapping.py | # -*- coding: utf-8 -*-
from nose.tools import (
eq_,
ok_,
)
from ..mapping import (
Mapping,
MappingProperty,
object_property,
)
from ..schema import JSONSchema
from ..types import (
Integer,
String,
)
def test_object_property():
schema = JSONSchema()
@object_property(name='pro... | Python | 0.000013 | |
190df1378844c6294c6f48ad6cb0272f2146fc48 | Add example of force https | examples/force_https.py | examples/force_https.py | """An example of using a middleware to require HTTPS connections.
requires https://github.com/falconry/falcon-require-https to be installed via
pip install falcon-require-https
"""
import hug
from falcon_require_https import RequireHTTPS
hug.API(__name__).http.add_middleware(RequireHTTPS())
@hug.get()
def my... | Python | 0.000357 | |
c7e8f255d5ad85dc03f5f302f49295d491ac11a1 | Create app.py | app.py | app.py | #!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask impor... | Python | 0.000003 | |
2c2ac7f0b1fa6ebf05c91ba93a3e1a656e52486b | add lexer.py | src/lexer.py | src/lexer.py | # coding: utf-8
'''
Created on 2014年7月23日
@author: lunatic
'''
from decimal import Decimal
class TAG:
OPEN_BRACE = 1 # {
CLOSE_BRACE = 2 # }
OPEN_BRACKET = 3 # [
CLOSE_BRACKET = 4 # ]
KEY = 5 # key ->string
STRING = 6 # string
COLON = 7 # :
NUMBER = 8 # 10 8 18 9.10101
BOOL... | Python | 0.000001 | |
2b74fccbed0a63a503d59ac46fe90d0916abe39c | Add sublime script | bdo.py | bdo.py | import sublime, sublime_plugin, subprocess, threading, time
class Bdo(sublime_plugin.TextCommand):
def run(self, cmd):
sublime.active_window().show_input_panel("bdo ", "update", self.execute, None, None)
def execute(self, cmd):
output = subprocess.Popen(
"echo " + cmd + " | nc -w 10... | Python | 0.000008 | |
876365a7f19a3786db15dc7debbd2686fa5d02ef | Add WmataError class and start of Wmata class. | wmata.py | wmata.py | import datetime
import urllib
import json
class WmataError(Exception):
pass
class Wmata(object):
base_url = 'http://api.wmata.com/%(svc)s.svc/json/%(endpoint)s'
# By default, we'll use the WMATA demonstration key
api_key = 'kfgpmgvfgacx98de9q3xazww'
def __init__(self, api_key=None):
if ... | Python | 0 | |
473516ce881711ee515606a02d3199e195d0c167 | allow reports that extend basictabular to specify whether to run couchdb queries with stale='update_after' | corehq/apps/reports/basic.py | corehq/apps/reports/basic.py | from corehq.apps.reports.datatables import (DataTablesHeader, DataTablesColumn,
DTSortType)
from corehq.apps.reports.generic import GenericTabularReport
from couchdbkit_aggregate import KeyView, AggregateView
from dimagi.utils.couch.database import get_db
__all__ = ['Column', 'BasicTabularReport']
class Column(ob... | from corehq.apps.reports.datatables import (DataTablesHeader, DataTablesColumn,
DTSortType)
from corehq.apps.reports.generic import GenericTabularReport
from couchdbkit_aggregate import KeyView, AggregateView
from dimagi.utils.couch.database import get_db
__all__ = ['Column', 'BasicTabularReport']
class Column(ob... | Python | 0 |
6cf1dbcdf1ffa57136d9476eb43d2b858c4ad6ea | use 'settings' for system libpng. | third_party/libpng/libpng.gyp | third_party/libpng/libpng.gyp | # Copyright (c) 2009 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.
{
'includes': [
'../../build/common.gypi',
],
'variables': {
'use_system_libpng%': 0,
},
'conditions': [
['use_system_libpng==0', {... | # Copyright (c) 2009 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.
{
'includes': [
'../../build/common.gypi',
],
'variables': {
'use_system_libpng%': 0,
},
'conditions': [
['use_system_libpng==0', {... | Python | 0.000029 |
51f02779f306c516bbd6d9cd1550e25c972932cf | Create base.py | base.py | base.py | from django.db import models
from django.core.urlresolvers import reverse
class UrlModelMixin(object):
"""
Provides methods for the URLs of basic actions such as searching,
creating, inspecting (detail), updating, deleting.
If a model instance is identified by pk, ``slug_field_name`` should be le... | Python | 0 | |
43a59b0d883e84005f9b8687ac3aa4ed449f9b78 | Fix Padatious to load intents and entities Doesn't make sense to add intents since no sample lines are provided | mycroft/skills/padatious_service.py | mycroft/skills/padatious_service.py | # Copyright 2017 Mycroft AI 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 writin... | # Copyright 2017 Mycroft AI 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 writin... | Python | 0 |
a4ab01d64c505b786e6fef217829fb56c3d6b6ce | Add management script to generate hansard appearance scores. | mzalendo/scorecards/management/commands/scorecard_update_person_hansard_appearances.py | mzalendo/scorecards/management/commands/scorecard_update_person_hansard_appearances.py | import datetime
from django.core.management.base import NoArgsCommand
from django.core.exceptions import ImproperlyConfigured
class Command(NoArgsCommand):
help = 'Create/update hansard scorecard entry for all mps'
args = ''
def handle_noargs(self, **options):
# Imports are here to avoid an impor... | Python | 0 | |
4a404709081515fa0cc91683b5a9ad8f6a68eae6 | Add a migration to drop mandatory assessment methods from brief data | migrations/versions/630_remove_mandatory_assessment_methods_.py | migrations/versions/630_remove_mandatory_assessment_methods_.py | """Remove mandatory assessment methods from briefs
Revision ID: 630
Revises: 620
Create Date: 2016-06-03 15:26:53.890401
"""
# revision identifiers, used by Alembic.
revision = '630'
down_revision = '620'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from sqlalchemy.dialect... | Python | 0 | |
def036cfb47f1ae9e0efaa5ff238a3b159ab9405 | Create Quotation from Service Order Template | netforce_service/netforce_service/models/service_create_quot.py | netforce_service/netforce_service/models/service_create_quot.py | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | Python | 0 |
d44fc89f27be0e618d02202b5d067466079be16d | add tool to download and extract latest firmware | download-mcuimg.py | download-mcuimg.py | #! /usr/bin/env python3
import urllib.request
from pprint import pprint
import zipfile
import json
print('Downloading release info..')
release_info = json.loads(urllib.request.urlopen('https://api.github.com/repos/wipy/wipy/releases/latest').read().decode('utf-8'))
with open('mcuimg.txt', 'w') as f:
pprint(releas... | Python | 0 | |
373bdc41b35f75a15430eb2f9a03a8ab38d401e8 | Test for upcast with parent unbound method. | tests/basics/subclass_native6.py | tests/basics/subclass_native6.py | # Calling native base class unbound method with subclass instance.
class mylist(list):
pass
l = mylist((1, 2, 3))
assert type(l) is mylist
print(l)
list.append(l, 4)
print(l)
| Python | 0 | |
9d3dd8f1921165bc0c28b94257a2266202b326bb | Return alliance info from key_info and characters | evelink/account.py | evelink/account.py | from evelink import api
from evelink import constants
class Account(object):
"""Wrapper around /account/ of the EVE API.
Note that a valid API key is required.
"""
def __init__(self, api):
self.api = api
@api.auto_call('account/AccountStatus')
def status(self, api_result=None):
... | from evelink import api
from evelink import constants
class Account(object):
"""Wrapper around /account/ of the EVE API.
Note that a valid API key is required.
"""
def __init__(self, api):
self.api = api
@api.auto_call('account/AccountStatus')
def status(self, api_result=None):
... | Python | 0 |
cd69cf46d0d40e3f70c9757c981d8a9b75aab9de | Create run_zaspe.py | run_zaspe.py | run_zaspe.py | import new2
import numpy as np
import pyfits
import time
f = open('zaspe.pars','r')
lines = f.readlines()
for line in lines:
cos = line.split()
if len(cos)==2:
if cos[0] == 'mod':
mod = cos[1]
elif cos[0] == 'spec':
spec = cos[1]
elif cos[0] == 'RV0':
RV0 = float(cos[1])
elif cos[0] == 'vsini':
g... | Python | 0.000002 | |
9ffa7abeccbce24b037a644612681fd397e9d13a | add dict example | trypython/basic/dict_preserved_insert_order_py37.py | trypython/basic/dict_preserved_insert_order_py37.py | """
Python 3.7 で 辞書の挿入順序が保持されることを確認するサンプルです。
REFERENCES:: http://bit.ly/2VIggXP
http://bit.ly/2VySRIe
http://bit.ly/2VFhjI4
http://bit.ly/2VEq058
http://bit.ly/2VBKrzK
"""
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
... | Python | 0 | |
f1b91a52b52dfab3b350191ede23731f0a30f4c4 | Add pythonrc | python/pythonrc.py | python/pythonrc.py | #!/usr/bin/env python
# Inspired by https://github.com/dag/dotfiles/blob/master/python/.pythonrc
import os
import readline
readline.parse_and_bind('tab: complete')
history = os.path.expanduser("~/.pythonhist")
if os.path.exists(history):
try:
readline.read_history_file(history)
except IOError, e:
... | Python | 0.000004 | |
12ad56d1360d6140093f2871c32593751b8ae052 | Add modeset_event.py | py/tests/modeset_event.py | py/tests/modeset_event.py | #!/usr/bin/python3
import pykms
import selectors
import sys
def readdrm(fileobj, mask):
for ev in card.read_events():
ev.data(ev)
def waitevent(sel):
events = sel.select(1)
if not events:
print("Error: timeout receiving event")
else:
for key, mask in events:
key.da... | Python | 0 | |
0178bdb169bdcca0779b3989de7ee932aa4b8cb7 | rename spaceship to the_one | example/the_one.py | example/the_one.py | # -*- coding: utf-8 -*-
import curses
import random
# import sys
from time import sleep
import components
import systems
from engine.engine import Engine
from engine.entity import EntityManager
from engine.fsm import StateMachine
class Image:
def __init__(self, window):
self.window = window
class Ma... | Python | 0.999999 | |
2ab8680c1a5e420de3f6b82db9a994eaeace164f | Add a snippet. | python/unicode/unicode.py | python/unicode/unicode.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Jérémie DECOCK (http://www.jdhp.org)
# DEFINE
str1 = "Hello!"
unicode_obj1 = u"¡Buenos días!"
unicode_obj2 = u"你好!"
# PRINT
print
print str1
print unicode_obj1
print unicode_obj2
# CONCAT
print
print str1 + " " + unicode_obj1 + " " + unicode_obj2,... | Python | 0.000002 | |
f6acf955904765f57ba15837fd6440a524590268 | add migrations | ureport/polls/migrations/0024_auto_20160118_0934.py | ureport/polls/migrations/0024_auto_20160118_0934.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0023_populate_flow_date'),
]
operations = [
migrations.AlterField(
model_name='poll',
name=... | Python | 0.000001 | |
c6dcbd0b7ab3bed35715844a881d8e540470475b | Create video.py | video.py | video.py | #!/usr/bin/env python
'''
Video capture sample.
Sample shows how VideoCapture class can be used to acquire video
frames from a camera of a movie file. Also the sample provides
an example of procedural video generation by an object, mimicking
the VideoCapture interface (see Chess class).
'create_capture' is a convini... | Python | 0.000001 | |
5390abc3f53f18515cd9a658d6286ac8a9b09d81 | Create parrot_trouble.py | Python/CodingBat/parrot_trouble.py | Python/CodingBat/parrot_trouble.py | # http://codingbat.com/prob/p166884
def parrot_trouble(talking, hour):
if talking and (hour < 7 or hour > 20):
return True
else:
return False
| Python | 0.005895 | |
7c4df6bfa4d8d2370c96ffd9efe0017447629a5d | add dep-free baseclass for typing | graphistry/Plottable.py | graphistry/Plottable.py | from typing import Iterable, List, Optional, Union
from typing_extensions import Protocol
import pandas as pd
class Plottable(Protocol):
@property
def _point_title(self) -> Optional[str]:
return None
@property
def _point_label(self) -> Optional[str]:
return None
@property
def ... | Python | 0 | |
14a9296056c4dede324465791052119890f40725 | add a TransactionTestCase to cover the flush command | tests/functionals/test_transactiontestcase.py | tests/functionals/test_transactiontestcase.py | from django.test import TransactionTestCase
from tests.north_app.models import Author
from tests.north_app.models import Book
class BookTestCase(TransactionTestCase):
def setUp(self):
self.author = Author.objects.create(name="George R. R. Martin")
self.book1 = Book.objects.create(
aut... | Python | 0 | |
34fbd9e078591c9837821a14fb3aff2f63bda602 | test create, write, read | tests/gateways/syndicate-create-write-read.py | tests/gateways/syndicate-create-write-read.py | #!/usr/bin/env python
"""
Copyright 2016 The Trustees of Princeton University
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
Unle... | Python | 0.000002 | |
9b345bba13b572ebdd52c6dca534a7cf95e11335 | Add examples | examples/colors.py | examples/colors.py | from PIL import Image, ImageDraw
from time import sleep
OFF_TARGET = True
if OFF_TARGET:
from matrixtoolkit import Adafruit_RGBmatrix
else:
from rgbmatrix import Adafruit_RGBmatrix
class drawer():
"""
handles controls what is being drawn
"""
def __init__(self):
# this config switch ... | Python | 0 | |
6fdf7cc68e05ce6e8e18306eca7d8e36d1a166ea | Add Client class to abstract from different datbase clients | hotline/db/db_client.py | hotline/db/db_client.py | import importlib
import os
class DBClient:
db_defaults = {'mongo': 'mongodb://localhost:27017/',
'redis': 'redis://localhost:6379',
'postgresql': 'postgresql://localhost:5432'
}
def __init__(self, url=None, db_type=None, db_name=None):
self.db_ty... | Python | 0 | |
aac6b16b3c532d74d788cbad942af6a147a06f4b | add broadcast org | migrations/versions/0331_add_broadcast_org.py | migrations/versions/0331_add_broadcast_org.py | """
Revision ID: 0331_add_broadcast_org
Revises: 0330_broadcast_invite_email
Create Date: 2020-09-23 10:11:01.094412
"""
from alembic import op
import sqlalchemy as sa
import os
revision = '0331_add_broadcast_org'
down_revision = '0330_broadcast_invite_email'
environment = os.environ['NOTIFY_ENVIRONMENT']
organisa... | Python | 0 | |
353edcdcfae15f06b998a4ad1481b3ad99e514bd | Remove easeventuid migration. | migrations/versions/127_remove_easeventuid.py | migrations/versions/127_remove_easeventuid.py | """remove easeventuid
Revision ID: 581e91bd7141
Revises: 262436681c4
Create Date: 2015-01-10 00:57:50.944460
"""
# revision identifiers, used by Alembic.
revision = '581e91bd7141'
down_revision = '262436681c4'
from alembic import op
def upgrade():
from inbox.ignition import main_engine
engine = main_engin... | Python | 0 | |
5f7344b8a99880bec7195b951b495970116f0b0d | Initialize P2_blankRowInserter | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P2_blankRowInserter.py | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P2_blankRowInserter.py | # Create a program blankRowInserter.py that takes two integers and a filename
# string as command line arguments. Let’s call the first integer N and the second
# integer M. Starting at row N, the program should insert M blank rows into the
# spreadsheet.
| Python | 0.000064 | |
37f5ddd7e8802b5d5213b5cadb905c39abe92dfc | Add test.. | tests/adapter/mongo/test_case_group_handling.py | tests/adapter/mongo/test_case_group_handling.py | import pytest
import copy
import pymongo
import logging
logger = logging.getLogger(__name__)
def test_init_case_group(adapter, institute_obj):
# given a database and an institute
owner = institute_obj["_id"]
# when attempting to create a case group
result = adapter.init_case_group(owner)
# the ... | Python | 0 | |
28ad4d2770921c7d148b00ed0533b9051fb08122 | enable utils.get to get any url with or without selector/username/password | utils.py | utils.py | #! /usr/bin/env python
import httplib, mimetypes, base64
def encode_multipart_formdata(fields, files):
"""
fields is a sequence of (name, value) elements for regular form fields.
files is a sequence of (name, filename, value) elements for data to be uploaded as files
Return (content_type, body) ready ... | #! /usr/bin/env python
import httplib, mimetypes, base64
def encode_multipart_formdata(fields, files):
"""
fields is a sequence of (name, value) elements for regular form fields.
files is a sequence of (name, filename, value) elements for data to be uploaded as files
Return (content_type, body) ready ... | Python | 0 |
ecbc691307c43ad06d7f539f008fccbff690d538 | Add unit tests for the precomputed_io module | unit_tests/test_precomputed_io.py | unit_tests/test_precomputed_io.py | # Copyright (c) 2018 CEA
# Author: Yann Leprince <yann.leprince@cea.fr>
#
# This software is made available under the MIT licence, see LICENCE.txt.
import numpy as np
import pytest
from neuroglancer_scripts.accessor import get_accessor_for_url
from neuroglancer_scripts.chunk_encoding import InvalidInfoError
from neur... | Python | 0 | |
de4f3d3b31b5336cb541c0e6d17f198799c4dc53 | Remove unnecessary argument | graphitepager/config.py | graphitepager/config.py | import os
import yaml
from alerts import Alert
def contents_of_file(filename):
open_file = open(filename)
contents = open_file.read()
open_file.close()
return contents
def get_config(path):
return Config(path)
class Config(object):
def __init__(self, path):
alert_yml = contents_o... | import os
import yaml
from alerts import Alert
def contents_of_file(filename):
open_file = open(filename)
contents = open_file.read()
open_file.close()
return contents
def get_config(path):
return Config(path)
class Config(object):
def __init__(self, path):
alert_yml = contents_o... | Python | 0.043649 |
3ce64bd781b59fffe42a59155a6f81f641647653 | add package information | source/src/info.py | source/src/info.py | # -*- coding: utf-8 -*-
"""
Base module variables
"""
__version__ = '0.2.00'
__author__ = 'Joke Durnez'
__license__ = 'MIT'
__email__ = 'joke.durnez@gmail.com'
__status__ = 'Prototype'
__url__ = 'https://www.neuropowertools.org'
__packagename__ = 'neurodesign'
| Python | 0 | |
117ddac033b0b337ced9589851e74056740cdb3e | patch to create workflow for existing leave applications | erpnext/patches/v10_0/workflow_leave_application.py | erpnext/patches/v10_0/workflow_leave_application.py | # Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("hr", "doctype", "leave_application")
frappe.reload_doc("workflow", "doctype", "workflow")
doc = frappe.get_doc({
'doctyp... | Python | 0 | |
22e9c273deb092568fe2e90583ebe7ff459f72a6 | Add rough utility for microbenchmark runs | util/bench_microbenchmarks.py | util/bench_microbenchmarks.py | #!/usr/bin/env python2
import os
import sys
import time
import json
import subprocess
TIME_MULTI='./util/time_multi.py'
COUNT=5
SLEEP=0.5
SLEEP_FACTOR=2.5
RERUN_LIMIT=20
KILL_TIMEOUT=600
KILL_WAIT=20
TMP_BENCH_ONE='/tmp/bench-one.json'
BENCH_OUT='/tmp/bench.json'
#COUNT=1
#SLEEP=0.0
#SLEEP_FACTOR=0.0
# - Duktape is... | Python | 0 | |
3aaa64c7ca9721e74fd52d3274a91fdd4c4cb678 | add initial test cron | cron.py | cron.py | import boto3
import credstash
import gspread
import json
from oauth2client.service_account import ServiceAccountCredentials
from oauth2client import file, client, tools
from models.v1.assets.asset import Asset
from models.v1.asset_groups.asset_group import AssetGroup
from models.v1.services.service import Service
def ... | Python | 0 | |
49b3c91ffdbd04fbce523599320820278bb5d8aa | Add data file. | data.py | data.py | # Ignore this file
{'paper_abstract': 'An abstract',
'authors': [{'first_names': 'XX',
'surname': 'XXX',
'address': 'XXX',
'country': 'XXX',
'email_address': 'xxx@XXX',
'institution': 'XXX'}],
'title': ''}
| Python | 0.000001 | |
885ed1e8e3256352d2fde771bef57997809c3c1e | Remove monthly_billing table from the database | migrations/versions/0209_remove_monthly_billing_.py | migrations/versions/0209_remove_monthly_billing_.py | """
Revision ID: 0209_remove_monthly_billing
Revises: 84c3b6eb16b3
Create Date: 2018-07-27 14:46:30.109811
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0209_remove_monthly_billing'
down_revision = '84c3b6eb16b3'
def upgrade():
# ### commands auto gen... | Python | 0.000002 | |
324f670e747af0b949bc2c9fb503c875b7f20a7b | Initialize 06.sameName3 | books/AutomateTheBoringStuffWithPython/Chapter03/06.sameName3.py | books/AutomateTheBoringStuffWithPython/Chapter03/06.sameName3.py | # This program demonstrates global and local variable rules
def spam():
global eggs
eggs = 'spam' # this is the global (global statement)
def bacon():
eggs = 'bacon' # this is a local (assignment)
def ham():
print(eggs) # this is the global (no assignment)
eggs = 42 # this is the global (outsi... | Python | 0.999999 | |
6987558cefb1179c4501ee5f43e39618f67c49c7 | Initialize P02_writeCSV | books/AutomateTheBoringStuffWithPython/Chapter14/P02_writeCSV.py | books/AutomateTheBoringStuffWithPython/Chapter14/P02_writeCSV.py | # This program uses the csv module to manipulate .csv files
import csv
# Writer Objects
outputFile = open("output.csv", "w", newline='')
outputWriter = csv.writer(outputFile)
print(outputWriter.writerow(['spam', 'eggs', 'bacon', 'ham']))
print(outputWriter.writerow(['Hello, world!', 'eggs', 'bacon', 'ham']))
print(ou... | Python | 0.000004 | |
b6aacfff8a400f4cc671790a827a778bbbc74635 | Update customer alerts to avoid is_available_to_buy | oscar/apps/customer/alerts/utils.py | oscar/apps/customer/alerts/utils.py | import logging
from django.core import mail
from django.conf import settings
from django.template import loader, Context
from django.contrib.sites.models import Site
from django.db.models import get_model, Max
from oscar.apps.customer.notifications import services
from oscar.core.loading import get_class
ProductAler... | import logging
from django.core import mail
from django.conf import settings
from django.template import loader, Context
from django.contrib.sites.models import Site
from django.db.models import get_model, Max
from oscar.apps.customer.notifications import services
ProductAlert = get_model('customer', 'ProductAlert')... | Python | 0.000004 |
b8ddb1b64ef2216add5b0b136b09b72d91506767 | Add initial msgpack renderer | salt/renderers/msgpack.py | salt/renderers/msgpack.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
# Import third party libs
import msgpack
def render(msgpack_data, saltenv='base', sls='', **kws):
'''
Accepts JSON as a string or as a file object and runs it through the JSON
parser.
:rtype: A Python data structure
'''
if not is... | Python | 0 | |
e665e9cb374fd67baec7ec598bfd352e04192210 | add gripper class to pick up pieces with electromagnet | raspberryturk/embedded/motion/gripper.py | raspberryturk/embedded/motion/gripper.py | import RPi.GPIO as GPIO
from time import sleep
electromagnet_pin = 40
servo_pin = 38
class Gripper(object):
def __init__(self):
self.previous_z = None
GPIO.setmode(GPIO.BOARD)
GPIO.setup(servo_pin, GPIO.OUT)
GPIO.setup(electromagnet_pin, GPIO.OUT)
def calibrate(self):
... | Python | 0 | |
b790a10de84d0ffb40e9834c7393a8d905d1aab5 | Add missing migration | apps/challenge/migrations/0052_auto_20190225_1631.py | apps/challenge/migrations/0052_auto_20190225_1631.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-02-25 15:31
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('challenge', '0051_auto_20... | Python | 0.0002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.