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 |
|---|---|---|---|---|---|---|---|
4879fc188c685e4676414a2f186d8d52998bc28d | Create task_3_3.py | PINp/2015/KAKURKIN_I_V/task_3_3.py | PINp/2015/KAKURKIN_I_V/task_3_3.py | # Задача 3. Вариант 3.
# Напишите программу, которая выводит имя "Чарльз Лютвидж Доджсон",
# и запрашивает его псевдоним.
# Программа должна сцеплять две эти строки и выводить полученную строку,
# разделяя имя и псевдоним с помощью тире.
NAME = "Чарльз Лютвидж Доджсон"
print(NAME)
PNAME = input("Его псевдоним?\n")
pri... | Python | 0.999993 | |
8630d60a2ecdd2fac4153623ac64ba188e05d8b7 | Add source code. | pigrelay.py | pigrelay.py | import os
import sys
import time
import socket
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
SOCKFILE = "/tmp/snort_alert"
BUFSIZE = 65863
IP = '127.0.0.1'
PORT = 51234
# TODO: TLS/SSL wrapper for socket
class SnortListener():
def __init__(self):
self.uns... | Python | 0 | |
e15de99ae79e97becdc3d4a4a2bcf60e70e5d2d4 | Create escolas_ceara.senso_2013.py | raspagem/random/escolas_ceara.senso_2013.py | raspagem/random/escolas_ceara.senso_2013.py | import urllib.request
import json
#url = 'http://educacao.dadosabertosbr.com/api/cidades/ce'
#cidades = urllib.request.urlopen(url).read()
#cidades = json.loads(cidades.decode('utf-8'))
#print('Lista de Cidades')
#[print(cidade.split(':')[1]) for cidade in cidades]
print('Lista de Escolas Municipais de Aracati com L... | Python | 0.000093 | |
ef38b112a2cf46fe1bbb52a9633fd42fad03ddb0 | Update method name | rtv/subscriptions.py | rtv/subscriptions.py | import curses
import sys
import time
import logging
from .content import SubscriptionContent
from .page import BasePage, Navigator, BaseController
from .curses_helpers import (Color, LoadScreen, add_line)
__all__ = ['SubscriptionController', 'SubscriptionPage']
_logger = logging.getLogger(__name__)
class Subscriptio... | import curses
import sys
import time
import logging
from .content import SubscriptionContent
from .page import BasePage, Navigator, BaseController
from .curses_helpers import (Color, LoadScreen, add_line)
__all__ = ['SubscriptionController', 'SubscriptionPage']
_logger = logging.getLogger(__name__)
class Subscriptio... | Python | 0.000002 |
43e48de2210873fd5ab6c9181f0aab7884c529be | Create app.py | reddit2telegram/channels/r_communism/app.py | reddit2telegram/channels/r_communism/app.py | #encoding:utf-8
subreddit = 'communism'
t_channel = '@r_communism'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Python | 0.000003 | |
d17c14df00c31af49080ff2f9fea8597a8861461 | Add recipe usage command for quick diagnostics. | starthinker_ui/recipe/management/commands/recipe_usage.py | starthinker_ui/recipe/management/commands/recipe_usage.py | ###########################################################################
#
# Copyright 2022 Google LLC
#
# 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
#
# https://www.apache.org/l... | Python | 0.0001 | |
2b797879f3a4bf148575df1309369ed4532e4ab6 | bump version to 14.1.0 | zmq/sugar/version.py | zmq/sugar/version.py | """PyZMQ and 0MQ version functions."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distribut... | """PyZMQ and 0MQ version functions."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distribut... | Python | 0 |
5b2c328b94244fd6baf6403349919f3bc4f2d013 | add missing migration | meinberlin/apps/cms/migrations/0032_update_body.py | meinberlin/apps/cms/migrations/0032_update_body.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-23 16:07
from __future__ import unicode_literals
from django.db import migrations
import meinberlin.apps.cms.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependenc... | Python | 0.000258 | |
e53a951ed98f460b603f43f6364d5d0a0f17a1ba | Add basic class structure, map functionality, and a set of consumer functions. | src/streamer.py | src/streamer.py | class pStream:
###PRIVATE FUNCTIONS
def _builder(self, expression):
self.STR = expression
return self
###OVERRIDES
def next(self):
return next(self.STR)
def __init__(self, iterable_thing):
self.STR = iterable_thing
def __iter__(self):
return iter(self.STR)
#... | Python | 0 | |
fd94f2d895156218ce7490b865d5cc42e7f0e15e | Add pack management action for setting up virtual environment for the provided packs. | contrib/packs/actions/pack_mgmt/create_virtualenv.py | contrib/packs/actions/pack_mgmt/create_virtualenv.py | import os
import re
import pipes
import subprocess
from st2actions.runners.pythonrunner import Action
# TODO: Use config base path + virtualenv suffix
VIRTUALENVS_PATH = '/opt/stackstorm/virtualenvs/'
# TODO: Read from config
BASE_PACKS_PATH = '/opt/stackstorm'
# TODO: Move into utils, also enforce in other places
... | Python | 0 | |
82e871441010999e4a369b101019a34e7b03eca4 | add common csp-report URL | security/urls.py | security/urls.py | from django.conf.urls import patterns, include, url
urlpatterns = patterns('security.views',
url('^/csp-report/$', security.views.csp_report),
)
| Python | 0 | |
86c3f149726b58951e85f9bd6e324b032430b5ae | Deploy a schema template (#51379) | lib/ansible/modules/network/aci/mso_schema_template_deploy.py | lib/ansible/modules/network/aci/mso_schema_template_deploy.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_ve... | Python | 0 | |
0b6709670179c0721b4f113d13bf34d9ac7715dd | Add a python plotter that compares the results of with Stirling numbers | test/indices.py | test/indices.py | import matplotlib.pyplot as plt
import numpy
from math import factorial
def binom(a,b):
return factorial(a) / (factorial(b)*factorial(a-b))
def stirling(n,k):
if n<=0 or n!=0 and n==k:
return 1
elif k<=0 or n<k:
return 0
elif n==0 and k==0:
return -1
else:
s = sum(... | Python | 0.000002 | |
7b179e4a420a3cd7a27f0f438a6eac462048bb93 | Add py solution for 554. Brick Wall | py/brick-wall.py | py/brick-wall.py | import heapq
class Solution(object):
def leastBricks(self, wall):
"""
:type wall: List[List[int]]
:rtype: int
"""
n_row = len(wall)
heap = [(wall[i][0], i, 0) for i in xrange(n_row)]
heapq.heapify(heap)
max_noncross = 0
while True:
... | Python | 0.004967 | |
846ad2780ad2ccc9afbd6a224d567389bf09611f | add integer-to-english-words | vol6/integer-to-english-words/integer-to-english-words.py | vol6/integer-to-english-words/integer-to-english-words.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-11-06 21:35:56
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-11-06 21:36:07
class Solution(object):
def numberToWords(self, num):
"""
:type num: int
:rtype: str
"""
if num ... | Python | 0.999999 | |
f02f8f5a68bd26d1ece32c50482729b7774b6e2a | Add a simple script for looking at connections. | scripts/simple-analysis.py | scripts/simple-analysis.py | #!/usr/bin/python
from __future__ import print_function, division
import networkx
from reddit_meatspace.models import MeetupConnections
connections = MeetupConnections._byID("2013")
digraph = networkx.DiGraph()
for connection, timestamp in connections._values().iteritems():
left, right = connection.split(":")
... | Python | 0 | |
e3a36aaab3abe7c645e3b8491cd163dea8ff0fea | add python solution to "project euler - problem 4" | problem4.py | problem4.py |
def is_palindrome(number):
number = str(number)
number_digits = len(number)
for i in xrange(0, number_digits/2):
if number[i] != number[number_digits-i-1]:
return False
return True
def test_it(n):
print n, is_palindrome(n)
for x in xrange(0,1231):
test_it(x);
greatest_palindrome = 0
for x in xrange(100,... | Python | 0 | |
ced620ac5744ad088322c59ab540394cdce8ccaf | Add tool to read a merged result info file, find the runs with the noisest (and not nosiest) execution time and generate the corresponding invocation info so that the programs can be re-run. | tools/result-info-generate-noisy-timing-invocation-info.py | tools/result-info-generate-noisy-timing-invocation-info.py | #!/usr/bin/env python
# Copyright (c) 2016, Daniel Liew
# This file is covered by the license in LICENSE-SVCB.txt
# vim: set sw=4 ts=4 softtabstop=4 expandtab:
"""
Read a merged klee-runner result info file and output a new invocation info
that is a subset of the programs in the merged klee-runner.
"""
from load_klee_r... | Python | 0 | |
bf4b3d79f34e189a30b8168796fa1595bf49f1d7 | Fix field name | core/migrations/0002_auto_20150907_1413.py | core/migrations/0002_auto_20150907_1413.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='notification',
old_name... | Python | 0.000003 | |
404051ebc9d68c571be77e177b0455631f0c14ad | create basic model `Food` for run all tests | tests/models.py | tests/models.py | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from tags.fields import TagField
@python_2_unicode_compatible
class Food(models.Model):
name = models.CharField(max_length=50)
tags = TagField('Tags')
def __str__(self):
... | Python | 0.000003 | |
50ca8ffb078b37b472c1ccbbb2a4f21e8d7eade4 | fix gbformatting | django-openstack/django_openstack/templatetags/templatetags/sizeformat.py | django-openstack/django_openstack/templatetags/templatetags/sizeformat.py | """
Template tags for displaying sizes
"""
import datetime
from django import template
from django.utils import translation
from django.utils import formats
register = template.Library()
def int_format(value):
return int(value)
def float_format(value):
return formats.number_format(round(value, 1), 0)
de... | """
Template tags for displaying sizes
"""
import datetime
from django import template
from django.utils import translation
from django.utils import formats
register = template.Library()
def int_format(value):
return int(value)
def float_format(value):
return formats.number_format(round(value, 1), 0)
de... | Python | 0.000002 |
106bce6081ed6c1c8442a1bb82aa39ef177bed8a | Solve problem 6 | problem006.py | problem006.py | #!/usr/bin/env python3
def sumsq(maxnumber):
return sum(n**2 for n in range(1, maxnumber+1))
def sqsum(maxnumber):
return sum(range(1, maxnumber+1))**2
print(sqsum(100) - sumsq(100))
| Python | 0.999998 | |
fab193fa2c31b2e1cf58255d37f5e8dd63fef206 | Add high level for key signing | libnacl/sign.py | libnacl/sign.py | '''
High level routines to maintain signing keys and to sign and verify messages
'''
# Import libancl libs
import libnacl
import libnacl.utils
import libnacl.encode
class Signer(libnacl.utils.BaseKey):
'''
The tools needed to sign messages
'''
def __init__(self, seed=None):
'''
Create ... | Python | 0.000001 | |
6332ca6fd715e730faf7e377843e2d2f8bfa2b84 | Create blink.py | linkit/blink.py | linkit/blink.py | #!/usr/bin/python
import mraa # For accessing the GPIO
import time # For sleeping between blinks
LED_GPIO = 5 # we are using D5 pin
blinkLed = mraa.Gpio(LED_GPIO) # Get the LED pin object
blinkLed.dir(mraa.DIR_OUT) # Set the direction as output
ledState = False # LED is off... | Python | 0.000024 | |
56b5b0d9f1fd420e2ea7cdb0654d5c2f9d637189 | Add light theme | themes/light.py | themes/light.py | from utils import colors
# Segments colors.
USERATHOST_BG = colors.SMERALD
USERATHOST_FG = colors.WHITE
SSH_BG = colors.LIGHT_ORANGE
SSH_FG = colors.WHITE
CURRENTDIR_BG = colors.MID_GREY
CURRENTDIR_FG = colors.LIGHT_GREY
READONLY_BG = colors.LIGHT_GREY
READONLY_FG = colors.RED
EXITCODE_BG = colors.RED
EXITCODE_FG... | Python | 0.000001 | |
878d0b793c8efa1dafc246326d519685032ee9a7 | Add new package: influxdb (#17909) | var/spack/repos/builtin/packages/influxdb/package.py | var/spack/repos/builtin/packages/influxdb/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 *
import platform
_versions = {
'1.8.1': {
'Linux_amd64': ('64e60e438ac8a8fdacc6623f238c40b... | Python | 0 | |
c1117f05934f76da72652d574aa240245d4724ff | new package (#6874) | var/spack/repos/builtin/packages/opa-psm2/package.py | var/spack/repos/builtin/packages/opa-psm2/package.py | ##############################################################################
# Copyright (c) 2013-2017, 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.618644 | |
0c94e01a6d70b9ab228adc6ba3b094a488ee6020 | Create json_yaml.py | json_yaml.py | json_yaml.py | class FileHandler():
""" lazy read 'num_lines' lines from filePath
to avoid overwhelming the RAM, most importantly
it runs only when asked for """
filePath, num_lines = str(), int()
def setVarValues(self):
filePath = input()
num_lines= input()
moreLines = nLineReader()
return
def nLineReader():
wi... | Python | 0.999439 | |
60e64bac0a3cadccd0f35b5c8e8770b4edf0afff | add new package (#21793) | var/spack/repos/builtin/packages/virtuoso/package.py | var/spack/repos/builtin/packages/virtuoso/package.py | # Copyright 2013-2021 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 Virtuoso(AutotoolsPackage):
"""Virtuoso is a high-performance and scalable Multi-Model RD... | Python | 0 | |
39b63523634801fe8ef2cca03e11b3875d84cdbd | Tweak syntax for f.close() concision, add typehints | flare/flare_io.py | flare/flare_io.py | from flare.struc import Structure
from typing import List
from json import dump, load
from flare.util import NumpyEncoder
def md_trajectory_to_file(filename: str, structures: List[Structure]):
"""
Take a list of structures and write them to a json file.
:param filename:
:param structures:
"""
with open(filename,... | from flare.struc import Structure
from typing import List
from json import dump, load
from flare.util import NumpyEncoder
def md_trajectory_to_file(filename, structures: List[Structure]):
"""
Take a list of structures and write them to a json file.
:param filename:
:param structures:
"""
f = open(filename, 'w')
... | Python | 0 |
cb0d6124ea31e8fb9ff8957072a2b881b882127e | Add Timelapse script for sunrise timelapses | examples/hero9_timelapse_webcam.py | examples/hero9_timelapse_webcam.py | import sys
import time
from goprocam import GoProCamera, constants
import threading
import logging
"""
I use PM2 to start my GoPro cameras, using a Raspberry Pi 4, works perfectly.
pm2 start timelapse.py --cron "30 7 * * *" --log timelapse.log --no-autorestart
This script will overrride some settings for reliability... | Python | 0 | |
39d9dfc1fa8e57b126a2da4978a62702ea206521 | add test for DeactivateMobileWorkerTrigger | corehq/apps/users/tests/test_deactivate_mobile_worker_trigger.py | corehq/apps/users/tests/test_deactivate_mobile_worker_trigger.py | import datetime
from django.test import TestCase
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.users.models import (
CommCareUser,
DeactivateMobileWorkerTrigger,
)
class TestDeactivateMobileWorkerTrigger(TestCase):
@classmethod
def setUpClass(cls):
super().setUpCla... | Python | 0 | |
9d63571c5add6ff2ff064f41c9bc97a6943a69e9 | add missing migration | toucan/invitations/migrations/0002_auto_20161009_2158.py | toucan/invitations/migrations/0002_auto_20161009_2158.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-09 21:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('invitations', '0001_initial'),
]
operations = [
migrations.AlterModelOption... | Python | 0.000258 | |
4651e178ddbeac9211f8170e2e20f8a35ff0e3ab | Add a simple CLI script for writing out results of scripts | ocradmin/plugins/test_nodetree.py | ocradmin/plugins/test_nodetree.py | #!/usr/bin/python
import os
import sys
import json
sys.path.append(os.path.abspath(".."))
os.environ['DJANGO_SETTINGS_MODULE'] = 'ocradmin.settings'
sys.path.insert(0, "lib")
from nodetree import script
from nodetree.manager import ModuleManager
def run(nodelist, outpath):
manager = ModuleManager()
manager.... | Python | 0 | |
f48fe7ecd8441ddf697c0c9a34e491b0916462c0 | Add mirror verification script | tools/verify.py | tools/verify.py | # Distribute and use freely; there are no restrictions on further
# dissemination and usage except those imposed by the laws of your
# country of residence. This software is provided "as is" without
# warranty of fitness for use or suitability for any purpose, express
# or implied. Use at your own risk or not at all.
... | Python | 0.000001 | |
74fec13ce5ca0f011c8970e7664727b422597d9a | Add tools.genetics module (#41, #36)) | xentica/tools/genetics.py | xentica/tools/genetics.py | """A collection of functions allowing genetics manipulations."""
def genome_crossover(*genomes):
"""
Crossover given genomes in stochastic way.
:param genomes: A list of genomes (integers) to crossover
:returns: Single integer, a resulting genome.
"""
raise NotImplementedError
| Python | 0 | |
c2fbf8c5a7e3ea299d2ab011b116df7f114c7e4c | Add unit test | python/paddle/v2/framework/tests/test_conv3d_op.py | python/paddle/v2/framework/tests/test_conv3d_op.py | import unittest
import numpy as np
from op_test import OpTest
class TestConv3dOp(OpTest):
def setUp(self):
self.init_groups()
self.op_type = "conv3d"
batch_size = 2
input_channels = 3
input_depth = 5
input_height = 5
input_width = 5
output_channels =... | Python | 0.000001 | |
5f0ebdb043a313a784c723c36b87d316e276629f | Add recurring events experiment | experiments/python/pygame_recurring_events.py | experiments/python/pygame_recurring_events.py | import pygame
import pygame.joystick
from pygame.locals import *
def main():
pygame.init()
clock = pygame.time.Clock()
ue = pygame.event.Event(USEREVENT, {'code':'drop'})
pygame.time.set_timer(127, 500)
while(True):
events = pygame.event.get()
for e in events:
print(e)
clock.t... | Python | 0.000092 | |
4d34906eba347f56a13b193efa3cedb3f2ab2a24 | Add tests for ironic-dbsync. | ironic/tests/test_dbsync.py | ironic/tests/test_dbsync.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# -*- encoding: utf-8 -*-
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complian... | Python | 0 | |
3498c5e2c778c924397af8124544c2ce230e4d46 | reorder contribute form (bug 744631) | apps/mozorg/forms.py | apps/mozorg/forms.py | from django import forms
from django.forms import widgets
from django.utils.safestring import mark_safe
from django.core.validators import EMPTY_VALUES
from product_details import product_details
FORMATS = (('H', 'HTML'), ('T', 'Text'))
class SideRadios(widgets.RadioFieldRenderer):
"""Render radio buttons as lab... | from django import forms
from django.forms import widgets
from django.utils.safestring import mark_safe
from django.core.validators import EMPTY_VALUES
from product_details import product_details
FORMATS = (('H', 'HTML'), ('T', 'Text'))
class SideRadios(widgets.RadioFieldRenderer):
"""Render radio buttons as lab... | Python | 0 |
71849714d809e882838e109d6906086b47fe68c5 | Create hubspot-amulet.py | CiO/hubspot-amulet.py | CiO/hubspot-amulet.py | import itertools
def checkio(m):
for a, b, c in itertools.product(range(-180,181), repeat=3):
if not (a + b*m[1][0] + c*m[2][0])%360:
if (a*m[0][1] + b + c*m[2][1])%360 == 225:
if (a*m[0][2] + b*m[1][2] + c)%360 == 315:
return [a, b, c]
| Python | 0 | |
ddaf84abf3519daa22d51911a5f79b861a4165ed | Work on some AcoustID release determination stuff | audio_pipeline/util/AcoustidLookup.py | audio_pipeline/util/AcoustidLookup.py | import acoustid
class ReleaseLookup:
TEMP_API_KEY = None
api_key = TEMP_API_KEY
def __init__(self, client_key):
self.client_key = client_key
class Release:
"""
Relevent data - release name, release artist,
"""
TEMP_API_KEY = None
api_key = TEMP_API_KEY
... | Python | 0 | |
5156c590b43f5a2bf577da224829c20bc3b97230 | add first example | libs/utils/filters.py | libs/utils/filters.py |
# import glob
# import matplotlib.gridspec as gridspec
# import matplotlib.pyplot as plt
# import numpy as np
# import os
# import pandas as pd
# import pylab as pl
# import re
# import sys
# import trappy
# Configure logging
import logging
class Filters(object):
def __init__(self, trace, tasks=None):
s... | Python | 0 | |
4137fd528367cfc5caf8c89665e1d2ee0ceb8385 | Clean function cleans data correctly | Projects/Tracking/clean.py | Projects/Tracking/clean.py | import pandas as pd
from Code.config import get_path
def clean_ble(df):
PATH = get_path()
# Remove unwanted columns
df = df.drop(['clientmac', 'proximity', 'type', 'probetime_gmt', 'probetime'], axis=1)
# Rename column headers
df.columns=['id', 'datetime', 'sensor', 'power', 'rssi', 'accuracy']
... | Python | 0.000004 | |
c0cf6739d3b10868eaae246c36eb691bff42a5aa | Add webdriver base test suite. | QA/pycopia/QA/webdriver.py | QA/pycopia/QA/webdriver.py | #!/usr/bin/python2.5
# -*- coding: us-ascii -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# Copyright (C) 2010 Keith Dart <keith@dartworks.biz>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by th... | Python | 0 | |
b1f22b33a60da2b27ac17090c0fa759e510dd051 | Create rlmradio.py | rlmradio.py | rlmradio.py | #Grabs Current Info for RLM Radio Stream
import requests
import re
from cloudbot import hook
import urllib
import urllib.request
url = "http://38.135.36.125:7359/7.html"
@hook.command("rlmradio", autohelp=False)
def rlmradio(text):
url = "http://38.135.36.125:7359/7.html"
html = urllib.request.urlopen(url)... | Python | 0.000001 | |
ef334685d3933c12d21102540a53ea5ef0741738 | Create z_feed.py | z_feed.py | z_feed.py |
import feedparser, nltk, tweepy, json, time
from pyshorteners import Shortener
used_file = 'used_links_list.json'
#Erasing [used links] in json in testing mode, comment when no need
used_links = []
with open(used_file, 'w') as used:
json.dump(used_links, used)
# Insert rss feed url
feed = ['https://foo.bar.foo... | Python | 0.000008 | |
862370ec4cc438b41ab2717ac4dafa16cab94df2 | Add scraper for Housing and Urban Development | inspectors/hud.py | inspectors/hud.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
#
# options:
# standard since/year options for a year range to fetch from.
#
# pages - number of pages to fetch. defaults to all ... | Python | 0 | |
bc4b25b9c24ef0db58acbd1c8e24b3fee319314b | Solve challenge 13 | Challenges/chall_13.py | Challenges/chall_13.py | #!/Applications/anaconda/envs/Python3/bin
# Python challenge - 13
# http://www.pythonchallenge.com/pc/return/disproportional.html
# http://www.pythonchallenge.com/pc/phonebook.php
import xmlrpc.client
def main():
'''
Hint: phone that evil
<area shape="circle" coords="326,177,45" href="../phonebook.php">
... | Python | 0.001318 | |
742c6d47cd542a2c56b50d48c92b817e977da768 | add pgproxy.py | misc/pgproxy.py | misc/pgproxy.py | #!/usr/bin/env python3
##############################################################################
#The MIT License (MIT)
#
#Copyright (c) 2016 Hajime Nakagami
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to dea... | Python | 0.000001 | |
78ea9019850dbf9b88d3f65a4a61139f01d2c496 | Add scratch genbank-gff-to-nquads.py which just opens a gff file atm | src/genbank-gff-to-nquads.py | src/genbank-gff-to-nquads.py | #!/usr/bin/env python
import jargparse
parser = jargparse.ArgParser('Convert Genbank GFF into an n-quad file')
parser.add_argument('gffPath', help='path to the GFF')
args = parser.parse_args()
with open(args.gffPath):
pass
| Python | 0 | |
48b724d7a2163c50be60d98933132b51347940bd | Create longest-line-of-consecutive-one-in-a-matrix.py | Python/longest-line-of-consecutive-one-in-a-matrix.py | Python/longest-line-of-consecutive-one-in-a-matrix.py | # Time: O(m * n)
# Space: O(n)
class Solution(object):
def longestLine(self, M):
"""
:type M: List[List[int]]
:rtype: int
"""
if not M: return 0
result = 0
dp = [[[0] * 4 for _ in xrange(len(M[0]))] for _ in xrange(2)]
for i in xrange(len(M)):
... | Python | 0.999548 | |
d11d928e9b38748534885060f62b4a956c9be4ba | Add unit test for new index page | csunplugged/tests/plugging_it_in/views/test_index_view.py | csunplugged/tests/plugging_it_in/views/test_index_view.py | from http import HTTPStatus
from django.urls import reverse
from tests.BaseTestWithDB import BaseTestWithDB
from tests.topics.TopicsTestDataGenerator import TopicsTestDataGenerator
class IndexViewTest(BaseTestWithDB):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.lan... | Python | 0 | |
148b2d3c9025f234ecc3ede02c39cfcb6295f39a | 1089. Duplicate Zeros | problems/test_1089_manual_copy.py | problems/test_1089_manual_copy.py | import unittest
from typing import List
import utils
# O(n) time. O(1) space. Array.
class Solution:
def duplicateZeros(self, arr: List[int]) -> None:
"""
Do not return anything, modify arr in-place instead.
"""
num_zeros = sum(num == 0 for num in arr)
if num_zeros == 0:
... | Python | 0.999999 | |
23138ab91e5ac0ecf92a0968bf8e4abfa7d0c763 | Remove duplicates in all subdirectories - working raw version. | removedups.py | removedups.py | import hashlib, csv, os
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
def process_directory_csv(current_dir_fullpath, sub_dir_list, files, csvwriter):
for file i... | Python | 0 | |
59736ee4dd82da7f7945723ec1cc89b19359b5c7 | Create LargestPrimeFactor.py | LargestPrimeFactor.py | LargestPrimeFactor.py | #! Christian Ng
base = 0
print("Enter an integer:")
base = int(raw_input())
print "Largest Factor is:"
while (base % 2) == 0:
base = base/2
if base == 1 or base == -1:
print "2"
increment = 3
while base != 1 and base != -1:
while base % increment == 0:
base = base/increment
... | Python | 0.999046 | |
99395e345f74bbedd29fd45eebe0738a3b5f4729 | Test api endpoint for package show | ckanext/archiver/tests/test_api.py | ckanext/archiver/tests/test_api.py | import pytest
import tempfile
from ckan import model
from ckan import plugins
from ckan.tests import factories
import ckan.tests.helpers as helpers
from ckanext.archiver import model as archiver_model
from ckanext.archiver.tasks import update_package
@pytest.mark.usefixtures('with_plugins')
@pytest.mark.ckan_config... | Python | 0 | |
0c10fa6c742a4ceee1af410405a625c6ad3c0dbc | Factoring out word2vec _main__ into gensim/scripts | gensim/scripts/word2vec_standalone.py | gensim/scripts/word2vec_standalone.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s -train CORPUS -output VECTORS -size SIZE -window WINDOW
-cbow CBOW -sample SAMPLE -hs HS -negative NEGATIVE -threads THREADS -iter ITER
-min-count MIN-COUNT -binary BINARY ... | Python | 0.999988 | |
070a5192e4473bbbbf25a881080413f771f05801 | Add mockldap.ldap.functions taken from python-ldap | src/mockldap/ldap/functions.py | src/mockldap/ldap/functions.py | import sys
from ldapobject import LDAPObject
def initialize(uri,trace_level=0,trace_file=sys.stdout,trace_stack_limit=None):
"""
Return LDAPObject instance by opening LDAP connection to
LDAP host specified by LDAP URL
Parameters:
uri
LDAP URL containing at least connection scheme and hostport,
... | Python | 0.000001 | |
2f93251e77589c0edbb8e560940d29764caac9e0 | Test password update functionality | tests/blueprints/authentication/test_views_password_update.py | tests/blueprints/authentication/test_views_password_update.py | # -*- coding: utf-8 -*-
"""
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.authentication.password.models import Credential
from byceps.services.authentication.password import service as password_service
from byceps.services.authentication.session.... | Python | 0 | |
1272bb1f03915100be17cff6e62462e662ca154c | Use a custom plugin to be able to build the snap with go 1.7 | parts/plugins/x-go.py | parts/plugins/x-go.py | """This is a modified version of snapcraft's go plugin.
It uses go 1.7 from ppa:gophers/archive, because it is not yet published
in the xenial archives.
The go plugin can be used for go projects using `go get`.
This plugin uses the common plugin keywords, for more information check the
'plugins' topic.
This plugin ... | Python | 0 | |
0c59028a1ef33b3627e65955bafbf9b415c9bc34 | Add 457_Circular_Array_Loop.py (#34) | python/457_Circular_Array_Loop.py | python/457_Circular_Array_Loop.py | class Solution:
def circularArrayLoop(self, nums: List[int]) -> bool:
for i in range(len(nums)):
if nums[i] == 0:
continue
# if slow and fast pointers collide, then there exists a loop
slow = i
fast = self.index(nums, slow)
... | Python | 0 | |
67be4c6037c5c6a25f7787964f9862ab61274f77 | Create interfacestats.py | interfacestats.py | interfacestats.py | #! /usr/bin/python
'''
Created on Dec 3, 2014
@author: William.George
'''
import sys
import getopt
import csv
# import time
from sshutil import GetCredentials, clSwitch
from sshutil import DedupilicateList
from metrics import PrintMetrics
from metrics import DebugPrint
def main(argv):
"""
Collect and output... | Python | 0.000001 | |
ae484c893c9cbef5a80b908ba254885e1db4d0b3 | Create 0015_auto_20200128_1045.py | bluebottle/activities/migrations/0015_auto_20200128_1045.py | bluebottle/activities/migrations/0015_auto_20200128_1045.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2020-01-28 09:45
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
... | Python | 0.000001 | |
a59aef7c780c4d940ff56fa34ddf38de46056a6f | add package py-flask-compress (#7713) | var/spack/repos/builtin/packages/py-flask-compress/package.py | var/spack/repos/builtin/packages/py-flask-compress/package.py | ##############################################################################
# Copyright (c) 2013-2017, 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 | |
d48b17dc82e359aca962449c6df51aaea88a11d3 | add resource manager tests | pyvisa_py/testsuite/keysight_assisted_tests/test_resource_manager.py | pyvisa_py/testsuite/keysight_assisted_tests/test_resource_manager.py | # -*- coding: utf-8 -*-
"""Test the Resource manager.
"""
from pyvisa.testsuite.keysight_assisted_tests import require_virtual_instr
from pyvisa.testsuite.keysight_assisted_tests.test_resource_manager import (
TestResourceManager as BaseTestResourceManager,
TestResourceParsing as BaseTestResourceParsing,
)
@... | Python | 0.000008 | |
d623140b606d7ec9b874419b4414833d669f5677 | add a way to set the last sync date | crate_project/apps/crate/management/commands/set_last_sync.py | crate_project/apps/crate/management/commands/set_last_sync.py | import redis
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
r = redis.StrictRedis(**getattr(settings, "PYPI_DATASTORE_CONFIG", {}))
if args:
r.set("crate:pypi:since", args[0])
| Python | 0.000026 | |
4fd3c2fb2ac14fcfc7183108d2d3c79377d85790 | read router for grouptagvalue instead of hardcoding default | src/sentry/models/grouptagvalue.py | src/sentry/models/grouptagvalue.py | """
sentry.models.grouptagvalue
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from datetime import timedelta
from django.db import connections, models, router
from django.d... | """
sentry.models.grouptagvalue
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from datetime import timedelta
from django.db import connections, models
from django.db.models... | Python | 0 |
ca96e71995c9daa17323a3285bee71c8d334c11e | Add abstract classifier | assisstant/keyboard/classification/abstract_classifier.py | assisstant/keyboard/classification/abstract_classifier.py | from abc import ABC, abstractmethod, abstractproperty
class AbstractClassifier(ABC):
def __init__(self, freqs, duration, data=None):
self.freqs = freqs
self.duration = duration
if data:
self.data = data
self.train(data)
@abstractmethod
def classify(self, sample):
pass
... | Python | 0.999999 | |
e089107eb52c320309b3ddd2ea2b6e764f74ff09 | Create LeverBox.py | _includes/LeverBox.py | _includes/LeverBox.py | State_Probs = {(9,1,1,1,1,1,1,1,1,1) : 1}
def Modified_State(State,Indexes):
New_State_List = list(State)
for i in Indexes:
New_State_List[i] = 1
New_State = tuple(New_State_List)
return New_State
def Best_Case_Prob_For(State,Sum):
Best_Case_Prob = 0
if Sum < 10 and State[Sum] == 0:
P = Prob_For_State... | Python | 0 | |
2eb090b406a341c3b225e59779d0046cf76efc6c | Add download_feeds.py script | download_feeds.py | download_feeds.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
import boto3
bucketname = 'static.ucldc.cdlib.org'
prefix = 'merritt/'
s3 = boto3.resource('s3')
bucket = s3.Bucket(bucketname)
for obj in bucket.objects.filter(Prefix=prefix):
if obj.key.endswith('.atom'):
print "downloading {}".format(obj.ke... | Python | 0 | |
d5dac116400b60e802eeb2f2b7357ee1f3d91b7e | add SumThreshold and SIR calculation functions | draco/util/rfi.py | draco/util/rfi.py | """Collection of routines for RFI excision.
Functions
=========
.. autosummary::
:toctree:
sumthreshold
sir
sir1d
"""
import numpy as np
from scipy.ndimage import convolve1d
def sumthreshold_py(
data,
max_m=16,
start_flag=None,
threshold1=None,
remove_median=True,
correct_fo... | Python | 0 | |
494c0603c4aedb83852a008fad2139c469b537fd | Rename histograms in memory_benchmark_unittest. | tools/perf/perf_tools/memory_benchmark_unittest.py | tools/perf/perf_tools/memory_benchmark_unittest.py | # Copyright (c) 2013 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.
from perf_tools import memory_benchmark
from telemetry.page import page_benchmark_unittest_base
class MemoryBenchmarkUnitTest(
page_benchmark_unittest_... | # Copyright (c) 2013 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.
from perf_tools import memory_benchmark
from telemetry.page import page_benchmark_unittest_base
class MemoryBenchmarkUnitTest(
page_benchmark_unittest_... | Python | 0.000056 |
0ea6bab984abee943d93cdfa90273b7a7aabcf8f | add new package : brltty (#15161) | var/spack/repos/builtin/packages/brltty/package.py | var/spack/repos/builtin/packages/brltty/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 Brltty(AutotoolsPackage):
"""BRLTTY is a background process (daemon) providing access to t... | Python | 0 | |
a8c7d9a2ed9462506130157ce5eccad9121013a3 | add new package (#24004) | var/spack/repos/builtin/packages/r-afex/package.py | var/spack/repos/builtin/packages/r-afex/package.py | # Copyright 2013-2021 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 RAfex(RPackage):
"""Analysis of Factorial Experiments
Convenience functions for analy... | Python | 0 | |
2bc7d87c705b038d699309b25eec7ab3df4e9308 | Add example for training text classifier | examples/training/train_textcat.py | examples/training/train_textcat.py | from __future__ import unicode_literals
import plac
import random
import tqdm
from thinc.neural.optimizers import Adam
from thinc.neural.ops import NumpyOps
import thinc.extra.datasets
import spacy.lang.en
from spacy.gold import GoldParse, minibatch
from spacy.util import compounding
from spacy.pipeline import TextCa... | Python | 0.00016 | |
c8cc7f6fe7c0f59697972602773d67b3fde40360 | Add basic filter classes. | penchy/filters.py | penchy/filters.py | class Filter(object):
"""
Base class for filters.
Inheriting classes must implement:
- ``run(*inputs)`` to run the filter on inputs which can be Producer or
Filter instances, after executing self.out has to be set to the
path of the produced output file
"""
def run(self, ... | Python | 0 | |
de3650503eaf2073817b4d35c116a2c076382441 | Create range-module.py | Python/range-module.py | Python/range-module.py | # Time: addRange: O(n)
# removeRange: O(n)
# queryRange: O(logn)
# Space: O(n)
# A Range Module is a module that tracks ranges of numbers.
# Your task is to design and implement the following interfaces in an efficient manner.
# - addRange(int left, int right) Adds the half-open interval [left, righ... | Python | 0.000002 | |
8b95f442f3e78a5f3de539075379b88fc940e818 | add custom settings for momza | casepro/settings_production_momza.py | casepro/settings_production_momza.py | from __future__ import unicode_literals
import os
# import our default settings
from settings_production import * # noqa
# Pods
PODS = [{
'label': "family_connect_registration_pod",
'title': "Registration Information",
'url': os.environ.get('REGISTRATION_URL', ''),
'token': os.environ.get('REGISTRATI... | Python | 0 | |
797249c42c8c1c0d6eda05dbf9e9d16d2706b373 | Add LeNet example with custom scoring and train_samples_per_iteration. | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater.py | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater.py | from __future__ import print_function
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.deepwater import H2ODeepWaterEstimator
def deepwater_lenet():
print("Test checks if Deep Water works fine with a multiclass image dataset")
frame = h2... | Python | 0 | |
26d095d44a02862a4d567537e824170e75930a9a | add email people script | fantasydota/scripts/email_users.py | fantasydota/scripts/email_users.py | from fantasydota import DBSession
from fantasydota.models import User
from pyramid_mailer import Mailer
from pyramid_mailer.message import Message
def email_users():
session = DBSession()
for user in session.query(User).filter(User.email.isnot("")).all():
if user.email:
email = "testemail"... | Python | 0.000003 | |
8cdbbbaf33cd09bc742761ce8cd5b79b185710cd | Introduce a timer based update of activities | webtool/server/management/commands/timer_update.py | webtool/server/management/commands/timer_update.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import io
import datetime
from django.core.management.base import BaseCommand
from server.models import Instruction, Tour, Talk, Session, Season
from server.views.bulletin impo... | Python | 0 | |
eceee762dd3773aacceb52119014dad88e363c8d | Create find_subnets_with_broker.py | python/NetMRI_GUI_Python/find_subnets_with_broker.py | python/NetMRI_GUI_Python/find_subnets_with_broker.py | # BEGIN-SCRIPT-BLOCK
#
# Script-Filter:
# true
#
# END-SCRIPT-BLOCK
from infoblox_netmri.easy import NetMRIEasy
import re
# This values will be provided by NetMRI before execution
defaults = {
"api_url": api_url,
"http_username": http_username,
"http_password": http_password,
"job_id": job_id,
... | Python | 0.000001 | |
c96b885d4446db96402d9770d71012dbcafcb8cf | install go-vcf-tools by manage.py command | pergenie/apps/genome/management/commands/setup_go_vcf_tools.py | pergenie/apps/genome/management/commands/setup_go_vcf_tools.py | import os
import glob
import shutil
import tarfile
import platform
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from lib.utils.io import get_url_content
from lib.utils import clogging
log = clogging.getColorLogger(__name__)
class Command(BaseCommand):
help =... | Python | 0 | |
76fbec63667f3844f2763d72e57e61c07209cdad | Create Meh.py | Meh/Meh.py | Meh/Meh.py | import discord
from discord.ext import commands
class Mycog:
"""My custom cog that does stuff!"""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def mycom(self):
"""This does stuff!"""
#Your code will go here
await self.bot.say("I can do stuff!")
d... | Python | 0.000001 | |
6bbac26ffb6f2131cad62df48b5afa3849ee8276 | add parameter 'force' in method 'init' to reinitialize existing parameters This is useful when creating a new database from a dump (reinitialize database.uuid, etc.) | openerp/addons/base/ir/ir_config_parameter.py | openerp/addons/base/ir/ir_config_parameter.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | Python | 0.000188 |
6693172856655329d99f038d54b1d8819fc1a9b6 | Add native code emitters example. | scripts/examples/02-Board-Control/native_emitters.py | scripts/examples/02-Board-Control/native_emitters.py | import time
@micropython.asm_thumb
def asm():
movw(r0, 42)
@micropython.viper
def viper(a, b):
return a + b
@micropython.native
def native(a, b):
return a + b
print(asm())
print(viper(1, 2))
print(native(1, 2))
| Python | 0 | |
5cb43fbf0efadff7af68836243eb7e1711e7df1c | Add test_object script | jsk_2015_05_baxter_apc/euslisp/test_object_recognition.py | jsk_2015_05_baxter_apc/euslisp/test_object_recognition.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import rospy
from jsk_2014_picking_challenge.msg import ObjectRecognition
left_result = None
right_result = None
def _cb_left(msg):
global left_result
left_result = dict(zip(msg.candidates, msg.probabilities))
def _cb_right(msg):
global right_result
rig... | Python | 0.000002 | |
f56e86ff774a55e7882957a8928bdca98ce4c3e8 | Add missing migration | features/groups/migrations/0017_auto_20171127_1447.py | features/groups/migrations/0017_auto_20171127_1447.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-27 13:47
from __future__ import unicode_literals
from django.db import migrations, models
import features.stadt.forms
class Migration(migrations.Migration):
dependencies = [
('groups', '0016_auto_20171120_1311'),
]
operations = [
... | Python | 0.0002 | |
afedd723ad85b99c2ebd08246b5ed13b37cd62e9 | make psnr.py | src/psnr.py | src/psnr.py | #
# psnr.py
# Created by pira on 2017/08/05.
#
#coding: utf-8
u"""For PSNR(Peak Signal to Noise Ratio).""" | Python | 0.001547 | |
6472768e2373b7972db5c3033063fd0f0adb2059 | add example of load with input_type='apache-arrow' | examples/groonga_microblog_tutorial/2_load_with_pyarrow.py | examples/groonga_microblog_tutorial/2_load_with_pyarrow.py | from poyonga.client import Groonga
import pyarrow as pa
def _call(g, cmd, **kwargs):
ret = g.call(cmd, **kwargs)
print(ret.status)
print(ret.body)
if cmd == "select":
for item in ret.items:
print(item)
print("=*=" * 30)
def load_and_select(table, data, batch):
# use A... | Python | 0 | |
5bb154f41f25d8c9bbd9067b29a03a5fc2dff371 | Add functional tests for floating IP. | openstack/tests/functional/network/v2/test_floating_ip.py | openstack/tests/functional/network/v2/test_floating_ip.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Python | 0.000116 | |
a5720071a950185e5afb1992dd4b66b47aefc242 | Bump version 0.2.5 | accounting/__init__.py | accounting/__init__.py | import os
# Use 'final' as the 4th element to indicate
# a full release
VERSION = (0, 2, 5)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
# Append 3rd digit if > 0
if VERSION[2]:
version = '%s.%s' % (versi... | import os
# Use 'final' as the 4th element to indicate
# a full release
VERSION = (0, 2, 4)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
# Append 3rd digit if > 0
if VERSION[2]:
version = '%s.%s' % (versi... | Python | 0.000001 |
fa6060a21767a0b5b2b3a10e4301e0c1a30134cb | Test the lit0,cmp before bra eliminator | i8c/tests/test_opt_lit0_cmp_before_bra.py | i8c/tests/test_opt_lit0_cmp_before_bra.py | from i8c.tests import TestCase
SOURCE1 = """\
define test::optimize_cmp_bra_const_const returns ptr
argument ptr x
dup
load NULL
beq return_the_null
deref ptr
return
return_the_null:
"""
SOURCE2 = """\
define test::optimize_cmp_bra_const_const returns ptr
argument ptr x
dup
load ... | Python | 0 | |
7be2721bfcbf3376ddce4d58f2cfe9680803f9bb | Create center_dmenu script. | center_dmenu.py | center_dmenu.py | #!/usr/bin/env python2
from Xlib import display
import sys
from os import system
def get_dimensions():
current_display = display.Display()
current_screen = current_display.screen()
return (current_screen['width_in_pixels'],
current_screen['height_in_pixels'])
def parse_dmenu_args(args):
... | Python | 0 | |
a737c7cd26450ac5dfdab23aea6902f53976c538 | fix version in xformhistory for multiple xml versions | onadata/apps/fsforms/management/commands/fix_xml_version_in_xformhistory.py | onadata/apps/fsforms/management/commands/fix_xml_version_in_xformhistory.py | import os
from onadata.settings.local_settings import XML_VERSION_MAX_ITER
from onadata.apps.fsforms.models import XformHistory
from django.core.management.base import BaseCommand
import re
import datetime
def check_version(instance, n):
for i in range(n, 0, -1):
p = re.compile("""<bind calculate="\'(.*)\'... | Python | 0 | |
3837329e0d49796cfe9eabd2aeb026c206c5c4d8 | add admin ui for user upload record | corehq/apps/user_importer/admin.py | corehq/apps/user_importer/admin.py | import zipfile
from io import BytesIO
from django.contrib import admin
from django.http.response import HttpResponse
from .models import UserUploadRecord
class UserUploadAdmin(admin.ModelAdmin):
list_display = ('domain', 'date_created')
list_filter = ('domain',)
ordering = ('-date_created',)
search... | Python | 0 | |
f8647389c144e9f608f11dc16fb4eb60a7970b13 | add a python file to describe metrics and requirements and testbench manifests and all that stuff and mess | sandbox/jklingler/Examples/Radio/requirements_creation.py | sandbox/jklingler/Examples/Radio/requirements_creation.py | __author__ = 'J'
import json
import random
import uuid
import datetime
class TopLevelRequirementsGroup(object):
def __init__(self):
self.category = True
self.weight_neg = 1.0 # Real [0,1]
self.description = "Full-length, detailed description"
self.weight_pos = 1.0 # Real [0,1]
... | Python | 0 | |
ba5a358ffefb5646a3911fafe2c394c9c52905f7 | add import script for Horsham | polling_stations/apps/data_collection/management/commands/import_horsham.py | polling_stations/apps/data_collection/management/commands/import_horsham.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000227'
addresses_name = 'Democracy_Club__04May2017.tsv'
stations_name = 'Democracy_Club__04May2017.tsv'
elections = ['local.west-sussex.2017-05-04']
... | Python | 0 | |
3d4e3be7624f099f9b15c24a9161f474a733ebff | add a script for manual fixing of user profiles. Now I will fix the bug in the code… | scripts/20130625_fix_userprofile_data_being_unicode_insteadof_dict.py | scripts/20130625_fix_userprofile_data_being_unicode_insteadof_dict.py |
from oneflow.profiles.models import UserProfile
import ast
for p in UserProfile.objects.all():
if type(p.data) == type(u''):
p.data = {}
if type(p.register_request_data) == type(u''):
p.register_request_data = ast.literal_eval(p.register_request_data)
p.save()
| Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.