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 |
|---|---|---|---|---|---|---|---|
13486556a15cdb2dbfe3f390f973942d93338995 | Create TryRecord.py | TryRecord.py | TryRecord.py | """
Example usage of Record class
The MIT License (MIT)
Copyright (c) <2016> <Larry McCaig (aka: Larz60+ aka: Larz60p)>
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, inclu... | Python | 0.000001 | |
8d94bbc272b0b39ea3a561671faf696a4851c1a1 | Create app.py | reddit2telegram/channels/MoreTankieChapo/app.py | reddit2telegram/channels/MoreTankieChapo/app.py | #encoding:utf-8
subreddit = 'MoreTankieChapo'
t_channel = '@MoreTankieChapo'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Python | 0.000003 | |
e5ae14b4438fc7ae15156615206453097b8f759b | add wave test | Python/WaveTest.py | Python/WaveTest.py | import requests
def text2code(text):
'''
convert a string to wave code
'''
ret = None
get_wave_params = {'type' : 'text', 'content' : text}
response = requests.post('http://rest.sinaapp.com/api/post', data=get_wave_params)
if response.status_code == 200:
try:
data = resp... | Python | 0.000007 | |
f6a725b5915575f61fcb7c34ac7b464cd304e7b5 | test mode shows user | dj/scripts/tweet.py | dj/scripts/tweet.py | #!/usr/bin/python
# tweets #client.slug, #video, title and blipurl
# shortens the URL and title if needed
# if over 140 char, url is shortened using bity,
# if still over, title is truncated.
import twitter
import urllib2
import urllib
import time
import pw # see pw_samp.py for sample.
from process import proces... | #!/usr/bin/python
# tweets #client.slug, #video, title and blipurl
# shortens the URL and title if needed
# if over 140 char, url is shortened using bity,
# if still over, title is truncated.
import twitter
import urllib2
import urllib
import time
import pw # see pw_samp.py for sample.
from process import proces... | Python | 0.000001 |
561f595337106c60c55212dd87d90ed3002de07f | disable pretty json (reduces size by 30%) | runserver.py | runserver.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
from threading import Thread
from pogom import config
from pogom.app import Pogom
from pogom.search import search_loop, set_cover, set_location
from pogom.utils import get_args, insert_mock_data
from pogom.models import create_tables, SearchConfig
from pogom.p... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
from threading import Thread
from pogom import config
from pogom.app import Pogom
from pogom.search import search_loop, set_cover, set_location
from pogom.utils import get_args, insert_mock_data
from pogom.models import create_tables, SearchConfig
from pogom.p... | Python | 0 |
fb1498abaca07e3594d2f24edc1596fb03225dea | Add new package: dnsmasq (#16253) | var/spack/repos/builtin/packages/dnsmasq/package.py | var/spack/repos/builtin/packages/dnsmasq/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Dnsmasq(MakefilePackage):
"""A lightweight, caching DNS proxy with integrated DHCP server.... | Python | 0 | |
7b71bbd87234c8cbe8c7fa189c0617b4ca191989 | Add tweak_billing_log command | silver/management/commands/tweak_billing_log.py | silver/management/commands/tweak_billing_log.py | import datetime as dt
from datetime import datetime
from optparse import make_option
from django.core.management.base import BaseCommand
from django.utils import timezone
from silver.models import Subscription, BillingLog
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option(... | Python | 0.000004 | |
1b023e8471dad22bfb6b8de0d30c0796c30e2a40 | Copy hello.py from add_snippet branch | hello.py | hello.py | import cygroonga as grn
import datetime
with grn.Groonga():
with grn.Context() as ctx:
db = ctx.open_or_create_database("test.db")
table1 = ctx.open_or_create_table("table1",
grn.OBJ_TABLE_HASH_KEY | grn.OBJ_PERSISTENT,
ctx.at(grn.DB_SHORT_TEXT))
print("table... | Python | 0 | |
53b6b1f4b7f58b1a7d748f67e220bd4da147df0e | Create hello.py | hello.py | hello.py | def main():
print("Hello!")
| Python | 0.999503 | |
708fe9f6765717e1f1dabce1f9ac9ed56a7cc769 | Add a new pacakage: HiC-Pro. (#7858) | var/spack/repos/builtin/packages/hic-pro/package.py | var/spack/repos/builtin/packages/hic-pro/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 | |
033032260a43a416857b7057bd4fc212422abc51 | Add a simple command line skew-T plotter | notebooks/Command_Line_Tools/skewt.py | notebooks/Command_Line_Tools/skewt.py | # skewt.py - A simple Skew-T plotting tool
import argparse
from datetime import datetime
import matplotlib.pyplot as plt
import metpy.calc as mpcalc
from metpy.io.upperair import get_upper_air_data
from metpy.plots import Hodograph, SkewT
from metpy.units import units
from mpl_toolkits.axes_grid1.inset_locator import... | Python | 0.000007 | |
724e86e31b6584012af5afe458e0823b9a2ca7ab | Create a class named "CreateSpark", which is to solove the problem of "Cannot run multiple SparkContexts at once; existing SparkContext(app=spam-msg-classifier, master=local[8]) created by __init__" | myclass/class_create_spark.py | myclass/class_create_spark.py | # -*- coding: utf-8 -*-
# !/usr/bin/python
################################### PART0 DESCRIPTION #################################
# Filename: class_save_word_to_database.py
# Description:
#
# Author: Shuai Yuan
# E-mail: ysh329@sina.com
# Create: 2015-11-17 20:43:09
# Last:
__author__ = 'yuens'
####################... | Python | 0 | |
2bd453c4a7402f24cd43b49e73d0b95e371e6654 | add package Feature/sentieon (#9557) | var/spack/repos/builtin/packages/sentieon-genomics/package.py | var/spack/repos/builtin/packages/sentieon-genomics/package.py | # Copyright 2013-2018 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)
import os.path
from spack import *
class SentieonGenomics(Package):
"""Sentieon provides complete solutions for seco... | Python | 0 | |
8c1cd72d11836ad913af5c3614137358ddf3efee | add mgmt cmd to set related user | sources/management/commands/set_related_user.py | sources/management/commands/set_related_user.py | from django.core.management.base import BaseCommand, CommandError
from django.core.mail import send_mail
from django.contrib.auth.models import User
# from sources.models import Person
import random
def set_related_user(email_address, person_id):
obj = Person.objects.get(id=person_id)
try:
user_existi... | Python | 0 | |
208077afd9b1ba741df6bccafdd5f008e7b75e38 | Add nftables test | meta-iotqa/lib/oeqa/runtime/sanity/nftables.py | meta-iotqa/lib/oeqa/runtime/sanity/nftables.py | import os
import subprocess
from time import sleep
from oeqa.oetest import oeRuntimeTest
class NftablesTest(oeRuntimeTest):
def check_ssh_connection(self):
'''Check SSH connection to DUT port 2222'''
process = subprocess.Popen(("ssh -o UserKnownHostsFile=/dev/null " \
... | Python | 0 | |
3be145af359df5bcf928da1b984af8635ea33c27 | add model for parcels, temp until i figure out psql migrations in flask | farmsList/farmsList/public/models.py | farmsList/farmsList/public/models.py | # -*- coding: utf-8 -*-
from farmsList.database import (
Column,
db,
Model,
ReferenceCol,
relationship,
SurrogatePK,
)
class Parcel(SurrogatePK, Model):
__tablename__ = 'parcels'
name = Column(db.String(80), unique=True, nullable=False)
def __init__(self, name, **kwargs):
... | Python | 0 | |
8a3425209090cb9acc6353ab6fccc0ec31cae804 | permutations II | backtracking/47.py | backtracking/47.py | class Solution:
def permuteUnique(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
ret = []
nums.sort()
used = [0]*len(nums)
self.dfs(ret, [], nums, used)
return ret
def dfs(self, ret, temp, nums, used):
if le... | Python | 0.999946 | |
a5d63ec0f8f192aaeae8b9a7f1cf423d18de25dc | Add test runner to handle issue with import path | server/test.py | server/test.py | import pytest
pytest.main('-x tests/')
| Python | 0 | |
8632b60718fa353797ffc53281e57a37caf9452f | Add config command for setting the address of rf sensors. | set_address.py | set_address.py | import zmq
import time
import sys
print sys.argv[1:]
# ZeroMQ Context
context = zmq.Context()
sock_live = context.socket(zmq.PUB)
sock_live.connect("tcp://"+sys.argv[1])
time.sleep(1)
# Send multipart only allows send byte arrays, so we convert everything to strings before sending
# [TODO] add .encode('UTF-8') when ... | Python | 0 | |
f5f6bc0999d5b6f065adb81982ce3a322e1ab987 | add regression test for fit_spectrum() Python 3.x issue | nmrglue/analysis/tests/test_analysis_linesh.py | nmrglue/analysis/tests/test_analysis_linesh.py | import numpy as np
import nmrglue as ng
from nmrglue.analysis.linesh import fit_spectrum
def test_fit_spectrum():
_bb = np.random.uniform(0, 77, size=65536)
lineshapes = ['g']
params = [[(13797.0, 2.2495075273313034)],
[(38979.0, 5.8705185693227664)],
[(39066.0, 5.71259542961... | Python | 0 | |
c5a2167a63516c23390263408fcd2c9a4f654fc8 | Add tests for the parse method of the spider | webcomix/tests/test_comic_spider.py | webcomix/tests/test_comic_spider.py | from webcomix.comic_spider import ComicSpider
def test_parse_yields_good_page(mocker):
mock_response = mocker.patch('scrapy.http.Response')
mock_response.urljoin.return_value = "http://xkcd.com/3/"
mock_response.url = "http://xkcd.com/2/"
mock_selector = mocker.patch('scrapy.selector.SelectorList')
... | Python | 0 | |
fd5da951feee92c055853c63b698b44397ead6be | Add save function for use across the application | app/db_instance.py | app/db_instance.py | from app import db
def save(data):
try:
print(data)
db.session.add(data)
db.session.commit()
except Exception as e:
raise e
| Python | 0 | |
585fec12673ab0207f5b641a9ba0df4a510667ac | Add harvester for mblwhoilibrary | scrapi/harvesters/mblwhoilibrary.py | scrapi/harvesters/mblwhoilibrary.py | '''
Harvester for the WHOAS at MBLWHOI Library for the SHARE project
Example API call: http://darchive.mblwhoilibrary.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import helpers
from scrapi.base import OAIHarvester
class MblwhoilibraryHarvester(... | Python | 0.000001 | |
f5cc9c86b1cfbb2cda1b4c1c4c8656a6ca7a2a7f | Create graphingWIP.py | src/graphingWIP.py | src/graphingWIP.py | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import matplotlib.dates as md
import dateutil
# create empty dynamic arrays
temp_x = []
x = []
y = []
f = open("temp.log", "r") # open log folder
for line in f: # load x and y values
temp_line = line.split('=')
temp_x.append(temp_line[0][:-1]) # trim spaces
... | Python | 0 | |
534fcff9f812df4cef273ca7853df12647b25d06 | Add preliminary metrics file and import some from sklearn | metrics.py | metrics.py | from sklern.metrics import roc_curve as roc, roc_auc_score as auc
def enrichment_factor():
pass
def log_auc():
pass
| Python | 0 | |
3c45de2506d6fd86ad96ee9f2e1b5b773aad82d9 | split out common functionality | fabfile/common.py | fabfile/common.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Common pieces that work on all Nix OS'
.. module:: common
:platform: Linux, MacOS
.. moduleauthor:: John P. Neumann
.. note::
None
"""
# Built In
import os
import sys
# Third Party
from fabric.api import local, cd, task, execute
# Custom
@task
def setup_de... | Python | 0.999847 | |
40e9825ee0a2ccf7c3e92d4fd6599c1976a240a3 | Add deprecated public `graphql` module | fbchat/graphql.py | fbchat/graphql.py | # -*- coding: UTF-8 -*-
"""This file is here to maintain backwards compatability."""
from __future__ import unicode_literals
from .models import *
from .utils import *
from ._graphql import (
FLAGS,
WHITESPACE,
ConcatJSONDecoder,
graphql_color_to_enum,
get_customization_info,
graphql_to_sticker... | Python | 0.000001 | |
f98aa5f336cd81ad55bc46122821df3ad314a4cb | Add py-dockerpy-creds (#19198) | var/spack/repos/builtin/packages/py-dockerpy-creds/package.py | var/spack/repos/builtin/packages/py-dockerpy-creds/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyDockerpyCreds(PythonPackage):
"""Python bindings for the docker credentials store API ""... | Python | 0 | |
07a1612250a9c3b2de1ffe53fb916a8cff153c3f | add count of collisions | findCollisions.py | findCollisions.py | from collections import Counter
def countCollisions(entries):
collisions = [k for k,v in Counter(entries).items() if v>1]
num_collisions = len(collisions)
print(num_collisions,'word collisions:\n',collisions)
return num_collisions
def countCollisionsInFile(filename):
entries = []
with open(fil... | Python | 0.000017 | |
4a0fa1028f22944f30e39c65806f0d123e18420f | Create input.py | input.py | input.py | ckey=""
csecret=""
atoken=""
asecret=""
query='' #Add keyword for which you want to start the miner
| Python | 0 | |
98499f07c6dcccba3605e9ab9c8eaef9463b0634 | Add some validators | indra/tools/stmt_validator.py | indra/tools/stmt_validator.py | class StatementValidator:
def __init__(self):
class DbRefsEntryValidator:
@staticmethod
def validate(entry):
raise NotImplementedError()
class ChebiPrefix(DbRefsEntryValidator):
@staticmethod
def validate(entry):
return not entry or entry.startswith('CHEBI')
class UniProtIDNot... | Python | 0.000002 | |
ba1f04337d0653d4808427b5d07ed8673526b315 | add mygpo.wsgi | mygpo.wsgi | mygpo.wsgi | #!/usr/bin/python
# -*- coding: utf-8 -*-
# my.gpodder.org FastCGI handler for lighttpd (default setup)
#
# This file is part of my.gpodder.org.
#
# my.gpodder.org 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 Fo... | Python | 0.000135 | |
1086259090a396b2a2ed40788d1cb8c8ff7c95f3 | fix the fixme | src/robotide/plugins/connector.py | src/robotide/plugins/connector.py | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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 applicab... | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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 applicab... | Python | 0.000023 |
f89fd041b7f263ac944df4a65fb4bbd21d5b2998 | Modify test case name and add methods for improving code coverage | tests/python-test-library/testcases/contextGetPropertiesTCs.py | tests/python-test-library/testcases/contextGetPropertiesTCs.py | #!/usr/bin/env python2.5
##
## @file contextOrientationTCs.py
##
## Copyright (C) 2008 Nokia. All rights reserved.
##
##
##
##
## Requires python2.5-gobject and python2.5-dbus
##
## Implements also some testing API:
##
##
import os
import sys
from time import sleep
import unittest
import traceback
import dbus
impor... | Python | 0 | |
0d22f1ab7f4c83af280edb799f863fa0f46ea326 | Create generic views for index/login | app/views.py | app/views.py | from flask import render_template, flash, redirect
from app import app
from .forms.login import LoginForm
@app.route('/')
@app.route('/index')
def index():
user = {'nickname': 'Mark'} # fake user
return render_template("index.html",
title='Home',
user=use... | Python | 0 | |
45939892a21bbf11ddcd1400d26cf2e94fa8ebac | add nox tests. | noxfile.py | noxfile.py | import nox
PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
PACKAGE = "abilian"
@nox.session(python="python3.6")
def lint(session):
# session.env["LC_ALL"] = "en_US.UTF-8"
session.install("poetry", "psycopg2-binary")
session.run("poetry", "install", "-q")
session.run("yarn", external="True")
session.run("... | Python | 0 | |
5addf2c2992cfdedf06da58861dae93347e02fb9 | Support for nox test runner (alternative to tox), provides a workaround for #80. | noxfile.py | noxfile.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2020 -- Lars Heuer
# All rights reserved.
#
# License: BSD License
#
"""\
Nox test runner configuration.
"""
import os
from functools import partial
import shutil
import nox
@nox.session(python="3")
def docs(session):
"""\
Build the documentation.
"""
s... | Python | 0 | |
510b90d42dbccd0aa1e3ff48ee8dbe7230b65185 | Add script to compute some stats about data from energy consumption measures | get_stats_from.py | get_stats_from.py | import argparse
import csv
from glob import glob
import re
import statistics
import sys
def get_stats_from(files_names, files_content):
for i in range(len(files_content)):
file_name = files_names[i]
file_content = files_content[i]
print("FILE : {0}".format(files_names[i]))
print("\t... | Python | 0.000001 | |
32dcc681a82ef2246d0fad441481d6e68f79ddd6 | Add Python benchmark | lib/node_modules/@stdlib/math/base/special/ln/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/ln/benchmark/python/benchmark.py | #!/usr/bin/env python
"""Benchmark ln."""
from __future__ import print_function
import timeit
NAME = "ln"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
... | Python | 0.000138 | |
20b450c4cd0ff9c57d894fa263056ff4cd2dbf07 | Add a vim version of merge business hours | vim_turing_machine/machines/merge_business_hours/vim_merge_business_hours.py | vim_turing_machine/machines/merge_business_hours/vim_merge_business_hours.py | from vim_turing_machine.machines.merge_business_hours.merge_business_hours import merge_business_hours_transitions
from vim_turing_machine.vim_machine import VimTuringMachine
if __name__ == '__main__':
merge_business_hours = VimTuringMachine(merge_business_hours_transitions(), debug=True)
merge_business_hours... | Python | 0.000001 | |
9ac5bfb17346f364414f17e3e16ba15ab812f5a0 | tidy up | src/lino/tools/mail.py | src/lino/tools/mail.py | ## Copyright Luc Saffre 2003-2004.
## This file is part of the Lino project.
## Lino is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later... | Python | 0.000001 | |
137a7c6e98e0ba8bd916d4ba696b0f0f4e2cdc56 | Create uptime.py | plot-uptime/uptime.py | plot-uptime/uptime.py | Python | 0.000024 | ||
e90c48ba46d7971386e01b3def9edbb2df5d74e8 | Create mummy.py | management/commands/mummy.py | management/commands/mummy.py | """
1. Install model-mommy
`pip install model-mommy`
2. Use the command
`./manage mummy someotherapp.HilariousModelName:9000 yetanotherapp.OmgTheseModelNamesLawl:1`
"""
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from model_mommy import mommy
class ... | Python | 0.0034 | |
3b7de4dbe3611863620cb528092779d25efde025 | remove dj 3.2 warnings | data_exports/apps.py | data_exports/apps.py | #!/usr/bin/env python
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class CsvExportConfig(AppConfig):
name = 'data_exports'
default_auto_field = "django.db.models.AutoField"
| Python | 0.000002 | |
85c732e395e3db4ec63a0d8580d895363d82e4a0 | Add the salt.output module | salt/output.py | salt/output.py | """
A simple way of setting the output format for data from modules
"""
import pprint
# Conditionally import the json and yaml modules
try:
import json
JSON = True
except ImportError:
JSON = False
try:
import yaml
YAML = True
except ImportError:
YAML = False
__all__ = ('get_outputter',)
class... | Python | 0.000142 | |
380acd0e40ad2924f1434d4ae7f7e0a8a163139f | add script for building the cluster catalog | bin/build-cluster-catalog.py | bin/build-cluster-catalog.py | #!/usr/bin/env python
"""Build and write out the NGC-star-clusters.fits catalog.
"""
import os
import numpy as np
import numpy.ma as ma
from astropy.io import ascii
from astropy.table import Table
from astrometry.util.starutil_numpy import hmsstring2ra, dmsstring2dec
from astrometry.libkd.spherematch import match_rad... | Python | 0 | |
9b0c335fc956c2d2156d169e3636d862ebfbadc0 | add a scraping script | hadairopink.py | hadairopink.py | #!/usr/bin/env python
"""
No description.
"""
import sys
from scrapy import cmdline, Request
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
TARGET_DOMAIN = 'hadairopink.com'
XPATH_IMAGE_SRC = '//div[@class="kizi"]//a/img[contains(@src, "/wp-content/uploads/")]/@src'
XPA... | Python | 0.000001 | |
285cddc3ed75f70e077738a206c50a57671245ea | add hello world script by pyThon | hello_flask.py | hello_flask.py | # -*- coding: utf-8 -*-
from flask import Flask
app = flask(__name__)
@app.route('/')
def hello_flask():
return 'Hello Flask!'
if __name__ == '__main__':
app.run() | Python | 0.000003 | |
7478a6605b4d722e2eec9031457fb33ee99857f5 | add geo tools from dingo | edisgo/tools/geo.py | edisgo/tools/geo.py | from geopy.distance import vincenty
import os
if not 'READTHEDOCS' in os.environ:
from shapely.geometry import LineString
from shapely.ops import transform
import logging
logger = logging.getLogger('edisgo')
def calc_geo_branches_in_polygon(mv_grid, polygon, mode, proj):
# TODO: DOCSTRING
branches ... | Python | 0 | |
49c98929190be5c759f200ec8816f6ab334d0e4b | Create inception5h.py | inception5h.py | inception5h.py | # -*- coding: utf-8 -*-
########################################################################
#
# The Inception Model 5h for TensorFlow.
#
# This variant of the Inception model is easier to use for DeepDream
# and other imaging techniques. This is because it allows the input
# image to be any size, and the optimiz... | Python | 0.000001 | |
27ea547fbd7c936bd017b64b31ecf09ed991c6c0 | Add index to fixed_ips.address | nova/db/sqlalchemy/migrate_repo/versions/085_add_index_to_fixed_ips_by_address.py | nova/db/sqlalchemy/migrate_repo/versions/085_add_index_to_fixed_ips_by_address.py | # Copyright 2012 IBM
#
# 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 w... | Python | 0.000001 | |
65258cf8d11e8e5c7cce3e07d9a389e5617948dd | Add boilerplate code | aoc.py | aoc.py | import argparse
import importlib
import sys
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Advent of Code 2016")
parser.add_argument("--day", type=int, dest="days", nargs="+", default=range(1, 25))
parser.add_argument("--stdin", dest='stdin', action='store_true', default=False)
... | Python | 0.001915 | |
6db7902e5f78d28b9a00eb801c12d15c91949453 | Add gruneisen script for making figure | phonondb/phonopy/gruneisen.py | phonondb/phonopy/gruneisen.py | import numpy as np
from cogue.crystal.utility import klength2mesh
class ModeGruneisen:
def __init__(self,
phonon_orig,
phonon_plus,
phonon_minus,
distance=100):
self._phonopy_gruneisen = phonopy_gruneisen
self._phonon = phonon
... | Python | 0 | |
813eb3b6bdc01906e39f11f93b4a326fc2fb1ee5 | Add kitchen-sink base test | test/base.py | test/base.py | import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import os
import uuid
import torch2c
def base_test():
fc1 = nn.Linear(10,20)
fc1.weight.data.normal_(0.0,1.0)
fc1.bias.data.normal_(0.0,1.0)
fc2 = nn.Linear(20,2)
fc2.weight.data.normal_(0.0,1... | Python | 0.000001 | |
407f7fcf8f481c57df59789b7f845928428f1bf9 | Add example script. | telegrambot/example.py | telegrambot/example.py | from telegrambot import TelegramBot, main
from telegrambot.commands import GetCommand
class DemoTelegramBot(TelegramBot, GetCommand):
pass
if __name__ == '__main__':
main(bot_class=DemoTelegramBot) | Python | 0 | |
9fdd671d9c0b91dc789ebf3b24226edb3e6a072a | Add new migration to load metrics fixtures | sleep/migrations/0002_load_metrics.py | sleep/migrations/0002_load_metrics.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.core.management import call_command
def load_metrics():
call_command('loaddata', 'metrics.json')
class Migration(migrations.Migration):
dependencies = [
('sleep', '0001_initial'),
... | Python | 0 | |
7ecc619104177c72b69337a35c7604491f2b06ec | Create amman.py | ideascube/conf/amman.py | ideascube/conf/amman.py | # -*- coding: utf-8 -*-
"""Amman box in Jordan"""
from .base import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_NAME = u"مخيم الأزرق"
COUNTRIES_FIRST = ['SY', 'JO']
TIME_ZONE = 'Asia/Amman'
LANGUAGE_CODE = 'ar'
MONITORING_ENTRY_EXPORT_FIELDS = ['serial', 'refugee_id', 'birth_year',
... | Python | 0.000002 | |
ef4d7e4fb43b5db29576f95625fd612c259731be | Create ServoSync.py | home/Mats/ServoSync.py | home/Mats/ServoSync.py | port = "COM99"
arduino = Runtime.start("arduino","Arduino")
vard = Runtime.start("va","VirtualArduino")
vard.connect(port)
arduino.connect(port)
servo1 = Runtime.start("servo1","Servo")
servo2 = Runtime.start("servo2","Servo")
servo1.attach("arduino",1)
servo2.attach("arduino",2)
servo1.sync(servo2)
| Python | 0.000001 | |
ecfbaded5e03529d1b189b6b5fc8b2f8516c4b31 | Add hoster plugin for ARD mediathek | module/plugins/hoster/ARD.py | module/plugins/hoster/ARD.py |
import subprocess
import re
import os.path
import os
from module.utils import save_join, save_path
from module.plugins.Hoster import Hoster
# Requires rtmpdump
# by Roland Beermann
class RTMP:
# TODO: Port to some RTMP-library like rtmpy or similar
# TODO?: Integrate properly into the API of pyLoad
com... | Python | 0 | |
206ef4f7aad6c4ce51e4737a7d506a79061f1047 | Add an `import_or_skip` function to testing. | distarray/testing.py | distarray/testing.py | import unittest
import importlib
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
def import_or_skip(name):
"""Try importing `name`, raise SkipTest on failure.
Parameters
----------
name : str
Module name to ... | import unittest
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
def comm_null_passes(fn):
"""Decorator. If `self.comm` is COMM_NULL, pass."""
@wraps(fn)
def wrapper(self, *args, **kwargs):
if self.comm == MPI.CO... | Python | 0 |
80c1dba49bbdaf4d0d37e8a06549774d2afd019a | Add cosmo_viewer app | pvapp/cosmo_viewer.py | pvapp/cosmo_viewer.py | ################################################################################
#
# Copyright 2013 Kitware, 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... | Python | 0 | |
99ed96105fcbaa7b2836d19e1dde17bc49f23327 | Commit the basic skeleton | crawl_ptt.py | crawl_ptt.py | #!/usr/bin/env python
from pprint import pprint
import logging
from bs4 import BeautifulSoup
import requests
logging.basicConfig(
format=(
'%(asctime)s\t%(levelname)s\t'
#'%(processName)s\t%(threadName)s\t'
'%(name)s\t%(funcName)s:%(lineno)d\t'
'%(message)s'
),
level=logg... | Python | 0.999616 | |
8287876963af72756c3ff9102526c56f3e28a8a2 | Test for file resources | tests/functional_tests/test_resources/test_file_resource.py | tests/functional_tests/test_resources/test_file_resource.py | # -*- coding: utf8 -*-
from tuttle.resources import FileResource
import tuttle.resources
from os import path
class TestHttpResource():
def test_real_resource_exists(self):
"""A real resource should exist"""
file_url = "file://{}".format(path.abspath(tuttle.resources.__file__))
res = File... | Python | 0 | |
14755cda032b5cb44626b2da66d943517427f947 | test for malformed db imports | tests/test_core.py | tests/test_core.py | """unit tests for core.py"""
import pytest
import core
def test_malformed_linkdatabase():
# pytest.set_trace()
with pytest.raises(EOFError):
core.LinkDatabase().load(db='tests/garbage.pickle')
| Python | 0 | |
3a59057f7465d9982e26b92cddafa0ea9ba48806 | Add new package: universal-ctags (#18962) | var/spack/repos/builtin/packages/universal-ctags/package.py | var/spack/repos/builtin/packages/universal-ctags/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class UniversalCtags(AutotoolsPackage):
"""Universal Ctags generates an index (or tag) file of l... | Python | 0 | |
f29e278a1b661224c9580d8275654a8c6fe7d3cf | add test for http.encode_request | tests/test_http.py | tests/test_http.py | """Test bbs2ch.http module."""
from bbs2ch import http
def test_host_path():
"""Return hostname and path from url."""
assert (u'hoge.com', '/') == http.host_path(u'http://hoge.com/')
def test_encode_request_get():
"""Return http request string."""
header = [(u'Key', u'Value'),
(u'Key2'... | Python | 0 | |
f032556bf07b37f9544c71ecad7aed472021bc97 | Add script to update giving and teams receiving | sql/branch.py | sql/branch.py | import sys
from gratipay import wireup
db = wireup.db(wireup.env())
participants = db.all("""
SELECT p.*::participants
FROM participants p
WHERE (
SELECT error
FROM current_exchange_routes er
WHERE er.participant = p.id
AND network = 'braintree-cc'
) <> ''
""... | Python | 0 | |
da66b2a2a2e2a73ffd986aea6ba5d086d43892fc | Add main smoketest | tests/test_main.py | tests/test_main.py | import unittest
import sys
from chaser import main
class TestMain(unittest.TestCase):
def test_smoke_main(self):
sys.argv = ["chaser"]
main()
| Python | 0.000002 | |
ad1d349d49072b5bda6641db4f070704fde81e5f | Add FCC. | inspectors/fcc.py | inspectors/fcc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://transition.fcc.gov/oig/oigreportsaudit.html
# Oldest report: 1994
# options:
# standard since/year options for a year ra... | Python | 0 | |
c510b27dea59eeae229cf30dabc39ae083f286b0 | Add better indexes | ureport/stats/migrations/0017_better_indexes.py | ureport/stats/migrations/0017_better_indexes.py | # Generated by Django 3.2.6 on 2021-09-27 17:49
from django.db import migrations
INDEX_POLLSTATS_ORG_RESULT_SQL = """
CREATE INDEX IF NOT EXISTS stats_pollstats_org_result on stats_pollstats (org_id, flow_result_id) WHERE flow_result_id IS NOT NULL;
"""
INDEX_POLLSTATS_ORG_QST_RST_CAT_SQL = """
CREATE INDEX IF NOT ... | Python | 0.001981 | |
b304b1087d69d4142a9df5ad2db339e5aafe3331 | Update category | news/views.py | news/views.py | from django.shortcuts import render, redirect,render_to_response
from django.template import RequestContext
from django.http import HttpResponse
from django.urls import reverse
from django.views.generic import TemplateView,DetailView
# Create your views here
from news.models import Slider,How_it_works,ArticleCategory,... | from django.shortcuts import render, redirect,render_to_response
from django.template import RequestContext
from django.http import HttpResponse
from django.urls import reverse
from django.views.generic import TemplateView,DetailView
# Create your views here
from news.models import Slider,How_it_works,ArticleCategory,... | Python | 0.000001 |
fb86dcdd6046c7d35e932396ba541671727b4d01 | rearrange imports to standards | ngSe/utils.py | ngSe/utils.py | from functools import wraps
from time import time, sleep
from .exceptions import element_exceptions
def retry(f=None, timeout=30, interval=0.1):
"""
When working with a responsive UI, sometimes elements are not ready at the very second you request it
This wrapper will keep on retrying finding or interact... | from time import time, sleep
from functools import wraps
from .exceptions import element_exceptions
def retry(f=None, timeout=30, interval=0.1):
"""
When working with a responsive UI, sometimes elements are not ready at the very second you request it
This wrapper will keep on retrying finding or interact... | Python | 0.021967 |
92aab88f88a4a9e3df82dd3f7a94b491a7cb3bd1 | add interactive script | interactive.py | interactive.py | from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
pile = defaultdict(dict)
def draw_sandpile():
dim = raw_input("Enter dimensions of grid (eg, 4x4):\n")
try:
r, c = map(int, dim.strip().split('x'))
pile["r"] = r
pile["c"] = c
except Exception:
... | Python | 0.000001 | |
d648aeb90158cb104ac6548887a39dc13dfa236f | add management cmd make_emails_lowercase | corehq/apps/users/management/commands/make_emails_lowercase.py | corehq/apps/users/management/commands/make_emails_lowercase.py | from django.core.management import BaseCommand
from corehq.apps.users.models import CouchUser
class Command(BaseCommand):
help = "Makes emails into lowercase"
def handle(self, *args, **options):
for couch_user in CouchUser.all():
if couch_user.email and any(char.isupper() for char in cou... | Python | 0.000212 | |
9d2976200965c4ea6b324d0822f6be786a25f2ea | Add file containing filesystem utilities | refmanage/fs_utils.py | refmanage/fs_utils.py | # -*- coding: utf-8 -*-
| Python | 0.000001 | |
64c62afa2a87d6d87017eeaf3f80f6dc18c05c88 | Create pysugar.py | src/pysugar.py | src/pysugar.py | # -*- coding: utf-8 -*-
'''
Created on 2014年7月23日
@author: fengzishiren
@mail: xiaoyaozi106@163.com
'''
import re
import MySQLdb
import os
import sys
from settings import *
__version__ = '0.1'
__date__ = '2014-07-23'
__updated__ = '2014-07-23'
FORMAT_ARGS = {'author': 'pysugar', 'date': __date__, 'version': __versio... | Python | 0.001172 | |
b4784d90d00f5ec1dadcbc56312374a0c838da75 | add createBW | createWorld_BW.py | createWorld_BW.py | ##########################################################################
##file: createWorld_BW.py
##Author: Ken Zyma
##Project: Blocks World and Agency
##
##Dependencies: py2neo.py
## neo4j data stored locally at...(localhost:7474/db/data)
##
##This file contains all methods to create a blocksWorld(n) c... | Python | 0.000001 | |
b674efd944bf124da60db90d90cc2da35761427d | Conform to pep8 | shinken/bin.py | shinken/bin.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can r... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can r... | Python | 0.999996 |
5a77df8ebd1fd20ac6de34fe19853adbfeea6e31 | Add arabic tests | revscoring/languages/tests/test_arabic.py | revscoring/languages/tests/test_arabic.py | import pickle
from nose.tools import eq_
from .. import arabic
from ...datasources import revision
from ...dependencies import solve
from .util import compare_extraction
BAD = [
"احا",
"عاهرا",
"زندقتهما",
"حمار",
"لعن",
"يلعن",
"لعنه",
"امك",
"لعنتهما",
"فلعنهما",
"اعزبوا... | Python | 0.000681 | |
6979bbf6547d689b1980762349a0e78c9c7c026d | Create fibonacci.py | python/fibonacci/fibonacci.py | python/fibonacci/fibonacci.py | a = 0
b = 1
c = 0
n = int(input("Nombre de termes : "))
for i in range (1, n+1):
c = a+b
b = a
a= c
print(c)
| Python | 0.000838 | |
fcf691454b8607fec9d7f5cba43579dc02c26c8b | Check coverage of pgi, vs gi | tests/pgi_covergage.py | tests/pgi_covergage.py | """
find pgi coverage of all gi.repositorys.
you need to have access to both 'gi' and 'pgi' in the current python
environment.
In a virtualenv this works:
$ pip install pgi
$ pip install vext.gi
$ python pgi_coverage.py
"""
TYPELIB_DIR="/usr/lib/girepository-1.0"
from os.path import basename
from glob import glob
... | Python | 0 | |
7c1cbc49e6cdc6ef514382eee9679f4e9719257b | add basic-calculator-ii | vol5/basic-calculator-ii/basic-calculator-ii.py | vol5/basic-calculator-ii/basic-calculator-ii.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-11-18 17:22:37
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-11-18 17:22:44
class Solution:
operators = ['+', '-', '*', '/']
def getPriority(self, operator):
return {
'+' : 1,
... | Python | 0.999311 | |
943383a60f76a13290e540ac35c1ea3a8fc21a3e | Add a utility for downsampling a pair FASTQ files. | micall/utils/sample_fastq.py | micall/utils/sample_fastq.py | #!/usr/bin/env python
import argparse
import random
def parse_args():
parser = argparse.ArgumentParser(
description="Randomly sample reads from FASTQ files for quick processing.")
parser.add_argument('fastq1',
type=argparse.FileType('rU'),
help='origina... | Python | 0 | |
408be8a0d49b7542c74e016a572499a8c4d85351 | Add tests to verify team index and add pages render without errors | app/teams/tests.py | app/teams/tests.py | from app.test_base import BaseTestCase
class TestTeamBehavior(BaseTestCase):
def test_index_page_200(self):
self.login()
response = self.client.get('/teams/')
self.assert200(response)
def test_add_page_200(self):
self.login()
response = self.client.get('/teams/new')
... | Python | 0 | |
5ce6283cff4a3a97911a663d777869a7c7377341 | add http_codes | catalogService/http_codes.py | catalogService/http_codes.py | #
# Copyright (c) 2008 rPath, Inc.
#
HTTP_CONTINUE = 100
HTTP_SWITCHING_PROTOCOLS = 101
HTTP_PROCESSING = 102
HTTP_OK = 200
HTTP_CREATED = 201
HTTP_ACCEPTED = 202
HTTP_NON_AUTHORITATIVE = 203
HTTP_NO_CONTENT = 204
HTTP_RESET_CONTENT = 205
HTTP_PARTIAL_CONTENT = 206
HTTP_MULTI_STATUS = 207
HTTP_MULTIPLE_CHOICES = 300
H... | Python | 0.000004 | |
5c602a98098bdedeffc2b7359a4b3d8407cb1449 | Add migration to ensure consistency on file keys. | scripts/migrate_inconsistent_file_keys.py | scripts/migrate_inconsistent_file_keys.py | #!/usr/bin/env python
# encoding: utf-8
"""Find all nodes with different sets of keys for `files_current` and
`files_versions`, and ensure that all keys present in the former are also
present in the latter.
"""
from website.models import Node
from website.app import init_app
def find_file_mismatch_nodes():
"""Fi... | Python | 0 | |
e5e6506ab6b5191e309aa75e56e25253c0ba7763 | Create drivers.py | chips/memory/file/drivers.py | chips/memory/file/drivers.py | # This code has to be added to the corresponding __init__.py
DRIVERS["filememory"] = ["PICKLEFILE", "JSONFILE"]
| Python | 0.000001 | |
386baa36355b0e9378fff59fe768d1baa7e73fec | Add Himax motion detection example. | scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py | scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py | # Himax motion detection example.
import sensor, image, time, pyb
from pyb import Pin, ExtInt
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.set_framerate(15)
sensor.ioctl(sensor.IOCTL_HIMAX_MD_THRESHOLD, 0x01)
sensor.ioctl(sensor.IOCTL_HIMAX_MD_WINDOW, (0, 0, 320, 240... | Python | 0 | |
b1ab4ef6fbac0ce02d05464e03599d44721fb239 | Add an example using partial. | examples/partial.py | examples/partial.py | #!/usr/bin/env python
from functools import partial
import matplotlib.pyplot as plt
import numpy as np
from latexipy import latexipy as lp
if __name__ == '__main__':
lp.latexify()
figure = partial(lp.figure, folder='some_images', exts=['png'])
x = np.linspace(-np.pi, np.pi)
y1 = np.sin(x)
y2 =... | Python | 0.000001 | |
e781a1e89b945dad1585f82dfdb77cbffbe8fdeb | add unit tests | lib/svtplay_dl/tests/prio_streams.py | lib/svtplay_dl/tests/prio_streams.py | #!/usr/bin/python
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# ex:ts=4:sw=4:sts=4:et:fenc=utf-8
from __future__ import absolute_import
import unittest
from svtplay_dl.utils import prio_streams
class Stream(object):
def __init__(self, proto, bitrate):
self.proto = proto... | Python | 0.000001 | |
4e4a8bbb459e6158a7c2d22c04849de9b4de2693 | Add directory.py to the directory package | classyfd/directory/directory.py | classyfd/directory/directory.py | """Contains a Directory class to represent real directories""" | Python | 0.000001 | |
0c079b7160cf635c14a016d418d2bc8d3d521f26 | add docker start tool | tools/run.py | tools/run.py | # coding=utf-8
import os
import json
os.system("docker rm -f redis")
os.system("docker rm -f mysql")
os.system("docker rm -f oj_web_server")
if os.system("docker run --name mysql -v /root/data:/var/lib/mysql -v /root/data/my.cnf:/etc/my.cnf -e MYSQL_ROOT_PASSWORD=root -d mysql/mysql-server:latest"):
print "Error... | Python | 0.000001 | |
4cf7f6c23bc9d01c6780afa4d27bf9e5e71fb72b | add hacky download | util/unidata_dl.py | util/unidata_dl.py | import glob
import os
import datetime
sts = datetime.datetime(2016, 11, 21, 0, 0)
ets = datetime.datetime(2016, 11, 21, 3, 0)
interval = datetime.timedelta(minutes=1)
os.chdir('data/nexrad/NIDS')
for nexrad in glob.glob('???'):
os.chdir(nexrad)
for nids in ['N0Q', 'NET', 'N0R', 'EET']:
if not os.path.... | Python | 0 | |
e8799d50dea038fe6e6bb94a4676d2f6eaf1ed1d | Update judgeapi.py | judge/judgeapi.py | judge/judgeapi.py | from django.conf import settings
import socket
import struct
import json
import logging
from judge.simple_comet_client import delete_channel, create_channel, send_message
logger = logging.getLogger('judge.judgeapi')
size_pack = struct.Struct('!I')
def judge_request(packet, reply=True):
sock = socket.socket(soc... | from django.conf import settings
import socket
import struct
import json
import logging
from judge.simple_comet_client import delete_channel, create_channel, send_message
logger = logging.getLogger('judge.judgeapi')
size_pack = struct.Struct('!I')
def judge_request(packet, reply=True):
sock = socket.socket(soc... | Python | 0.000001 |
3dbf91d4d447f6dbddece040b3a9dcbeb8ebcd22 | Add missing migrations | getyourdata/data_request/migrations/0023_auto_20160716_0946.py | getyourdata/data_request/migrations/0023_auto_20160716_0946.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-16 09:46
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('data_request', '0022_faqcontent_priority'),
]
ope... | Python | 0.000029 | |
ddb9e1c0160f40fe60330c247906b9b41f18be1b | Create hearthstone_way_to_legend.py | hearthstone_way_to_legend.py | hearthstone_way_to_legend.py | import random,statistics
winrate = 0.51
iterations = 100
games = [0]*iterations
passwinstreak = 5*5 # below Rank 5
for x in range(iterations):
# 1-10 11-15 => 15 rank
ladderPosition = 5*10 + 4*5
winstrek = 0
while True:
games[x] = games[x] + 1
if random.... | Python | 0.00009 | |
a801deeaa00e443b3c68c1fbcea1e6ff62d90082 | Add Python script to generate users | python/addusers.py | python/addusers.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Adds a sequential number of users into a test database
with username: newusern and password newusern
Not for production usage
"""
import MySQLdb
hostname = # FILL IN
username = # FILL IN
password = # FILL IN
# Simple routine to run a query on a database and prin... | Python | 0.000003 | |
6602bbfa47c2523bc4d058bfa1d5a28d5fc33836 | Add tag reading | bw_read_xml.py | bw_read_xml.py | from lxml import etree
from copy import copy
class BattWarsObject(object):
def __init__(self, obj):
self._attributes = {}
self.type = obj.get("type")
self.id = obj.get("id")
self._xml_node = obj
# We will create a name for this object by putting the type and ID together.
... | from lxml import etree
from copy import copy
class BattWarsObject(object):
def __init__(self, obj):
self._attributes = {}
self.type = obj.get("type")
self.id = obj.get("id")
self._xml_node = obj
# We will create a name for this object by putting the type and ID together.
... | Python | 0 |
821f1b83c441122b28ad2dc869576ca22a4ee642 | Create ngram_service.py | ngram_utils/ngram_service.py | ngram_utils/ngram_service.py | from thrift.transport import TSocket
from thrift.protocol import TBinaryProtocol
from thrift.transport import TTransport
from libs.hbase import Hbase
class NgramService(object):
def __init__(self, mongo_host, hbase_host):
mclient = settings.MONGO_CLIENT
unigram_db = mclient['unigrams']
bigram_db = mcl... | Python | 0.000003 | |
897b56183c3b30a0bc4f439e20d42ce8da2b444c | add empty unit test for viewhandler module | supvisors/tests/test_viewhandler.py | supvisors/tests/test_viewhandler.py | #!/usr/bin/python
#-*- coding: utf-8 -*-
# ======================================================================
# Copyright 2016 Julien LE CLEACH
#
# 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 Lice... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.