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
0db094aba5095b63a8f9bfb066afb0048617f87e
add update_GeneAtlas_images.py
scheduled_bots/scripts/update_GeneAtlas_images.py
scheduled_bots/scripts/update_GeneAtlas_images.py
""" One off script to change GeneAtlas images to point to full-sized versions https://github.com/SuLab/GeneWikiCentral/issues/1 As described at https://www.wikidata.org/wiki/Property_talk:P692#How_about_using_full_size_image_instead_of_small_thumbnail.3F update all uses of the Gene Atlas Image property to use the full...
Python
0.000001
427a95f0c56facc138448cde7e7b9da1bcdc8ea4
Add super basic Hypothesis example
add_example.py
add_example.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Unit Tests def test_add_zero(): assert 0 + 1 == 1 + 0 def test_add_single_digits(): assert 1 + 2 == 2 + 1 def test_add_double_digits(): assert 10 + 12 == 12 + 10 # Property-based Test from hypothesis import given import hypothesis.strategies as st @giv...
Python
0.001464
3a4cb29e91008225c057feb3811e93b59f99d941
use flask-mail
application.py
application.py
from flask import Flask from flask.ext.mail import Mail, Message mail = Mail() app = Flask(__name__) app.config.update( MAIL_SERVER='smtp.gmail.com', MAIL_PORT='465', MAIL_USE_SSL=True, MAIL_USERNAME='nokbar@voltaire.sh', MAIL_PASSWORD='H3rpD3rpL0l') mail.init_app(app) @app.rou...
Python
0.000001
21a504dce25a1b22bda27cd74a443af98b24ad14
Add pseudo filter combining pypandoc and panflute
filters/extract_urls.py
filters/extract_urls.py
import io import pypandoc import panflute def prepare(doc): doc.images = [] doc.links = [] def action(elem, doc): if isinstance(elem, panflute.Image): doc.images.append(elem) elif isinstance(elem, panflute.Link): doc.links.append(elem) if __name__ == '__main__': data = pyp...
Python
0
b811bb9e9469a23921f841d4bfe3b52928a83e14
Create b.py
at/abc126/b.py
at/abc126/b.py
read = input s = read() a, b = map(int , [s[:2], s[2:]]) YYMM = False MMYY = False if 1 <= b and b <= 12: YYMM = True if 1 <= a and a <= 12: MMYY = True if YYMM and MMYY : print('AMBIGUOUS') elif YYMM and not MMYY: print('YYMM') elif not YYMM and MMYY: print('MMYY') else : print('NA')
Python
0.000018
32c025a217f7771be94976fda6ede2d80855b4b6
Move things to new units module
pyatmlab/units.py
pyatmlab/units.py
"""Various units-related things """ from pint import (UnitRegistry, Context) ureg = UnitRegistry() ureg.define("micro- = 1e-6 = µ-") # aid conversion between different radiance units sp2 = Context("radiance") sp2.add_transformation( "[length] * [mass] / [time] ** 3", "[mass] / [time] ** 2", lambda ureg, x...
Python
0.000001
50494947bdf7fc8fce50cb5f589c84fd48db4b05
test perm using py.test #1150
login/tests/fixture.py
login/tests/fixture.py
# -*- encoding: utf-8 -*- import pytest from login.tests.factories import ( TEST_PASSWORD, UserFactory, ) class PermTest: def __init__(self, client): setup_users() self.client = client def anon(self, url): self.client.logout() response = self.client.get(url) ...
Python
0
1a98ccfbff406509d9290e76bbdf8edbb862fc1d
Solve orderred dict
python/py-collections-ordereddict.py
python/py-collections-ordereddict.py
from collections import OrderedDict d = OrderedDict() number_of_items = int(input().strip()) for i in range(number_of_items): item, delimeter, price = input().strip().rpartition(" ") price = int(price) if (item in d): previous_total_purchased = d.get(item) next_total_purchased = previous_to...
Python
0.999999
af278f4b5ac93c4dc8407e484b7563c6fdf7c6b5
add bin/autopac.py
bin/autopac.py
bin/autopac.py
#!/usr/bin/env python import ConfigParser import os import re import subprocess import sys CONF_PATH_LIST = [ '~/.autopac.ini', '~/.autopac/autopac.ini', '/etc/autopac.ini', '/etc/autopac/autopac.ini', '/autopac.ini', ] class CommandFailed(Exception): MESSAGE_TMPL = ( ">>> Error occ...
Python
0.000001
fa4155114304d1ebc9e3bb04f546ce7d4708c381
Add simple pipeline
pykit/pipeline.py
pykit/pipeline.py
# -*- coding: utf-8 -*- """ Pipeline that determines phase ordering and execution. """ from __future__ import print_function, division, absolute_import import types cpy = { 'lower_convert': lower_convert, } lower = { } # ______________________________________________________________________ # Execute pipeline...
Python
0.000001
141005c72b1686d73cdc581e9ee8313529e11e4c
Add health check script.
tools/health-check.py
tools/health-check.py
#!/usr/bin/python # Health check script that examines the /status/ URI and sends mail on any # condition other than 200/OK. # Configuration is via environment variables: # * POWERMON_STATUS - absolute URL to /status/ URI # * POWERMON_SMTPHOST - SMTP host name used to send mail # * POWERMON_MAILTO - email addres...
Python
0
210eba35fc4473e626fc58a8e4ea3cdbb6abdc28
add undocumented function to display new messages.
rtv/docs.py
rtv/docs.py
from .__version__ import __version__ __all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE', 'SUBMISSION_FILE', 'COMMENT_EDIT_FILE'] AGENT = """\ desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\ """.format(__version__) SUMMARY = """ Reddit Terminal Viewer is...
from .__version__ import __version__ __all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE', 'SUBMISSION_FILE', 'COMMENT_EDIT_FILE'] AGENT = """\ desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\ """.format(__version__) SUMMARY = """ Reddit Terminal Viewer is...
Python
0
04287120372a6fdb906ed9f27ead4c5f91d5690e
Add a modified version of simple bot
tota/heroes/lenovo.py
tota/heroes/lenovo.py
from tota.utils import closest, distance, sort_by_distance, possible_moves from tota import settings __author__ = "angvp" def create(): def lenovo_hero_logic(self, things, t): # some useful data about the enemies I can see in the map enemy_team = settings.ENEMY_TEAMS[self.team] enemies =...
Python
0
2f7d5f30fd6b6cb430c55b21d7cab75800bcfe97
Add a little hacky highlighter
screencasts/hello-weave/highlight.py
screencasts/hello-weave/highlight.py
import json prompt = 'ilya@weave-01:~$ ' highlight = [ ('weave-01', 'red'), ('weave-02', 'red'), ('docker', 'red'), ('run', 'red'), ('--name', 'red'), ('hello', 'red'), ('netcat', 'red'), ('-lk', 'red'), ('1234', 'red'), ('sudo curl -s -L git.io/weave -o /usr/local/bin/weave', 'red'), ('b4e40e4b...
Python
0.000005
cb958aedf6678872eb21d0214f6d6b759d33deec
Copy in linear function approx from Easy21
hiora_cartpole/linfa.py
hiora_cartpole/linfa.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import itertools import numpy as np import pyrsistent import easy21.core as easy21 LinfaExperience = pyrsistent.immutable( 'feature, theta, E, N0, epsi, alpha, lmbda, p_obs, p_act') def init(lmbda, alpha, feature): """ A...
Python
0
6b4733c213046c7a16bf255cfbc92408e2f01423
Add test for registry model hash
tests/models/test_authenticated_registry_model.py
tests/models/test_authenticated_registry_model.py
import pytest from dockci.models.auth import AuthenticatedRegistry BASE_AUTHENTICATED_REGISTRY = dict( id=1, display_name='Display name', base_name='Base name', username='Username', password='Password', email='Email', insecure=False, ) class TestHash(object): """ Test ``Authenticate...
Python
0
984b8ecd043986877349c6de789842155b8a9fa1
Add own version of compare script
scr_compare_chunks_MK.py
scr_compare_chunks_MK.py
import csv import string from nltk import word_tokenize from sfsf import training_data_factory #from sfsf import sfsf_config from collections import defaultdict, Counter def read_chunk_scores( score_file ): top_chunk_scores = defaultdict(list) bottom_chunk_scores = defaultdict(list) with open(score_file, '...
Python
0
57dc7e58dcfd101c29026c8c07763cba2eb7dd14
add helper script to inspect comments on released content
scripts/show_comments.py
scripts/show_comments.py
#!/usr/bin/env python from __future__ import print_function import sys def main(): fs = open(sys.argv[1]).read().splitlines() fs = map(lambda f: {'name':f, 'contents':open(f).readlines()},fs) for f in fs: buffer = '' multiline = 0 is_first = True for i,line in enumerate(f['contents'],start=1): multiline...
Python
0
4b83b7a3d286f60454c96ae609ce18c731339877
add a stub fuse-based fs component
src/fs/nomadfs.py
src/fs/nomadfs.py
#!/usr/bin/env python # # Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> # # 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...
Python
0
4efc50f91d2b141270739ea9f8bef9685cc86e7f
add houdini/shelf/fitcam
houdini/shelf/fitcam.py
houdini/shelf/fitcam.py
# -*- coding: utf-8 -*- import hou import toolutils def setfit(oldCam, resx, resy): oldCam.setDisplayFlag(False) oldCam.parm(oldCam.path() + "/resx").set(resx) oldCam.parm(oldCam.path() + "/resy").set(resy) camups = oldCam.inputAncestors() if camups == (): camu...
Python
0
1886af3e8c96108a8f7bdb320969373e66299bf4
Create __init__.py
python/django_standalone_orm/__init__.py
python/django_standalone_orm/__init__.py
Python
0.000429
f7046ba07a3ec41d26df0b0bce67c6ab8013bfd8
Fix for the activity whose transcripts are stunted
doc/release-scripts/Fix_Transcript_Stunted.py
doc/release-scripts/Fix_Transcript_Stunted.py
''' Issue :Transcript for model comversations stunted Fix : The CSS used for the transcript part is not same as that of the others (which used the toggler CSS). Have made the required changes for the transcripts related to the audio and model conversations which come up on click of answer this in Unit 0 :English...
Python
0.000002
861b7742fd4954e8cf3a1242e8818b9e380acf62
Add Hetzner Cloud Inventory Plugin (#52553)
lib/ansible/plugins/inventory/hcloud.py
lib/ansible/plugins/inventory/hcloud.py
# Copyright (c) 2019 Hetzner Cloud GmbH <info@hetzner-cloud.de> # 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 DOCUMENTATION = r""" name: hcloud plugin_type: inventory aut...
Python
0.000005
88548319d8a7c44d039ce269621f0a9ff4ee8af6
refactor leslie matrix; add leslie_exe.py
poptox/leslie/leslie_exe.py
poptox/leslie/leslie_exe.py
import numpy as np import os.path import pandas as pd import sys #find parent directory and import base (travis) parentddir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)) sys.path.append(parentddir) from base.uber_model import UberModel, ModelSharedInputs # print(sys.path) # print(os.path) ...
Python
0.000011
d3d6a6018d55581bf081c93386f6676c8bb105ce
Add module for running the main simulation
simulate.py
simulate.py
import genetic import sys output = sys.stdout def setOutput(out): output = out genetic.setOutput(output) # Test data for a XOR gate testData = ( (0.1, 0.1, 0.9), (0.1, 0.9, 0.9), (0.9, 0.1, 0.9), (0.9, 0.9, 0.1) ) def simulate(): sim = genetic.Simulation(2, 1, testData, 100) sim.simu...
Python
0
2cd1e7fcdf53c312c3db8e6f1d257084a87cccbb
Add migration to update action implementation hashes.
recipe-server/normandy/recipes/migrations/0045_update_action_hashes.py
recipe-server/normandy/recipes/migrations/0045_update_action_hashes.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import hashlib from base64 import b64encode, urlsafe_b64encode from django.db import migrations def make_hashes_urlsafe_sri(apps, schema_editor): Action = apps.get_model('recipes', 'Action') for action in Action.objects.all(): data = a...
Python
0
37a181a987e4974d21c3e043d66e0d65468785aa
Check in io module
contones/io.py
contones/io.py
import multiprocessing import os import uuid from osgeo import gdal import contones.raster def _run_encoder(path, encoder_cls, geom=None): encoder = encoder_cls() with contones.raster.Raster(path) as r: if geom: with r.crop(geom) as cropped: cropped.save(encoder) el...
Python
0
fa349a967f9f1149dc9aae1bab168f7be7436320
Use HTTP/1.1 for memory cache http server.
tools/telemetry/telemetry/core/memory_cache_http_server.py
tools/telemetry/telemetry/core/memory_cache_http_server.py
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import BaseHTTPServer import mimetypes import os import SimpleHTTPServer import SocketServer import sys import zlib class MemoryCacheHTTPRequestHandler(...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import BaseHTTPServer import mimetypes import os import SimpleHTTPServer import SocketServer import sys import zlib class MemoryCacheHTTPRequestHandler(...
Python
0.000076
1253cf2773b510f88b4391e22f0e98b4ef3cdf52
Create serializers.py
templates/root/main/serializers.py
templates/root/main/serializers.py
from django.contrib.auth.models import User from rest_framework import serializers from <%= appName %>.models import Sample class SampleSerializer(serializers.HyperlinkedModelSerializer): owner = serializers.ReadOnlyField(source='owner.username') class Meta: model = Sample fields = ('id', 'created', 'name', 'i...
Python
0.000002
c6015e049ab1ce059298af9147851f9a6a1c1e46
Replace NotImplemented singleton with NotImplementedError exceptin
src/ggrc_workflows/services/workflow_cycle_calculator/one_time_cycle_calculator.py
src/ggrc_workflows/services/workflow_cycle_calculator/one_time_cycle_calculator.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: urban@reciprocitylabs.com # Maintained By: urban@reciprocitylabs.com import datetime from ggrc_workflows.services.workflow_cycle_calculator import ...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: urban@reciprocitylabs.com # Maintained By: urban@reciprocitylabs.com import datetime from ggrc_workflows.services.workflow_cycle_calculator import ...
Python
0.999768
5dc2f523473f4921c3b7f1915966c0ac22b09474
Create package and metadatas
mots_vides/__init__.py
mots_vides/__init__.py
""" Mots-vides """ __version__ = '2015.1.21.dev0' __author__ = 'Fantomas42' __email__ = 'fantomas42@gmail.com' __url__ = 'https://github.com/Fantomas42/mots-vides'
Python
0
02e9602a5723aa3cbe9395290e4c18e439065007
Remove redundant code
numpy/distutils/tests/test_fcompiler.py
numpy/distutils/tests/test_fcompiler.py
from __future__ import division, absolute_import, print_function from numpy.testing import assert_ import numpy.distutils.fcompiler customizable_flags = [ ('f77', 'F77FLAGS'), ('f90', 'F90FLAGS'), ('free', 'FREEFLAGS'), ('arch', 'FARCH'), ('debug', 'FDEBUG'), ('flags', 'FFLAGS'), ('linker_...
from __future__ import division, absolute_import, print_function from numpy.testing import assert_ import numpy.distutils.fcompiler customizable_flags = [ ('f77', 'F77FLAGS'), ('f90', 'F90FLAGS'), ('free', 'FREEFLAGS'), ('arch', 'FARCH'), ('debug', 'FDEBUG'), ('flags', 'FFLAGS'), ('linker_...
Python
0.999999
b9bb7e36977b757a63015ac3af8b538f0c67f16c
add manage.py
manage.py
manage.py
from argparse import ArgumentParser def apply_migrates(args): print('migrate') def make_parser(): parser = ArgumentParser() subparsers = parser.add_subparsers() migrate = subparsers.add_parser('migrate') migrate.set_defaults(func=apply_migrates) return parser if __name__ == '__main__': ...
Python
0.000001
67a3a0050c90c500c0c08a638436799df441c326
Add markov implementation
markov.py
markov.py
from nltk import word_tokenize, pos_tag import numpy import random from copy import deepcopy def compute_transitions(tokens, precondition=lambda token, last_token: True, order=1): last_tokens = [tokens[0]] transitions = dict() # count the occurences of "present | past" for token in tokens[1:]: ...
Python
0
58cb5bde9c658e7b5fc7a7c946951e8abaade5e4
Check against sixtrack in different file
examples/python/test_workflow_footprint/001_checks_against_sixtrack.py
examples/python/test_workflow_footprint/001_checks_against_sixtrack.py
import pickle import numpy as np import pysixtrack import sixtracktools # Load machine with open('line.pkl', 'rb') as fid: pbline = pickle.load(fid) line = pysixtrack.Line.fromline(pbline) # Load particle on CO with open('particle_on_CO.pkl', 'rb') as fid: part_on_CO = pysixtrack.Particles.from_dict( ...
Python
0
8fa7120606e206d08acbad198e253ea428eef584
Add tests for inline list compilation
tests/compiler/test_inline_list_compilation.py
tests/compiler/test_inline_list_compilation.py
import pytest from tests.compiler import compile_snippet, internal_call, STATIC_START, LOCAL_START from thinglang.compiler.errors import NoMatchingOverload, InvalidReference from thinglang.compiler.opcodes import OpcodePopLocal, OpcodePushStatic def test_inline_list_compilation(): assert compile_snippet('list<...
Python
0
142cb17be1c024839cd972071b2f9665c87ed5f1
Update downloadable clang to r338452
third_party/clang_toolchain/download_clang.bzl
third_party/clang_toolchain/download_clang.bzl
""" Helpers to download a recent clang release.""" def _get_platform_folder(os_name): os_name = os_name.lower() if os_name.startswith("windows"): return "Win" if os_name.startswith("mac os"): return "Mac" if not os_name.startswith("linux"): fail("Unknown platform") return "L...
""" Helpers to download a recent clang release.""" def _get_platform_folder(os_name): os_name = os_name.lower() if os_name.startswith("windows"): return "Win" if os_name.startswith("mac os"): return "Mac" if not os_name.startswith("linux"): fail("Unknown platform") return "L...
Python
0
3ddf0f0fead6018b5c313253a0df2165452cfb6e
Add shared babel init code
src/eduid_common/api/translation.py
src/eduid_common/api/translation.py
# -*- coding: utf-8 -*- from flask import request from flask_babel import Babel __author__ = 'lundberg' def init_babel(app): babel = Babel(app) app.babel = babel @babel.localeselector def get_locale(): # if a user is logged in, use the locale from the user settings # XXX: TODO ...
Python
0
7db0b2ea9830ef2dad74b34ab0fd4cd9f5a5eca1
add test/lorenz_example.py: solving the Lorenz system using a custom Python kernel
test/lorenz_example.py
test/lorenz_example.py
# -*- coding: utf-8 -*- # # Usage example: solve the Lorenz system using a custom Python kernel. from __future__ import division, print_function import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.axes3d import Axes3D from pydgq.solver.types import DTYPE from pydgq.solver.galerkin import in...
Python
0.000001
30bca45e1ac9fc6953728950695135b491403215
Add test for logical constant folding.
tests/basics/logic_constfolding.py
tests/basics/logic_constfolding.py
# tests logical constant folding in parser def f_true(): print('f_true') return True def f_false(): print('f_false') return False print(0 or False) print(1 or foo) print(f_false() or 1 or foo) print(f_false() or 1 or f_true()) print(0 and foo) print(1 and True) print(f_true() and 0 and foo) print(f_...
Python
0
5b3863c90d4bc07bbc170fc213b4a4c46b3ddc01
Test setting selinux context on lost+found (#1038146)
tests/formats_test/selinux_test.py
tests/formats_test/selinux_test.py
#!/usr/bin/python import os import selinux import tempfile import unittest from devicelibs_test import baseclass from blivet.formats import device_formats import blivet.formats.fs as fs class SELinuxContextTestCase(baseclass.DevicelibsTestCase): """Testing SELinux contexts. """ @unittest.skipUnless(os.ge...
Python
0
68d620d56625c4c1bd30a30f31840d9bd440b29e
Add find_objects test module
tests/plantcv/test_find_objects.py
tests/plantcv/test_find_objects.py
import cv2 import numpy as np from plantcv.plantcv import find_objects def test_find_objects(test_data): # Read in test data img = cv2.imread(test_data.small_rgb_img) mask = cv2.imread(test_data.small_bin_img, -1) cnt, _ = test_data.load_contours(test_data.small_contours_file) contours, _ = find_o...
Python
0.000002
36033be962fcc3e97d14dd06b42bcd3be52a97c5
Add floting_point.py
parser/sample/floting_point.py
parser/sample/floting_point.py
import logging from lex_tokens import LexToken from ply.yacc import yacc class FloatingPointParser(object): class FloatingPointSyntaxError(Exception): pass def __init__(self, debug=False): if debug: self._log = logging.getLogger('PhysicalDivideCharParser') else: self....
Python
0.000001
be17cf90b06a118d579c0211dd3bc2d45433fb2d
Write unit tests for _handle_long_response
tests/test_handle_long_response.py
tests/test_handle_long_response.py
import context class TestHandleLongResponse(context.slouch.testing.CommandTestCase): bot_class = context.TimerBot config = {'start_fmt': '{:%Y}', 'stop_fmt': '{.days}'} normal_text = "@genericmention: this is generic mention message contains a URL <http://foo.com/>\n@genericmention: this generic mention me...
Python
0.000064
feafe480d651ee6b58a1631f4eb4533f63ea6ad4
Add user tests
tests/api/test_user.py
tests/api/test_user.py
from unittest import mock from groupy.api import user from .base import get_fake_response from .base import TestCase class UserTests(TestCase): def setUp(self): self.m_session = mock.Mock() self.m_session.get.return_value = get_fake_response(data={'id': 'foo'}) self.user = user.User(self....
Python
0.000001
063899021158fe872745b335595b3094db9834d8
Add a test for 'version.
pycket/test/test_version.py
pycket/test/test_version.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Test the version here. # import pytest from pycket.test.testhelper import check_equal EXPECTED_VERSION='6.1.1.8' def test_version(): check_equal('(version)', '"%s"' % EXPECTED_VERSION) # EOF
Python
0.000055
e940963a6372a4de1a4a28eff1854716f47471e5
Add deploy script
conda-recipe/deploy.py
conda-recipe/deploy.py
#!/usr/bin/env python """ Deploy dbcollection to pypi and conda. """ import os import shutil import subprocess # PyPi print('PyPi: Upload sdist...') msg1 = subprocess.run(["python", 'setup.py', 'sdist', 'upload'], stdout=subprocess.PIPE) print('PyPi: Upload bdist_wheel...') msg2 = subprocess.run(["python", 'setup...
Python
0.000001
b52ba28a8315a0cdeda7593d087607f582f77f18
Create __init__.py
model/__init__.py
model/__init__.py
__version__='0.0.0'
Python
0.000429
721720b1f4d63f1368714f764794c8d406e4982d
Add to_data test
tests/test_firebase.py
tests/test_firebase.py
import pytest import linkatos.firebase as fb def test_to_data(): url = 'https://foo.com' data = {'url': 'https://foo.com'} assert fb.to_data(url) == data
Python
0.000004
6bf9fce3bcc3e13ec252f5f858d70e177577c453
add Level 05
pythonchallenge/level_05.py
pythonchallenge/level_05.py
import unittest import requests import logging import re import pickle # Default is warning, it's to suppress requests INFO log logging.basicConfig(format='%(message)s') def solution(): url = "http://www.pythonchallenge.com/pc/def/banner.p" banner = pickle.loads(requests.get(url).text) ret...
Python
0
4b2df28a979312875d5a72a1713f535b0e34a1e6
fix config mocking.
solr/test_solr.py
solr/test_solr.py
# (C) Datadog, Inc. 2010-2016 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) # stdlib import threading import time from types import ListType import unittest import mock # 3p from nose.plugins.attrib import attr import logging # project from aggregator import MetricsAggregator from tests...
# (C) Datadog, Inc. 2010-2016 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) # stdlib import threading import time from types import ListType import unittest # 3p from nose.plugins.attrib import attr # project from aggregator import MetricsAggregator from dogstatsd import Server from jmx...
Python
0
fe37335645993ad10c9902aaaaf0ca2c53912d49
Create Average Movies rating etl
movies_avg_etl.py
movies_avg_etl.py
import pyspark spark = ( pyspark.sql.SparkSession.builder.appName("FromDatabase") .config("spark.driver.extraClassPath", "<driver_location>/postgresql-42.2.18.jar") .getOrCreate() ) # Read table from db using Spark JDBC def extract_movies_to_df(): movies_df = ( spark.read.format("jdbc") ...
Python
0
c95bfb10f87bd0a637d0ad790d484b7957441371
Add WSGI support.
pypi.wsgi
pypi.wsgi
#!/usr/bin/python import sys,os prefix = os.path.dirname(__file__) sys.path.insert(0, prefix) import cStringIO, webui, store, config store.keep_conn = True class Request: def __init__(self, environ, start_response): self.start_response = start_response self.rfile = cStringIO.StringIO(environ['wsg...
Python
0
39313cd933e0038b9a9bfa8b6b4cb50e3707d455
add k_min.py
Algo-1/week2/7-K-Min/k_min.py
Algo-1/week2/7-K-Min/k_min.py
class KMin: # Quick sort @staticmethod def swap(numbers, i, j): temp = numbers[i] numbers[i] = numbers[j] numbers[j] = temp # The last element is a pivot, all smaller elements are to left of it # and greater elements to right @staticmethod def partition(numbers, l,...
Python
0.000104
f44fd9df7ac7fa5e553e99d98c1376439a33ffc8
Change device pull to handle root,and renamed local file as well history.db from results.db
wlauto/workloads/androbench/__init__.py
wlauto/workloads/androbench/__init__.py
# Copyright 2013-2015 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
# Copyright 2013-2015 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
Python
0
f700ca39535c5eb14015dd84f4bc0dad2b086d23
Add ex_fzf.py
examples/ex_fzf.py
examples/ex_fzf.py
#!/usr/bin/env python import string import textwrap import pprint from dynmen import Menu fzf = Menu(command=('fzf',)) exampl_inp_dict = vars(string) exampl_inp_dict = {k:v for k,v in exampl_inp_dict.items() if not k.startswith('_')} def print_obj(obj, prefix=' '): txt = pprint.pformat(obj) lines = [] ...
Python
0.000005
45edceb65a9cac9f61215ad77e9c048d092c0b57
add examples/roster.py
examples/roster.py
examples/roster.py
import dbus import dbus.glib import gobject import sys from account import read_account, connect from telepathy.client.channel import Channel from telepathy.constants import ( CONNECTION_HANDLE_TYPE_CONTACT, CONNECTION_HANDLE_TYPE_LIST, CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_DISCONNECTED) from telepa...
Python
0
7d198f3eaca6a91b731b3e25c0285cd46e72935a
Remove duplicates in authorized origins table
swh/web/common/migrations/0005_remove_duplicated_authorized_origins.py
swh/web/common/migrations/0005_remove_duplicated_authorized_origins.py
# Copyright (C) 2019 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information from __future__ import unicode_literals from django.db import mig...
Python
0.000001
91541cf82f435cb261d9debc85a2a8ae6dd74ab1
Add a function to initialize the logging.
xutils/init_logging.py
xutils/init_logging.py
# encoding: utf-8 from __future__ import print_function, absolute_import, unicode_literals, division import logging def init_logging(logger=None, level="DEBUG", log_file="", file_config=None, dict_config=None): # Initialize the argument logger with the arguments, level and log_file. if logger: fmt = "...
Python
0
507e3bad4e877330eea29675dafb8210ab6bada5
Add tests for file agent
tests/test_agent.py
tests/test_agent.py
""" Tests for a agent. """ import io import os import pytest from onirim import action from onirim import agent from onirim import component def file_agent(in_str): return agent.File(io.StringIO(in_str), open(os.devnull, "w")) def content(): return component.Content([]) @pytest.mark.parametrize( "in_...
Python
0
c67e1af4f765f143cb1b8420e053c1a9f00edd05
Add migrations for new statuses.
course_discovery/apps/course_metadata/migrations/0168_auto_20190404_1733.py
course_discovery/apps/course_metadata/migrations/0168_auto_20190404_1733.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-04-04 17:33 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.manager import djchoices.choices class Migration(migrations.Migration): dependencies = [ ('course_metadata', '0167_auto_20190...
Python
0
d308874989667f36da1638f22d6b2d7e823b5ebd
Add script to extract reads or alignments matching a barcode.
extract-barcode.py
extract-barcode.py
""" code to extract a single cell from a set of alignments or reads marked via Valentine's umis repository: https://github.com/vals/umis """ import regex as re import sys from argparse import ArgumentParser from pysam import AlignmentFile def extract_barcode(sam, barcode): parser_re = re.compile('.*:CELL_(?P<CB>...
Python
0
048d0d7ce30b66af8bf48bcb0cb7f8bfb90fff0c
Add tests for Part, Pin, Bus and Net iterators.
tests/test_iters.py
tests/test_iters.py
import pytest from skidl import * from .setup_teardown import * def test_iters_1(): """Test bus iterator.""" b_size = 4 b = Bus('chplx', b_size) for hi in b: for lo in b: if hi != lo: led = Part('device','LED') hi += led['A'] lo += led...
Python
0
60fbfa0b440a762fd25f19148313f5ba27d619aa
add a testing file
DataStructures/Trees/main.py
DataStructures/Trees/main.py
import BST #Environent for testing BST def main(): print 'Testing' main()
Python
0.000001
00aad4a302518400dbb936c7e2ce1d7560c5762f
Add files via upload
src/que_.py
src/que_.py
class our_queue(object): def __init__(self): """initializes queue""" self.head = self self.tail = self self.next_node = None self.data = None self.size = 0 def enqueue(self, val): """creates new node, pushes it to bottom of the queue and makes it the tail...
Python
0
ccc663b3a96268dcdf2256d461a11d845a1044a1
Add the original test case of bug #1469629, formatted according to local conventions.
Lib/test/leakers/test_dictself.py
Lib/test/leakers/test_dictself.py
'''Test case for "self.__dict__ = self" circular reference bug (#1469629)''' import gc class LeakyDict(dict): pass def leak(): ld = LeakyDict() ld.__dict__ = ld del ld gc.collect(); gc.collect(); gc.collect()
Python
0
994a956486ff94ea777aa300270ae065d2ea62c6
Add a script to send the contents of newly created files to STDOUT or a TCP/IP socket
samson/scripts/file_monitor.py
samson/scripts/file_monitor.py
#!/usr/bin/python # -*- encoding: utf-8 -*- # Telefónica Digital - Product Development and Innovation # # THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, # EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR ...
Python
0
ceaabf80649a8a83c6ddfc548a3fa369c973e5c6
Complete alg fizzbuzz
alg_fizzbuzz.py
alg_fizzbuzz.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function def fizzbuzz(n): ls = [] for i in range(1, n + 1): if i % 15 == 0: ls.append('fizzbuzz') elif i % 3 == 0: ls.append('fizz') elif i % 5 == 0: ls.append('buzz') else: ls.append(i) return l...
Python
0.99999
e670901ebaf7422f7a71f78a3dc94730eba5605b
Add a module full of hinting helpers.
fmn/lib/hinting.py
fmn/lib/hinting.py
""" Helpers for "datanommer hints" for rules. Rules can optionally define a "hint" for a datanommer query. For instance, if a rule has to do with filtering for bodhi messages, then a provided hint could be {'category': 'bodhi'}. This simply speeds up the process of looking for potential message matches in the histor...
Python
0
1d31feb4fadadc377fbb3cf0f18c38f5a8d39aca
disable tray icon when fail
launcher/1.2.0/start.py
launcher/1.2.0/start.py
#!/usr/bin/env python # coding:utf-8 import os, sys current_path = os.path.dirname(os.path.abspath(__file__)) python_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, 'python27', '1.0')) noarch_lib = os.path.abspath( os.path.join(python_path, 'lib', 'noarch')) sys.path.append(noarch_lib) if sy...
#!/usr/bin/env python # coding:utf-8 import os, sys current_path = os.path.dirname(os.path.abspath(__file__)) python_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, 'python27', '1.0')) noarch_lib = os.path.abspath( os.path.join(python_path, 'lib', 'noarch')) sys.path.append(noarch_lib) if sy...
Python
0.000001
719dd9064904d2e94cacd5c9ab349b0658344294
Create weather_proc.py
tmp/weather_proc.py
tmp/weather_proc.py
import argparse from datetime import datetime import numpy as np # timeslot indexing funtion def get_time_index(timestamp): day = int(timestamp.date().day) - 1 slot = int((timestamp.time().hour * 3600 + timestamp.time().minute * 60 + timestamp.time().second) / 600) return day * 144 + slot ap = argparse.Ar...
Python
0.000047
9f2e4aad6d3a4004e80378f44aa178b37dd6da57
add ShellExecError
tpl/errors.py
tpl/errors.py
# -*- coding:utf-8 -*- from gettext import gettext as _ class BaseError(BaseException): ERR_MSG = _('') class ShellExecError(BaseError): ERR_MSG = _('Command exit code not zero. \nExit Code:\n{}.\nOut:\n{}\nErr:\n{}') def __init__(self, exit_code, out, err): self.message = self.ERR_MSG.format(...
Python
0.000001
3d027df005725cbc5dfbba0262b0c52c5392d7f0
Add whoami resource which decodes token and returns user info from token
app/resources/check_token.py
app/resources/check_token.py
from flask import make_response, jsonify from flask_restful import Resource, reqparse, marshal, fields from app.models import User from app.common.auth.token import JWT user_fields = { "id": fields.Integer, "username": fields.String, "created_at": fields.DateTime } class WhoAmIResource(Resource): """...
Python
0
62484ca423d6adfa19a581d7b74472e8475cf817
Create findbro.py
findbro/findbro.py
findbro/findbro.py
# findbro.py v0.1 # Matches Bro logs against a specified list of UIDs # Can run on N number of Bro logs # Performs no error checking # Should only be run on directories that contains only gzip Bro logs # Best way to collect UIDs is via bro-cut and grep # # Josh Liburdi 2016 from os import listdir import sys import gz...
Python
0.000001
f34dabd23faa7d50e507b829e576c1968bdc2d52
Print The Message Happy New Year
src/iterations/exercise3.py
src/iterations/exercise3.py
# Print The Message "Happy new Year" followed by the name of a person # taken from a list for all people mentioned in the list. def print_Happy_New_Year_to( listOfPeople ): for user in listOfPeople: print 'Happy New Year, ', user print 'Done!' def main( ): listOfPeople=['John', 'Mary', 'Luke'] print_Happy_N...
Python
0.000028
67cb63bcb776b1a89d8e96a7b90c02724ef5b0b6
update migrations
sweettooth/extensions/migrations/0005_auto_20190112_1733.py
sweettooth/extensions/migrations/0005_auto_20190112_1733.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.18 on 2019-01-12 17:33 from __future__ import unicode_literals import autoslug.fields from django.db import migrations, models import sweettooth.extensions.models class Migration(migrations.Migration): dependencies = [ ('extensions', '0004_auto_20181216...
Python
0.000023
3aa6ba18655a92753f33622ac80be66eb3b69ff6
Add useful python functions
device_resolutions.py
device_resolutions.py
from math import sqrt import csv def as_orientation(x, y, is_portrait=False): if is_portrait: return (y, x) if x > y else (x, y) else: return (x, y) if x > y else (y, x) def as_portrait(x, y): """Given a dimensions, return that pair in portrait orientation""" return as_orientation(x, y...
Python
0.000043
dad5f0a06dd057eccde5a086c84d5c639bb74ae9
Add back peaks for backwards compatibility with a deprecation warning.
dipy/reconst/peaks.py
dipy/reconst/peaks.py
import warnings w_s = "The module 'dipy.reconst.peaks' is deprecated." w_s += " Please use the module 'dipy.direction.peaks' instead" warnings.warn(w_s, DeprecationWarning) from dipy.direction.peaks import *
Python
0
52a8a0c0def2930667155660c8844bb6836f9ff5
add script for table of orders/country
scripts/country_order_stats.py
scripts/country_order_stats.py
import sqlite3 import pandas as pd TICKET_SALE_START_DATE = '2016-01-01' conn = sqlite3.connect('data/site/p3.db') c = conn.cursor() query = c.execute(""" SELECT ORDER_ID, COUNTRY_ID FROM assopy_orderitem, assopy_order WHERE assopy_orderitem.order_id == assopy_order.id AND assopy_order.created >= date(TICKET_SALE_...
Python
0
696b9d1177d24ca6c455052f15e529f4952196a0
add test
@test/test_lang_with.py
@test/test_lang_with.py
# -*- coding: utf-8 -*- # # Copyright (c) 2018~2999 - Cologler <skyoflw@gmail.com> # ---------- # # ---------- from jasily.lang import with_it, with_objattr, with_objattrs class SomeLock: def __init__(self): self.locked = False def __enter__(self): self.locked = True def __exit__(self, *...
Python
0.000002
791ce2275933f16cf483dad1b16948441292e61c
add hook for google-api-python-client (#3965)
scripts/hooks/hook-pydrive2.py
scripts/hooks/hook-pydrive2.py
from PyInstaller.utils.hooks import copy_metadata datas = copy_metadata("pydrive2") datas += copy_metadata("google-api-python-client")
Python
0
534db68d8f773c459788650590b6585fc0369e19
create a default permission handler for ObjectOwner
apps/Localizr/permissions.py
apps/Localizr/permissions.py
from rest_framework.permissions import IsAuthenticated, SAFE_METHODS class IsObjectOwner(IsAuthenticated): def has_object_permission(self, request, view, obj): if request.method in SAFE_METHODS: return True if hasattr(obj, 'created_by'): return obj.created_by == request.user return False
Python
0
f7d3ca5d537140e07ff95d082f2a78e86bc06604
Add flip
zl/indicators/flip.py
zl/indicators/flip.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Jason Koelker # # 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 ...
Python
0.000053
4cea1c1231da1583fb177e976f473fa52b9ec450
Fix SelectJmes documentation
scrapy/loader/processors.py
scrapy/loader/processors.py
""" This module provides some commonly used processors for Item Loaders. See documentation in docs/topics/loaders.rst """ from scrapy.utils.misc import arg_to_iter from scrapy.utils.datatypes import MergeDict from .common import wrap_loader_context class MapCompose(object): def __init__(self, *functions, **def...
""" This module provides some commonly used processors for Item Loaders. See documentation in docs/topics/loaders.rst """ from scrapy.utils.misc import arg_to_iter from scrapy.utils.datatypes import MergeDict from .common import wrap_loader_context class MapCompose(object): def __init__(self, *functions, **def...
Python
0
e07cc0ea6e56339d117fd5d81c0939b0c658727e
Create cnn.py
Classifying_datasets/Convolutional_Neural_Networks/Convolutional_Neural_Networks/cnn.py
Classifying_datasets/Convolutional_Neural_Networks/Convolutional_Neural_Networks/cnn.py
# Convolutional Neural Network # Part 1 - Building the CNN # Importing the Keras libraries and packages from keras.models import Sequential from keras.layers import Conv2D from keras.layers import MaxPooling2D from keras.layers import Flatten from keras.layers import Dense # Initialising the CNN classifier = Sequent...
Python
0.000003
5199ee1a544b2aa59895a1b22359d6a9adb765a3
Add .prepare-commit-msg.py
.prepare-commit-msg.py
.prepare-commit-msg.py
#!/usr/bin/env python # This script is an optional git hook and will prepend the issue # number to a commit message in the correct format for Github to parse. # # If you wish to use it, create a shortcut to this file in .git/hooks called # 'prepare-commit-msg' e.g. from top folder of your project: # ln -s ../../.pre...
Python
0.000011
ce28c5642c3ab543fc48e2f4f1f0b2f2a62890a2
Add script to extract information for playbook files
src/misc/parse_tool_playbook_yaml.py
src/misc/parse_tool_playbook_yaml.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import argparse import re import yaml def get_revision_number(yaml_content, tool_name): for tool in yaml_content['tools']: if tool["name"] == tool_name: if tool.has_key("revision"): print tool["revision"][0] de...
Python
0
f8ee6bcd2742e1afb2645c5195d84bd9d2db06bb
Create utils.py
functions/utils.py
functions/utils.py
__all__ = ['isProductVersionOK', 'computePixelBlockExtents', 'computeCellSize', 'Projection', 'Trace'] ## ----- ## ----- ## ----- ## ----- ## ----- ## ----- ## ----- ## ----- ## def isProductVersionOK(productInfo, major, minor, build): v = productInfo['major']*1.e+10 +...
Python
0
24c763ead7af8a669ff1055b3f352f513274a47f
Insert a note at a specific position in a linked list
all-domains/data-structures/linked-lists/insert-a-node-at-a-specific-positin-in-a-linked-list/solution.py
all-domains/data-structures/linked-lists/insert-a-node-at-a-specific-positin-in-a-linked-list/solution.py
# https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list # Python 2 """ Insert Node at a specific position in a linked list head input could be None as well for empty list Node is defined as class Node(object): def __init__(self, data=None, next_node=None): self.dat...
Python
0.000001
ea7f1aba46d5dd468635812b3bca435b446b0846
Add test for changeset
tests/commands/test_changeset.py
tests/commands/test_changeset.py
# -*- encoding: utf-8 -*- import mock from awscfncli import cfn from click.testing import CliRunner __author__ = 'ray' __date__ = '1/14/17' def test_cfn_changeset_create(tmpdir): with mock.patch('boto3.client', return_value=mock.Mock()) as mock_client: mock_config = \ """ Stack...
Python
0
db914944615f16c4b170e7dfd428901d5fc29271
Add test for image.fromstring - refs #1805
tests/python_tests/image_test.py
tests/python_tests/image_test.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os, mapnik from timeit import Timer, time from nose.tools import * from utilities import execution_path def setup(): # All of the paths used are relative, if we run the tests # from another directory we need to chdir() os.chdir(execution_path...
Python
0
dedcdaf1a55b08c275af29c535a7ae574b8ee5d2
Add 20150517 question.
LeetCode/number_of_islands.py
LeetCode/number_of_islands.py
""" Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example 1: 11110 11010 11000 00000 Answer: 1 Example 2: ...
Python
0.000001
681c67381eef9384845e0041214011797be6ea03
Create text2hex.py
text2hex.py
text2hex.py
# Program Name : text2hex # Programmer : The Alpha # Credits : Iranpython.blog.ir # Version : 0.91(Beta Version) # Linted By : Pyflakes # Info : text2hex is a simple tool that uses to convert strings to hex. from PyQt4.QtCore import * from PyQt4.QtGui import * import sys import binascii class T...
Python
0.001615
dce13f074187cb95644b0ac3cfd84d1e0649f93c
Fix bytes/str handling in disqus SSO.
mezzanine/generic/templatetags/disqus_tags.py
mezzanine/generic/templatetags/disqus_tags.py
from __future__ import unicode_literals from future.builtins import bytes, int import base64 import hashlib import hmac import json import time from mezzanine import template register = template.Library() @register.simple_tag def disqus_id_for(obj): """ Returns a unique identifier for the object to be use...
from __future__ import unicode_literals from future.builtins import int, str import base64 import hashlib import hmac import json import time from mezzanine import template register = template.Library() @register.simple_tag def disqus_id_for(obj): """ Returns a unique identifier for the object to be used ...
Python
0
913a77592a9f399820cddbc7753c24182ad21639
Add options for plots
src/rnaseq_lib/plot/opts.py
src/rnaseq_lib/plot/opts.py
gene_curves = { 'Curve': {'plot': dict(height=120, width=600, tools=['hover'], invert_xaxis=True, yrotation=45, yaxis='left'), 'style': dict(line_width=1.5)}, 'Curve.Percentage_of_Normal_Samples': {'plot': dict(xaxis=None, invert_yaxis=True), 'style': dic...
Python
0.000001
9fb860e0c5b0ff6e696b8102197c3255f7b2d3d7
The goods
graph_role_deps.py
graph_role_deps.py
#!/usr/bin/python '''Graphs role dependencies in roles/ as a graphviz digraph''' import os import yaml import sys print 'digraph {' for role in os.listdir('./roles'): try: with open('./roles/%s/meta/main.yml' % role) as meta: data = yaml.load(meta) except Exception as exc: print >...
Python
0.998626
fa1e30635f57aaffdc74eaa307b8c74f89bf50ae
add base gender choices object
accelerator_abstract/models/base_gender_choices.py
accelerator_abstract/models/base_gender_choices.py
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from __future__ import unicode_literals from django.db import models from accelerator_abstract.models.accelerator_model import AcceleratorModel GENDER_MALE_CHOICE = "Male" GENDER_FEMALE_CHOICE = "Female" GENDER_CISGENDER_CHOICE = "Cisgender" GENDER_TRANSGENDER_...
Python
0.001809
b55ef35a68305269e8a49a8afcdf46d94d06361f
add drf module
src/common/drf.py
src/common/drf.py
from rest_framework.exceptions import APIException class ServiceUnavailable(APIException): status_code = 503 default_detail = 'Service temporarily unavailable, try again later.' default_code = 'service_unavailable'
Python
0.000001
cdfee7e893564157e2143f20dea0b10c8bd33cfb
Create pythonLock.py
ving2/pythonLock.py
ving2/pythonLock.py
from threading import Thread from threading import Lock i = 0 def someThreadFunction1(lock): # Potentially useful thing: # In Python you "import" a global variable, instead of "export"ing it when you declare it # (This is probably an effort to make you feel bad about typing the word "global") global i ...
Python
0.00002
c894e509f14cd671eaa49a5d6608bf773a8838c2
Create updaterepo.py
updaterepo.py
updaterepo.py
from os import system as s # s will serve as an easy way to send a command to the system from os import path, remove, listdir import hashlib, shutil, ftplib, gnupg news = listdir('/REPODIRECTORY/new') # Taking inventory of all new packages, placed in a "/new" directory for entry in news: enpath = '/REPODIRECTORY/new/...
Python
0