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
83ba0ea1ea11316c0fe6f7d6d82b1791c7757e2d
Put kind string in message instead of Directive object.
src/ggrc/converters/sections.py
src/ggrc/converters/sections.py
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: dan@reciprocitylabs.com # Maintained By: dan@reciprocitylabs.com from .base import * from ggrc.models import Directive, Section from .base_row imp...
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: dan@reciprocitylabs.com # Maintained By: dan@reciprocitylabs.com from .base import * from ggrc.models import Directive, Section from .base_row imp...
Python
0
34f2e6066bb44697636f72bb416e200145878a42
Add script for generating TestRun index (#74)
util/generate_testrun_index.py
util/generate_testrun_index.py
#!/usr/bin/python3 # Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
Python
0
c15bf8a018265417400b9948e4b36eb48d40582b
Introduce a very simple vim modeline parser.
pygments/modeline.py
pygments/modeline.py
# -*- coding: utf-8 -*- """ pygments.modeline ~~~~~~~~~~~~~~~~~ A simple modeline parser (based on pymodeline). :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re __all__ = ['get_filetype_from_buffer'] modeline_re = re.compile...
Python
0
9e5fa749cbf797e8646e72a6b54047a9644c8711
add controller file
qaamus/controller.py
qaamus/controller.py
import view import parsers def idar_controller(soup_object, make_soup): data = parsers.IndAraParser(soup_object).get_idar(make_soup) rendered = view.View().render(data) return rendered def angka_controller(soup_object): data = parsers.AngkaParser(soup_object).get_arti_master() rendered = view.View...
Python
0.000001
2e60e02e9fd7cb788e15e61329f36e675f14160f
Create PedidoEditar.py
backend/Models/Sala/PedidoEditar.py
backend/Models/Sala/PedidoEditar.py
from Framework.Pedido import Pedido from Framework.ErroNoHTTP import ErroNoHTTP class PedidoEditar(Pedido): def __init__(self,variaveis_do_ambiente): super(PedidoEditar, self).__init__(variaveis_do_ambiente) try: self.id = self.corpo['id'] self.codigo = self.corpo['codigo'] except: raise ErroNoHTTP(40...
Python
0
b14d24bd3281cab6e3c7f1e810ec50a0de5fa7eb
Add test for working file routes
test/files/test_route_working_files.py
test/files/test_route_working_files.py
from test.base import ApiDBTestCase class TaskLastWorkingFilesTestCase(ApiDBTestCase): def setUp(self): super(TaskLastWorkingFilesTestCase, self).setUp() self.generate_fixture_project_status() self.generate_fixture_project() self.generate_fixture_entity_type() self.genera...
Python
0
23c9fe71f5f35afa54990a8383b5b6a0e75fb847
Add tests for app.main.forms.AdminEmailAddressValidator
tests/app/main/test_form_validators.py
tests/app/main/test_form_validators.py
import mock import pytest from flask.ext.wtf import Form from wtforms.fields.core import Field from wtforms.validators import StopValidation from app.main.forms import AdminEmailAddressValidator @mock.patch('app.main.forms.data_api_client') class TestAdminEmailAddressValidator(object): def setup_method(self): ...
Python
0.000001
27bf7a038257e96b1ceb6b53b0771a38734a8967
sorted(key=') and __call__ method
NEW/one.py
NEW/one.py
""" 1) implementing __call__ method in BingoCage class which gives it a function like properties""" import random words = ['pandas', 'numpy', 'matplotlib', 'seaborn', 'Tenserflow', 'Theano'] def reverse(x): """Reverse a letter""" return x[::-1] def key_len(x): """Sorting a list by their length""...
Python
0.999417
aa5c4fde763467cae63c205df8e4aaf7328ab713
Add 'git cl format' presubmit check to src/device
device/PRESUBMIT.py
device/PRESUBMIT.py
# Copyright 2015 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. """Presubmit script. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit API built into depot_t...
Python
0
c654034a0da8b898dd55b03a895bf0dfdc6257bf
make vector2d hashable
fluent_python/object/vector2d_v2.py
fluent_python/object/vector2d_v2.py
#!/usr/bin/env python # encoding=utf-8 class vector2d(object): def __init__(self, x, y): self.__x = float(x) self.__y = float(y) @property def x(self): return self.__x @property def y(self): return self.__y def __iter__(self): return (i for i in (se...
Python
0.000007
fb3b3d2f9798872742541f7eae2d7b3e2a8a95ab
Add new abstraction with recursion
pygraphc/abstraction/AutoAbstractionRecursion.py
pygraphc/abstraction/AutoAbstractionRecursion.py
import networkx as nx import os from pygraphc.preprocess.CreateGraphModel import CreateGraphModel from pygraphc.clustering.Louvain import Louvain class AutoAbstraction(object): def __init__(self, log_file): self.log_file = log_file self.clusters = [] def __prepare_graph(self, cluster=None): ...
Python
0.000052
80fd2d73f7a206b5b517cb455da457fed9dc6403
Add Rother District Council logo for letters
migrations/versions/0180_another_letter_org.py
migrations/versions/0180_another_letter_org.py
"""empty message Revision ID: 0180_another_letter_org Revises: 0179_billing_primary_const Create Date: 2017-06-29 12:44:16.815039 """ # revision identifiers, used by Alembic. revision = '0180_another_letter_org' down_revision = '0179_billing_primary_const' from alembic import op NEW_ORGANISATIONS = [ ('504', ...
Python
0
1f8dd52b6a40b834d459ea356457429969393339
add migration
meinberlin/apps/cms/migrations/0035_remove_project_block_from_homepage.py
meinberlin/apps/cms/migrations/0035_remove_project_block_from_homepage.py
# Generated by Django 2.2.18 on 2021-02-18 10:01 from django.db import migrations import wagtail.core.blocks import wagtail.core.fields import wagtail.images.blocks class Migration(migrations.Migration): dependencies = [ ('meinberlin_cms', '0034_emailformfield_clean_name'), ] operations = [ ...
Python
0.000002
16e52502bf55075c58022fa35e1673a8a0d5f4bc
Add a test for UnionFind fix.
networkx/utils/tests/test_unionfind.py
networkx/utils/tests/test_unionfind.py
from nose.tools import * import networkx as nx def test_unionfind(): # Fixed by: 2cddd5958689bdecdcd89b91ac9aaf6ce0e4f6b8 # Previously (in 2.x), the UnionFind class could handle mixed types. # But in Python 3.x, this causes a TypeError such as: # TypeError: unorderable types: str() > int() # ...
Python
0
f11957f7b9f60ae1afbaf41fc558b2e600d2822c
Add basic smoketest
openprescribing/frontend/tests/commands/test_infer_practice_boundaries.py
openprescribing/frontend/tests/commands/test_infer_practice_boundaries.py
from django.core.management import call_command from django.test import TestCase from frontend.models import Practice class InferPracticeBoundariesTestCase(TestCase): fixtures = ['orgs', 'practices'] def test_basic_smoketest(self): should_have_boundary = Practice.objects.filter( setting...
Python
0.000002
81f3466990e4161d500a21a1429b14b8de836f0d
Create main.py
main.py
main.py
#!/usr/bin/python import os max_length = 8 # maximum length of a word (words can be < or == ) words = [] # store all words productions = { # production rules "E": ("E+E", "E*E", "(E)", "xI"), "I": ("0I", "1I", "0", "1") } terminals = ['0', '1', 'x', '+', '*', '(', ')'] # generate all possible strings def genera...
Python
0.000001
8ebe878fa4898939f210cf6a6918410781f964a9
Add skeleton NoteBag.py
NoteBag.py
NoteBag.py
#!/usr/bin/python -B # For getting the config file import configparser import os.path from os.path import abspath, dirname, realpath, join as join_path from sys import argv # Widgets from tkinter import Button, Entry, Frame, Label, Listbox, Scrollbar, Tk # Constants from tkinter import BOTH, BOTTOM, END, LEFT, N, S, ...
Python
0
b27b6b79871cbf814a2dd255cf47e6b3281f6dfb
add assert_equal() util function
test/utils.py
test/utils.py
#!/usr/bin/env python3 # Copyright (c) 2017 The lit developers # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. """Utils for lit testing""" def assert_equal(thing1, thing2, *args): if thing1 != thing2 or any(thing1 != arg for a...
Python
0.000098
ff3c5daf69d9ceb8d50bf4243830f816849c9b27
added parser for player connect messsage. non tested
core/parsers/playerenter.py
core/parsers/playerenter.py
from core.workers import Parser class HeartBeatParser(Parser): """parser for message when player enters. typical string = 'Player 76561198056103537/'Shpiler' logged in'""" regexp = '*Player ?P<Id>/\'?P<Id>\' logged in' def on_match(self, line, match_object, *args): print match_object.groupdict()
Python
0.993817
6daea04927ff722f03b66f3d101a2b2a2f9b59be
Create Pokedex.py
Pokedex.py
Pokedex.py
pokedex = { "Bulbasaur" : 1, "Ivysaur" : 2, "Venusaur" : 3, "Charmander" : 4, "Charmeleon" : 5, "Charizard" : 6, "Squirtle" : 7, "Wartortle" : 8, "Blastoise" : 9, "Caterpie" : 10, "Metapod" : 11, "Butterfree" : 12, "Weedle" : 13, "Kakuna" : 14, "Beedrill" : 15, "Pidgey" :...
Python
0.000002
8076a7c88a5aaf9378a7b905593c6401a078879d
Calculate chi angles
cref/structure/sidechain.py
cref/structure/sidechain.py
import math import os import sys from Bio import PDB CHI_COUNT = 5 CHI_ATOMS = [ dict( ARG=['N', 'CA', 'CB', 'CG'], ASN=['N', 'CA', 'CB', 'CG'], ASP=['N', 'CA', 'CB', 'CG'], CYS=['N', 'CA', 'CB', 'SG'], GLN=['N', 'CA', 'CB', 'CG'], GLU=['N', 'CA', 'CB', 'CG'], ...
Python
0.998498
4c7d6aef0805356e02a25e2cc70c167e9db5c509
add new updated (WIP) play.py
play.py
play.py
#!/usr/bin/env python3 # # Play a game. # import sys, os, argparse, logging from raehutils import * class PlayPy: ERR_MATCH = 3 ## __init_logging, run, exit {{{ def __init__(self): retroarch_cores_dir = os.environ.get("HOME") + "/.config/retroarch/cores" games_dir = os.environ.get("HOME")...
Python
0
d168599b9167ede2098aa2fe82375aa95e5ab8b3
Check if hook parameter is passed to the url
dockerpuller/app.py
dockerpuller/app.py
from flask import Flask from flask import request from flask import jsonify import json import subprocess app = Flask(__name__) config = None @app.route('/', methods=['POST']) def hook_listen(): if request.method == 'POST': token = request.args.get('token') if token == config['token']: ...
from flask import Flask from flask import request from flask import jsonify import json import subprocess app = Flask(__name__) config = None @app.route('/', methods=['POST']) def hook_listen(): if request.method == 'POST': token = request.args.get('token') if token == config['token']: ...
Python
0.000001
f5b1038062aae983aea6500ae376ad87d4555c30
allow one-off test runs
tests_once.py
tests_once.py
#!/usr/bin/env python # IATI Data Quality, tools for Data QA on IATI-formatted publications # by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith # # Copyright (C) 2014 Publish What You Fund # # This programme is free software; you may redistribute and/or modify # it under the terms of the GNU Affero Gen...
Python
0
e345aa8deb3f79c100996d445a23d2166fbb2aca
add evolutions
migrations/versions/2f5abd277f57_.py
migrations/versions/2f5abd277f57_.py
"""empty message Revision ID: 2f5abd277f57 Revises: 21d6a9f40991 Create Date: 2017-07-16 22:47:47.460172 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2f5abd277f57' down_revision = '21d6a9f40991' branch_labels = None depends_on = None def upgrade(): # ...
Python
0.999703
0bc0691c7714b7b5885ce2a9c05eb7eb35738c74
Add test for sender_callable check
tests/test_decorators.py
tests/test_decorators.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from webhooks.exceptions import SenderNotCallable from webhooks import webhook, unhashed_hook def test_callable_sender(): @webhook(event="example200", sender_callable=123) def basic(creator="pydanny"): return {"husband": "Daniel Roy Greenf...
Python
0
749c24ee930d44914970b757cfcadb30bb7a1d1c
Prepare for testcase
tests/unit/page_tests.py
tests/unit/page_tests.py
import unittest, os, sys current_dir = os.path.dirname(__file__) base_dir = os.path.join(current_dir, os.pardir, os.pardir) sys.path.append(base_dir)
Python
0
f7273b6e97e6120fe0f3b0a2c9ea5865685608bd
Create client.py
client.py
client.py
"""A slightly smarter telnet client that, if available, supports readline.""" import telnetlib from telnetlib import IAC, WILL, DO, WONT, DONT try: import readline old_readline_callback=readline.get_completer() except ImportError: readline=None def telnet_callback(sock, cmd, option): if option==OPTION...
Python
0.000001
98a2706909a7f880273080fdc7b4e696b6a600aa
Create 04.py
Euler/04.py
Euler/04.py
print(max(a*b for a in range(999, 100, -1) for b in range(999, 100, -1) if str(a*b)==str(a*b)[::-1]))
Python
0
0be1471cd0108ffb61b10b9d6903a949b67868f5
add descast.py and write README
descast.py
descast.py
#!/usr/bin/env/ python # -*-coding: utf-8 -*- import os def get_encoder(): """ エンコーダを取得する。 見つかった場合にはavconvあるいはffmpegの文字列を返す。 見つからなかった場合は0を返す """ exist_ffmpeg=os.access("/usr/bin/ffmpeg",os.R_OK) exist_libav=os.access("/usr/bin/avconv",os.R_OK) if exist_libav and exist_ffmpeg: print "ffmpegとlibav両方が見つかりました。\...
Python
0
e2a9f8ae9378c52bcde06863de3445ae89cca0d0
Create details.py
details.py
details.py
import csv f = open("data.csv") out = open("detail.csv","w") reader = csv.reader(f) for line in reader: if line[0][-1] == ":": out.write(" ".join(line)) f.close() out.close()
Python
0
389aa32dae9635bfc0eff192c9f01ab99e04b0f2
Create main.py
main.py
main.py
#controlling a robot with two motors that can avoid obstacles by using a sonar mounted on pan/tilt servos import motorcontrol, servocontrol, sonarcontrol, auxiliary import time #instantiate objects motor = motorcontrol.MotorControl() servo = servocontrol.ServoControl() sonar = sonarcontrol.SonarControl() aux = auxili...
Python
0.000001
cdbc14e6f78ca7b05e291a007c4267dd55d9b96a
add `enums.py`
todo/enums.py
todo/enums.py
"""Enums are defined here""" from enum import Enum, auto class Status(Enum): """Enum for Task status""" TO_DO = auto() IN_PROGRESS = auto() DONE = auto()
Python
0.000007
34d7758b4a04b6cdc44a763cb1da194d4168b833
Correct expose_by_default interaction with expose_domains (#17745)
homeassistant/components/google_assistant/http.py
homeassistant/components/google_assistant/http.py
""" Support for Google Actions Smart Home Control. For more details about this component, please refer to the documentation at https://home-assistant.io/components/google_assistant/ """ import logging from aiohttp.web import Request, Response # Typing imports from homeassistant.components.http import HomeAssistantVi...
""" Support for Google Actions Smart Home Control. For more details about this component, please refer to the documentation at https://home-assistant.io/components/google_assistant/ """ import logging from aiohttp.web import Request, Response # Typing imports from homeassistant.components.http import HomeAssistantVi...
Python
0
f03079f2fd200d9b726c70acec9cdfd8772adb26
Add support for arm64 as a CR architecture.
tools/cr/cr/base/arch.py
tools/cr/cr/base/arch.py
# Copyright 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. """A module for the basic architectures supported by cr.""" import cr DEFAULT = cr.Config.From( CR_ENVSETUP_ARCH='{CR_ARCH}', ) class Arch(cr.Plugin,...
# Copyright 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. """A module for the basic architectures supported by cr.""" import cr DEFAULT = cr.Config.From( CR_ENVSETUP_ARCH='{CR_ARCH}', ) class Arch(cr.Plugin,...
Python
0.000005
64140f651b22b4b962368a53723cb4bda86651ba
test branch
test.py
test.py
#this is a test file
Python
0.000002
df9122528172c5142160f9804b695d65bd211892
Create QAStats.py
QAStats.py
QAStats.py
# Calculating statistics on Q&A communities. Includes temporal statistics ( for example, how many questions were asked in a period), spatial statistics, number of users, questions, answers.
Python
0
8038e27862f4c128168bd656d9e43880359b1a61
Create Scraper.py
Scraper.py
Scraper.py
import requests from bs4 import BeautifulSoup from time import sleep import datetime import random def RemoveEncodingSignature(string): LocalStringCopy = '' EncodingState = [{'Type': None, 'Active' : False, 'Delimiter' : None, 'StartingIndex': 0}] for Index in range(0, len(string)): if EncodingState[len(Encod...
Python
0
c54d73cc3e6a1e868fa2804e51d6b9247bd4c814
Add player season definition
db/player_season.py
db/player_season.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import timedelta from sqlalchemy import and_ from .common import Base, session_scope class PlayerSeason(Base): __tablename__ = 'player_seasons' __autoload__ = True STD_STATS = [ 'games_played', 'goals', 'assists', 'points', 'p...
Python
0
9add66f49ae0daa28db84e36bf2ac8675125d21c
Remove instructional comments
urls.py
urls.py
from django.conf.urls.defaults import * from django.contrib import admin from django.views.generic.simple import direct_to_template admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^registration/', include('registration.urls')), (r'^$', direct_to_template, ...
from django.conf.urls.defaults import * from django.contrib import admin from django.views.generic.simple import direct_to_template admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^authentic/', include('authentic.foo.urls')), # Uncomment the admin/doc line below and add 'django.contrib.adm...
Python
0
51e368584d59ad2f308f1c9229fbbbf40c504749
Create list.py
list.py
list.py
import argparse import boto.ec2 access_key = '' secret_key = '' def get_ec2_instances(region): ec2_conn = boto.ec2.connect_to_region(region, aws_access_key_id=access_key, aws_secret_access_key=secret_key) reservations = ec2_conn.get_all_reservations() for reservation in res...
Python
0.000003
c0bca49a19e4f97663b9f282bb11768457aec89e
Add example of tycho2 usage
example.py
example.py
# -*- coding: utf-8 -*- """ Created on Sat Oct 21 00:17:33 2017 @author: lauri.kangas """ import matplotlib.pyplot as plt import numpy as np from tycho2 import tycho2 from projections import stereographic, unity import coordinate_transformations as coord index = np.load('tyc2index.npy') catalog = np.load('tyc2....
Python
0
6dc4d2d1e9ef998ff310c14c54586ca694572801
Add extract plugin
extract.py
extract.py
"""This plugin extracts the main content of a webpage""" """e.g. extracting the article of a url of bbc.co.uk""" from utils import add_cmd, add_handler import utils import requests from bs4 import BeautifulSoup name = "extract" cmds = ["extract"] def main(irc): if name not in irc.plugins.keys(): irc.plugins[name]...
Python
0.000001
8c71a177c16762ab50dafe2528d24fab4ccf0925
Add py solution for 462. Minimum Moves to Equal Array Elements II
py/minimum-moves-to-equal-array-elements-ii.py
py/minimum-moves-to-equal-array-elements-ii.py
class Solution(object): def minMoves2(self, nums): """ :type nums: List[int] :rtype: int """ nums.sort() median = nums[len(nums) / 2] return sum(abs(x - median) for x in nums)
Python
0.000163
9cd494f526fa49e04bbdbb31dc6d32f444bbbba8
add a tool to print the content of SEG frames
util/dumpSEGPixelData.py
util/dumpSEGPixelData.py
import pydicom, sys from colorama import Fore, Style, init # colorama init() d = pydicom.read_file(sys.argv[1]) if len(sys.argv)>2: frame = int(sys.argv[2])-1 print("Dumping frame "+str(frame)) else: frame = None print(d.Rows) print(d.Columns) print(d.NumberOfFrames) totalPixels = int(d.Rows*d.Columns*d.Number...
Python
0
ec3ef6e8770b9a36f20a05216d8e0964107a8689
Add a new snippet (Python GTK+3).
python/pygtk/python_gtk3_pygobject/combobox.py
python/pygtk/python_gtk3_pygobject/combobox.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) """ This is the simplest Python GTK+3 snippet. See: http://python-gtk-3-tutorial.readthedocs.org/en/latest/combobox.html "For a simple list of textual choices, the model-view API of Gtk.ComboBox can be a bit ove...
Python
0.000002
5c3589b295c9b9156a6bbfdcecc81754a76f9e0d
Create url-logger.py
url-logger.py
url-logger.py
from datetime import datetime import hexchat import os import re __module_name__ = "URL Logger" __module_author__ = "Poorchop" __module_version__ = "0.1" __module_description__ = "Log URLs from specific channels and PMs to disk" # channels PMs watched_channels = ("#hexchat", "TingPing") event...
Python
0.000017
0fef4f88aa37b221947a22c91a0c5bfe636fcaf1
Test for adjointness of new point grid models.
radarmodel/tests/test_pointgrid_adjointness.py
radarmodel/tests/test_pointgrid_adjointness.py
# ---------------------------------------------------------------------------- # Copyright (c) 2015, 'radarmodel' developers (see AUTHORS file) # All rights reserved. # # Distributed under the terms of the BSD 3-Clause ("BSD New") license. # # The full license is in the LICENSE file, distributed with this software. # -...
Python
0
2206ec50a5645f3dbcb905f0eae90e9f4b1e5262
Change compare condition
platformio/builder/scripts/ststm32.py
platformio/builder/scripts/ststm32.py
# Copyright (C) Ivan Kravets <me@ikravets.com> # See LICENSE for details. """ Builder for ST STM32 Series ARM microcontrollers. """ import platform from os.path import isfile, join from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, DefaultEnvironment, Exit, SConscript...
# Copyright (C) Ivan Kravets <me@ikravets.com> # See LICENSE for details. """ Builder for ST STM32 Series ARM microcontrollers. """ import platform from os.path import isfile, join from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, DefaultEnvironment, Exit, SConscript...
Python
0.000001
3c4c06607eb14920cf4b9d0e4fb6d29f37d1d0ec
Add db_add.py, adding a post from a file, with tags from the filename.
db_add.py
db_add.py
#!/usr/bin/env python # -*- coding: iso-8859-1 -*- from sys import argv, exit from dbclient import dbclient from hashlib import md5 import Image from cStringIO import StringIO from pyexiv2 import Image as ExivImage from os.path import basename if len(argv) < 2: print "Usage:", argv[0], "filename [filename [..]]" ex...
Python
0
6cd009e676e38df886f99555023ad8766e60391c
Create configurator.py
dev/configurator.py
dev/configurator.py
#!/usr/bin/python3 import os import sys import json from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import urlparse, parse_qs BASEDIR = "." LISTENIP = "0.0.0.0" LISTENPORT = 3218 class Node: def __init__(self, id, text, parent): self.id = id self.text = text se...
Python
0.000001
7570e757e79c29974afffeee036f056328a06fe9
Create pull.py
pull.py
pull.py
It's a file to try my first pull derective
Python
0.000001
5d38ab06fd014241cba7e8cdcfed9887a92460b9
Add smoke tests aperiodic
neurodsp/tests/test_aperiodic_dfa.py
neurodsp/tests/test_aperiodic_dfa.py
"""Tests for fractal analysis using fluctuation measures.""" from neurodsp.tests.settings import FS from neurodsp.aperiodic.dfa import * ################################################################################################### ################################################################################...
Python
0.000013
3628c21841eea385dbc13e0065ab41138cf102a6
Add users to the admin
djangae/contrib/auth/admin.py
djangae/contrib/auth/admin.py
from django.contrib import admin from djangae.contrib.auth.models import User admin.site.register(User)
Python
0
e506a059369b089cb4c163669a04fbb9d05e9884
add minimal FBO example
examples/minimalframebufferexample.py
examples/minimalframebufferexample.py
from scipy.misc import imsave from glitter import ShaderProgram, RectangleTexture, Framebuffer, VertexArray from glitter.contexts.glut import GlutWindow, main_loop vertex_shader = """ #version 400 core layout(location=0) in vec4 in_position; void main() { gl_Position = in_position; } """ fragment_shader = """ ...
Python
0.000001
066c48effb2f2c1534e43687d031e01f823f098f
add common mixins
emgapi/viewsets.py
emgapi/viewsets.py
# -*- coding: utf-8 -*- # Copyright 2017 EMBL - European Bioinformatics Institute # # 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 requ...
Python
0.000073
59ccbc17e7e7f4f75b8f95bb1287b676466068db
Create snake1.py
snake1.py
snake1.py
Python
0.000569
cf496298c839e63a786bc8b4a934df09beef93ac
Add script to better log time
bin/log.py
bin/log.py
#!/usr/bin/env python from datetime import date, datetime from pathlib import Path import csv import os import sys if len(sys.argv) != 2: print("Usage: {} 'job to be logged'".format(sys.argv[0])) exit(1) log_dir = "{}/time_logs".format(Path.home()) if not os.path.isdir(log_dir): os.mkdir(log_dir) csv_fi...
Python
0.000001
23be520acaba6e75d67768b0e04de3053f97e964
Add account totals (trade, deposit, withdrawal) example
examples/totals.py
examples/totals.py
""" Summarize deposits, withdrawals, and trade history. """ from decimal import * from datetime import datetime, timedelta from time import mktime from twisted.internet import task, defer from txpoloniex import Poloniex def balancesBTCTotal(balances): btc_values = (Decimal(b['btcValue']) for b in balances.value...
Python
0
addb7f342e5c2bc0f1df19bd6d00d50be23a52da
Add Year
year.py
year.py
months=['January','February','March','April','May','June','July','August','September','October','November','December'] endings=['st','nd','rd']+17*['th']+['st','nd','rd']+7*['th']+['st'] year=raw_input('Year:') month=raw_input('Month(1--12):') day=raw_input('day(1--31):') month_number=int(month) day_number=int(day) mon...
Python
0
286f2d766b3bae5ace03db1b2b87e032be35033b
Create alignment class. Added Guidance2 Sequence filter.
Datasnakes/Orthologs/Align/alignment.py
Datasnakes/Orthologs/Align/alignment.py
from Datasnakes.Orthologs.Align.QualityControl.guidance2 import Guidance2Commandline from Datasnakes.Orthologs.Align.QualityControl.pal2nal import Pal2NalCommandline from Datasnakes.Orthologs.Genbank.genbank import GenBank from Datasnakes.Orthologs.Genbank.utils import multi_fasta_manipulator from Bio.Align.Application...
Python
0
dac398518bac49c6c51d04166c021323cdba9235
Add unit tests.
fdp-api/python/tests/test_metadata.py
fdp-api/python/tests/test_metadata.py
from nose import with_setup from nose.tools import assert_equals, assert_in, assert_true, assert_false from metadata import FAIRConfigReader, FAIRGraph, FDPath from urllib2 import urlparse reader = FAIRConfigReader() def test_paths(): id = 'abc' for resource in ['fdp', 'doc']: assert_equals(FDPath(resour...
Python
0
19c94f3bf71c07763dfddd72b867502d765d01db
Add https://gist.github.com/2349756
sqlite.py
sqlite.py
import scraperwiki from dumptruck import DumpTruck dt = DumpTruck() def execute(sqlquery, data=None, verbose=1): """ Should return list of lists, but returns list of dicts """ return dt.execute(sqlquery, *data, commit=False) # other way [ dict(zip(result["keys"], d)) for d in result["data"] ] def save(u...
Python
0.000461
93ab1a5b364dc7d51e05a8aad2f4beec80029e4c
Create language_helpers.py
WGAN_GP/language_helpers.py
WGAN_GP/language_helpers.py
# # Taken from: https://github.com/igul222/improved_wgan_training # import collections import numpy as np import re def tokenize_string(sample): return tuple(sample.lower().split(' ')) class NgramLanguageModel(object): def __init__(self, n, samples, tokenize=False): if tokenize: tokenized...
Python
0.003689
07e074e662b33713a266777300354e8953ce3b78
ADD connection class to Azure
plugin/connection.py
plugin/connection.py
from plugin import utils from azure import servicemanagement class AzureConnectionClient(): """Provides functions for getting the Azure Service Management Service """ def __init__(self): self.connection = None def client(self): """Represents the AzureConnection Client """ ...
Python
0.000001
9ceb4f394c19a74d8cd28698eeb9116cf8099117
add anno
annot_to_densitymap.py
annot_to_densitymap.py
import xml.etree.ElementTree as ET import numpy as np import xmltodict import matplotlib.pyplot as plt #import cv2 xml_data = 'data/Cam253/[Cam253]-2016_4_21_15h_150f/000150.xml' with open(xml_data) as xml_d: doc = xmltodict.parse(xml_d.read()) img = np.zeros((352, 240), np.float32) def add_to_image(image, bbox): ...
Python
0.999998
0b0150ad73c52ea5b23def899edb819bd3318eb1
fix uncaught analytics exception
lbrynet/analytics/api.py
lbrynet/analytics/api.py
import functools import json import logging from requests import auth from requests_futures import sessions from lbrynet.conf import settings from lbrynet.analytics import utils log = logging.getLogger(__name__) def log_response(fn): def _log(future): if future.cancelled(): log.warning('Re...
import functools import json import logging from requests import auth from requests_futures import sessions from lbrynet.conf import settings from lbrynet.analytics import utils log = logging.getLogger(__name__) def log_response(fn): def _log(future): if future.cancelled(): log.warning('Re...
Python
0.000009
8088d7061c24ca78df0c92be6e36edb7deca1dac
Remove print
gargoyle/client/operators/__init__.py
gargoyle/client/operators/__init__.py
import inspect class GetInitArguments(object): def __get__(self, obj, obj_type): args = inspect.getargspec(obj_type.__init__).args return tuple(args[1:]) class Base(object): def __init__(self): pass arguments = GetInitArguments()
import inspect class GetInitArguments(object): def __get__(self, obj, obj_type): print obj_type args = inspect.getargspec(obj_type.__init__).args return tuple(args[1:]) class Base(object): def __init__(self): pass arguments = GetInitArguments()
Python
0.000016
8238d7ad6793f6deef520a46f85d40b0d75d221f
Add placeholder for the parsing code
gpmf/parse.py
gpmf/parse.py
# TODO: Implement GPMF parsing # see https://github.com/gopro/gpmf-parser#gmfp-deeper-dive for format details
Python
0.000002
d7553fd42e3ac0bcdf0ab70468ad314253b64871
Create parse.py
zoom/parse.py
zoom/parse.py
parse(geo, df) : latDict, lonDict = dict(), dict() # identify extreme most latitude and longitude coordinate pairs in each state # save coordinate pair of most extreme points for autozoom for count in range(0,len(usStates['features'])) : if geo['key'] in [code for code in statePctChange['code']...
Python
0
0f7d6f039930324d77dc23315ed3c9bd10c1f0de
Add missing file
util.py
util.py
# # Copyright 2016 Anil Thomas # # 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 t...
Python
0.000006
37dabf1c98407602edda25dbb9c24c17bd84f19a
Add timer to builders
dev/scripts/coolprop_builder_timer.py
dev/scripts/coolprop_builder_timer.py
from __future__ import print_function import urllib, json filehandle = urllib.urlopen('http://www.coolprop.dreamhosters.com:8010/json/builders') jj = json.loads(filehandle.read()) times = [] for key in jj.keys(): filehandle = urllib.urlopen('http://www.coolprop.dreamhosters.com:8010/json/builders/' + key + '/buil...
Python
0
27bbb0dff2ef60008c0bd7615e2607ee8544aeb2
Add files via upload
ageDataOver65_v3.py
ageDataOver65_v3.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 19 23:56:12 2016 @author: CC Using Python 3.5.2; Anaconda 4.2.0; Spyder 3.0.0 Purpose: open a CSV file from https://censusreporter.org/ and recode it with the corresponding JSON file CSV raw data file containing age census data in San Diego: 'acs...
Python
0
b37eae02a69759352652514635616b9bb504b21b
rewritten as a function
ex33-1.py
ex33-1.py
def append_wrapper(n): '''Append the natural numbers up to n to a list and print the last element at the beginning and end of each iteration. Then print the list n -- the upper bound ''' i=0 numbers = [] while i<n: #where we are at the beginning of the iteration print "At the top i is %d" % i numbers.app...
Python
0.999441
45aacb9d0f5f24600d4796cc5194dfbde1c65222
Add map/dist/filter demo
learning-python/ch05/MapExamples.py
learning-python/ch05/MapExamples.py
lst = range(10) ret = map(lambda *i: i, lst, "abcdefg") for item in ret: print(item) students = [ dict(id=0, credits=dict(math=9, physics=6, history=7)), dict(id=1, credits=dict(math=6, physics=7, latin=10)), dict(id=2, credits=dict(history=8, physics=9, chemistry=10)), dict(id=3, credits=dict(ma...
Python
0
efcc5260a8566d41880cddcc54d4f86c8f722153
Add unit test
test/unit_test/test_utility_stats/test_utility_stats.py
test/unit_test/test_utility_stats/test_utility_stats.py
from lexos.processors.analyze import information word_lists = [{"abundant": 40, "actually": 20, "advanced": 15, "alter": 5}, {"hunger": 1, "hunt": 2, "ignore": 3, "illustration": 4, "ink": 5}] file_list = ["file_one.txt", "file_two.txt"] for i in range(len(file_list)): # because the ...
Python
0.000001
7dc489b393ba293db5cc72c2f9b2bd65d6fe1166
add command to migrate sheet.
upload/management/commands/import_transaction.py
upload/management/commands/import_transaction.py
import csv from django.contrib.auth.models import User from opencivicdata.models import Jurisdiction, Division from upload.backend.parser import import_stream, people_to_pupa from upload.backend.importer import do_import from upload.models import SpreadsheetUpload from django.core.management.base import BaseCommand, C...
Python
0
35a0832ab372b9519ed7391e166ef8c25456a005
Bump minor version
pygerduty/version.py
pygerduty/version.py
version_info = (0, 28, 2) __version__ = '.'.join(str(v) for v in version_info)
version_info = (0, 28, 1) __version__ = '.'.join(str(v) for v in version_info)
Python
0
7b34a2cc6c8124629ee11a5782a8d9005f80e4b1
Create downloader-v0.22.py
downloader-v0.22.py
downloader-v0.22.py
import urllib2 import re import os def stahniHtml(url): f = urllib2.urlopen(url) obsah = f.read() f.close() return obsah def nahled(url): global chapter global currpatch1 odkazy = vyberodkazux(url) for odkaz in odkazy: currpatch1 = odkaz.replace("index.html", "") chapte...
Python
0
b9245a8acf0bed7e19f709490c4ba3788028da93
Fix error in PoolStatusEntry model
server/ec2spotmanager/migrations/0003_auto_20150504_1440.py
server/ec2spotmanager/migrations/0003_auto_20150504_1440.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('ec2spotmanager', '0002_instancestatusentry_poolstatusentry'), ] operations = [ migrations.RemoveField( model_nam...
Python
0.000001
d05bdc1a3a343184a02ec12b734a110140e94829
add persistent decorator of class
server/Mars/ServerUtils/PersistentDecorator.py
server/Mars/ServerUtils/PersistentDecorator.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright (c) 2016 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyrig...
Python
0.000001
2f0b290d64aa1f85b60dfce99c39de49f095cbbd
Add script to warn users about imepending deletion
python/warn_purge.py
python/warn_purge.py
#!/usr/bin/env python # Copyright 2016 University of Chicago # Licensed under the APL 2.0 license import argparse import getpass import os import subprocess import sys import logging from email.mime.text import MIMEText import psycopg2 import shutil PARAM_FILE_LOCATION = "/etc/freesurfer/db_info" FREESURFER_BASE = '...
Python
0
7adbfdf409a81a1462073fa97eb3860523e71a13
Add python lib for queries.
python/xena_query.py
python/xena_query.py
""" Utilities for xena queries. A basic query example. Queries are scheme expressions. >>> import xena_query as xena >>> xena.post("https://genome-cancer.ucsc.edu/proj/public/xena", "(+ 1 2)") '3.0' >>> xena.post("https://genome-cancer.ucsc.edu/proj/public/xena", "(let [x 2 y (+ x 3)] (* x y))") '10.0' Looking up s...
Python
0
ee21691294e6bf9aacf0dd8591991c33d30c5159
raise KeyboardInterrupt for backward compatibility
pysnmp/carrier/asyncore/dispatch.py
pysnmp/carrier/asyncore/dispatch.py
# Implements I/O over asynchronous sockets from time import time from sys import exc_info from asyncore import socket_map from asyncore import loop from pysnmp.carrier.base import AbstractTransportDispatcher from pysnmp.error import PySnmpError class AsynsockDispatcher(AbstractTransportDispatcher): def __init__(se...
# Implements I/O over asynchronous sockets from time import time from sys import exc_info from asyncore import socket_map from asyncore import loop from pysnmp.carrier.base import AbstractTransportDispatcher from pysnmp.error import PySnmpError class AsynsockDispatcher(AbstractTransportDispatcher): def __init__(se...
Python
0.000001
98bd10cdf2c380b17c16a47a8f962dc384b3a18d
Solve py set discard remove pop
python/py-set-discard-remove-pop.py
python/py-set-discard-remove-pop.py
num_elements = int(input()) s = set(map(int, input().split())) num_operations = int(input()) for _ in range(num_operations): operation = input().split(" ") if(operation[0] == "pop"): s.pop() else: op, val = operation s.discard(int(val)) print(sum(s))
Python
0.999979
a8db812c5a9822f6ea72bf44134ed2219a2c5c74
Remove print statement.
app/main/views/dashboard.py
app/main/views/dashboard.py
from flask import (abort, render_template, session) from flask_login import login_required from app.main import main from app.main.dao.services_dao import get_service_by_id from app.main.dao import templates_dao from notifications_python_client.errors import HTTPError from app import job_api_client from app.utils impo...
from flask import (abort, render_template, session) from flask_login import login_required from app.main import main from app.main.dao.services_dao import get_service_by_id from app.main.dao import templates_dao from notifications_python_client.errors import HTTPError from app import job_api_client from app.utils impo...
Python
0.000046
f3130bde2704008017e1438bf7d6cb1c0bbf3d61
Create jsonSender.py
jsonSender.py
jsonSender.py
import socket import json import time from distancemeter import get_distance,cleanup # Logstash TCP/JSON Host JSON_PORT = 5959 JSON_HOST = '127.0.0.1' if __name__ == '__main__': try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((JSON_HOST, JSON_PORT)) while True: ...
Python
0.000048
482c79850a943f77034d376c0d8e8682142b705d
Add init
project_management/pmtools/__init__.py
project_management/pmtools/__init__.py
""" Pipeline Management Tools Usage: pm command [options] """ from cement.core import foundation, controller, handler ## Abstract base controller -- for sharing arguments class AbstractBaseController(controller.CementBaseController): class Meta: arguments = [ (['-n', '--dry_run'], dict(help="...
Python
0.085164
d853fba90a8fc784cdb248923cede6166fe91a8f
remove some field that duplicate
netforce_mfg/netforce_mfg/models/stock_barcode.py
netforce_mfg/netforce_mfg/models/stock_barcode.py
# Copyright (c) 2012-2015 Netforce Co. Ltd. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publi...
# Copyright (c) 2012-2015 Netforce Co. Ltd. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publi...
Python
0.000004
ee7f49a39f0a0d3048c0b83c856982d3b34d1701
Create anovaTest.py
anovaTest.py
anovaTest.py
# Importing the required libraries # Note %matplotlib inline works only for ipython notebook. It will not work for PyCharm. It is used to show the plot distributions #%matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import statsmodels.formula.api as smf imp...
Python
0.000004
f1e2ae06784d759b0f6dbfae1424a2de70353ea9
add a module used to call platon (software assigning space groups) on a structure in pymatgen
pymatgen/command_line/platon_caller.py
pymatgen/command_line/platon_caller.py
''' Interface with command line platon http://aflowlib.org/ Only tested on Linux inspired by Shyue's qhull_caller WARNING: you need to have a platon in your path for this to work ''' __author__="Geoffroy Hautier" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "1.0" __maintainer__ = "Geoffroy Hau...
Python
0
6cad2d60857e9d8714f679f68ae4887e58092a57
Add caffe-compute-image-mean.
python2.7/caffe-compute-image-mean.py
python2.7/caffe-compute-image-mean.py
#!/usr/bin/env python2 import sys sys.path.append("/home/bamos/repos/caffe-local/python") import argparse import numpy as np import os import time from caffe.proto import caffe_pb2 from caffe.io import array_to_blobproto from collections import defaultdict from skimage import io if __name__ == '__main__': parse...
Python
0.000002
db2e1a1070e812eaa539b229d128a58a59448317
create hatenablog-post.py
hatenablog-post.py
hatenablog-post.py
#!/usr/bin/env python #coding=utf-8 import sys import datetime import random import hashlib import base64 import requests from chardet.universaldetector import UniversalDetector username = 'username' password = 'API key' blogname = 'yourblogname.hatenablog.com' def main(): if len(sys.argv) != 2: ...
Python
0
8e94da2cf788115a1562db253c96b1932b495ef3
Add script for generating chords, used to make some of the sounds.
make_chord.py
make_chord.py
from collections import OrderedDict from itertools import cycle import sys # build the pitch table note_names = ['A', 'A#/Bb', 'B', 'C', 'C#/Db', 'D', 'D#/Eb', 'E', 'F', 'F#/Gb', 'G', 'G#/Ab'] note_cycle = cycle(note_names) piano = [] onumber = 0 for i in range(1, 89): note = note_cycle.next() if note == 'C'...
Python
0
56bfc977ea1e7b415e699a82459c917c71fe36df
add app.utils module
app/utils.py
app/utils.py
def get_city_by_coordinates(lon, lat): # TODO: determinate city (reverse geocoding...) return "MyCity"
Python
0.000002
2b1500419e97b75c7b5bda9d8e226ed8340edb50
add experimental python proxy
lotwreport.py
lotwreport.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ lotwreport.py: proxy for ARRL LoTW lotwreport.adi web service, which does not support CORS headers and thus cannot be called from a script that is loaded from any other server. This CGI must be served from the same host name as any script that wishes to call it. Becau...
Python
0.000001
2c387a3674a574bcbfa2ebf5dc32d7987988aef5
Add py-fastavro (#19196)
var/spack/repos/builtin/packages/py-fastavro/package.py
var/spack/repos/builtin/packages/py-fastavro/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 PyFastavro(PythonPackage): """Fastavro for Python.""" homepage = "https://github.com/...
Python
0
e43ffdc6ce35438b188f84ec34855ac3ff5a4722
Create immhook.py
immhook.py
immhook.py
#------------------------------------------------------------------------------- # Name: Immunity debugger Exception Hook # Purpose: The script throws out values of EIP,ESP when a crash exception occours # # Author: darklord # # Created: 19/10/2014 # Copyright: (c) darklord 2014 # Licence: <y...
Python
0.000001
9fa0ae7c14bfa0d352bedd5ab7ea92be7736a485
Create classes.py
classes.py
classes.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import notelib class Student(object): PassedTests = [] score = 0 def __init__(self,name): self.name=name def take_test(self,subject,level): mo = (subject,level) tfiles = ["{}questions.txt{}".format(mo[0],mo[1]), ...
Python
0.000001
466edb19fbf6fcfc51e671a80d45320bd8e1717c
add linode_api
linode_api/View_Network_Transfer.py
linode_api/View_Network_Transfer.py
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import json import math import sys from urllib import parse,request LINODE_ID = '' LINODE_TOKEN_RO = '' def getTransfer(linode_id, argv): url = 'https://api.linode.com/v4/linode/instances/' + linode_id + '/transfer' header_dict = { 'User-Agent': 'Use...
Python
0.000037