commit stringlengths 40 40 | subject stringlengths 1 3.25k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | old_contents stringlengths 0 26.3k | lang stringclasses 3
values | proba float64 0 1 | diff stringlengths 0 7.82k |
|---|---|---|---|---|---|---|---|
c0cd91fe44a2ff653cad9f15a5363d9cc97bfa75 | Add a snippet. | python/astropy/fits/write_binary_table.py | python/astropy/fits/write_binary_table.py | Python | 0.000002 | @@ -0,0 +1,1024 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# Documentation:%0A# - http://docs.astropy.org/en/stable/io/fits/%0A# - http://docs.astropy.org/en/stable/io/fits/api/files.html%0A# - http://www.astropy.org/astropy-tutorials/FITS-tables.html%0A# - http://www.astropy.org/astropy-tutorials/FITS-i... | |
e2e5f3ced06bc7c4a603ad5ff73e6df8690aaa0f | Add top_wikipedia_pages.py. | problem/bench/traffic/top_wikipedia_pages.py | problem/bench/traffic/top_wikipedia_pages.py | Python | 0 | @@ -0,0 +1,1926 @@
+#! /usr/bin/env python%0A%0A# Copyright 2020 John Hanley.%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a%0A# copy of this software and associated documentation files (the %22Software%22),%0A# to deal in the Software without restriction, including without limitation%0... | |
2dee387e43c8d57f7b6f9b291260d8f6dda42bd0 | add measure.py again | measure.py | measure.py | Python | 0.000001 | @@ -0,0 +1,535 @@
+#!/usr/bin/env python3%0A%0Aimport sys%0Aimport collections%0Aimport re%0A%0Atimes = collections.defaultdict(lambda: 0.0)%0Aphis = collections.defaultdict(lambda: 0)%0A%0Afor line in sys.stdin:%0A m = re.match(r'(.*) (%5Cd+%5C.%5Cd+)', line)%0A if m:%0A times%5Bm.group(1)%5D += float(m.g... | |
ada0ef55a543c03d794a8606a13d009ec8bb3b10 | V6.1 ready | c2c_sequence_fy/ir_sequence_installer.py | c2c_sequence_fy/ir_sequence_installer.py | Python | 0.999335 | @@ -0,0 +1,1709 @@
+# -*- coding: utf-8 -*-%0A##############################################################################%0A#%0A# OpenERP, Open Source Management Solution%0A# Copyright (C) 2004-2010 Tiny SPRL (%3Chttp://tiny.be%3E).%0A# Copyright (C) 2010-2010 Camptocamp Austria (%3Chttp://www.camptocamp.at... | |
0f85c62a194eed798af933bd1bfb63a60f935d1a | add .ini and .inc files to string extraction in Silme | tmxmaker.py | tmxmaker.py | #!/usr/bin/python
import os
import sys
import datetime
from optparse import OptionParser
sys.path.append('silme/lib')
import silme.diff
import silme.core
import silme.format
import silme.io
silme.format.Manager.register('dtd', 'properties')
def escape(t):
"""HTML-escape the text in `t`."""
return (t
... | Python | 0 | @@ -237,16 +237,30 @@
perties'
+, 'ini', 'inc'
)%0A%0Adef e
|
ff7f9a09afaf2057d3f926a56c48ad873f6c16f6 | Add missing migration | report/migrations/0002_auto_20151013_2305.py | report/migrations/0002_auto_20151013_2305.py | Python | 0.0002 | @@ -0,0 +1,410 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('report', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
6449632df519113c143de282df38cda7798807fa | Add autoencoder that contains a Layer. | parameter_prediction/models/autoencoder.py | parameter_prediction/models/autoencoder.py | Python | 0 | @@ -0,0 +1,2257 @@
+import numpy as np%0Aimport theano.tensor as T%0Afrom pylearn2.base import Block%0Afrom pylearn2.models import Model%0Afrom pylearn2.space import VectorSpace%0A%0Adef _identity(x):%0A return x%0Adef _rectified(x):%0A return x * (x %3E 0)%0A%0A# Don't put lambda functions in here or pickle will... | |
b154a5cd852ecf7f1e27f012a4a42c5ede307561 | Create zadanie2.py | exercises/zadanie2.py | exercises/zadanie2.py | Python | 0 | @@ -0,0 +1,358 @@
+'''%0APODANA JEST LISTA ZAWIERAJ%C4%84CA ELEMENTY O WARTO%C5%9ACIACH 1-n. NAPISZ FUNKCJ%C4%98 KT%C3%93RA SPRAWDZI JAKICH ELEMENT%C3%93W BRAKUJE%0A%0A1-n = %5B1,2,3,4,5,...,10%5D%0Anp. n=10%0Awej%C5%9Bcie: %5B2,3,7,4,9%5D, 10%0Awyj%C5%9Bcie: %5B1,5,6,8,10%5D%0A'''%0Adef n(lst, max):%0A result = %5B... | |
544907c4222a7c0aead8d35893956ecca79056ba | Add fish-chips example | fish-chips-ketchup.py | fish-chips-ketchup.py | Python | 0.00027 | @@ -0,0 +1,2153 @@
+import numpy as np%0Aimport random%0Afrom neupy import layers, algorithms,plots, init%0Afrom neupy.layers.utils import iter_parameters%0A%0A#Define network.%0Anetwork = layers.Input(3) %3E layers.Linear(1,weight=init.Constant(0),bias=None)%0A%0A#Toggle some debug printing%0Averbose = True %0A%0Aif v... | |
5fccf078c654b69344ded47c2f4c7abddbd52c4d | Add initial profiles | isort/profiles.py | isort/profiles.py | Python | 0 | @@ -0,0 +1,1351 @@
+%22%22%22Common profiles are defined here to be easily used within a project using --profile %7Bname%7D%22%22%22%0A%0Ablack = %7B%0A %22multi_line_output%22: 3,%0A %22include_trailing_comma%22: True,%0A %22force_grid_wrap%22: 0,%0A %22use_parentheses%22: True,%0A%7D%0Adjango = %7B%0A ... | |
a798b23d8dfbf8b415a85a04666466d1605208b5 | add celery app file | tuneme/celery.py | tuneme/celery.py | Python | 0.000001 | @@ -0,0 +1,500 @@
+from __future__ import absolute_import%0A%0Aimport os%0A%0Afrom celery import Celery%0Afrom django.conf import settings%0A%0A# set the default Django settings module for the 'celery' program.%0Aos.environ.setdefault('DJANGO_SETTINGS_MODULE',%0A 'tuneme.settings.production')%0A%0A... | |
192012b57cddec724f73f6ab031b13862db134ef | Create twitterstream.py | twitterstream.py | twitterstream.py | Python | 0.000005 | @@ -0,0 +1,1761 @@
+import oauth2 as oauth%0Aimport urllib2 as urllib%0A%0Aaccess_token_key = %22105782391-kfbeApbulMptbrV9w6Bfh5MHrAiUUqqmd1xmD2az%22%0Aaccess_token_secret = %22fuIwYDPiqTFvfI4jPJVbCWxZBZaL0ESiq4IMD30c1o%22%0A%0Aconsumer_key = %221ANfOmOIRa4iaJideGYAg%22%0Aconsumer_secret = %22MmrodYL5xcpjFrFcG8Y4CAR5P... | |
7b0e3c030e9cf4b1792218ad555eaeda40432283 | add a parallel version LR's roughly architecture | plr/models/parallel_logistic_regression.py | plr/models/parallel_logistic_regression.py | Python | 0 | @@ -0,0 +1,1336 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A%0A%22%22%22%0AThis is a mutil-thread tool to solve common regression problem by logistic regression(hereinafter referred to as LR).%0A%0A%22%22%22%0A%0Afrom abc import ABCMeta, abstractmethod%0Afrom logistic_regression import LogisticRegression%0A%0... | |
f34887b247352d378cb60ceafadec80a17d342f2 | Add LXDDriver config test | nclxd/tests/test_driver_api.py | nclxd/tests/test_driver_api.py | # Copyright 2015 Canonical Ltd
# All Rights Reserved.
#
# 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... | Python | 0 | @@ -622,16 +622,27 @@
cense.%0A%0A
+import os%0A%0A
from nov
@@ -755,23 +755,403 @@
er%0A%0A
-CONF = cfg.CONF
+%0Aclass LXDTestConfig(test.NoDBTestCase):%0A%0A def test_config(self):%0A self.assertIsInstance(driver.CONF.lxd, cfg.ConfigOpts.GroupAttr)%0A self.assertEqual(os.path.abspath('/var/lib/lxd... |
c4eb8c9c7974335cd19f55c2e923a4aac54b3fe2 | add the init file for experiements | experiments/__init__.py | experiments/__init__.py | Python | 0 | @@ -0,0 +1,23 @@
+__all__ = %5B%22episodic%22%5D%0A
| |
8346babc13f90bb809fb52c6bb9b74e374b28db6 | Fix the ETA computation. | oneflow/core/views.py | oneflow/core/views.py | # -*- coding: utf-8 -*-
"""
1flow "core" application. It's an Ember.JS based application, which
explains why we don't have much things here. Everything takes place
in the static/ and templates/ directories.
"""
import os
import logging
import datetime
import humanize
from django.http import HttpResponse... | Python | 0.000611 | @@ -5226,17 +5226,17 @@
reads)
-*
+/
speed))
|
d7ac57998cde8b3778aa53b6e4a378d67fb5eccf | Create find-links_emails.py | python/find-links_emails.py | python/find-links_emails.py | Python | 0.000017 | @@ -0,0 +1,437 @@
+import requests%0Aimport re%0A%0A# get url%0Aurl = input('Enter a URL (include %60http://%60): ')%0A%0A# connect to the url%0Awebsite = requests.get(url)%0A%0A# read html%0Ahtml = website.text%0A%0A# use re.findall to grab all the links%0Alinks = re.findall('%22((http%7Cftp)s?://.*?)%22', html)%0Aema... | |
b5e4805d07ad524a9d2c452780f5f360a068ce90 | add linked list cycle | python/linked_list_cycle.py | python/linked_list_cycle.py | Python | 0.000001 | @@ -0,0 +1,580 @@
+%22%22%22%0AGiven a linked list, determine if it has a cycle in it.%0A%0AFollow up:%0ACan you solve it without using extra space?%0A%0A%22%22%22%0A%0A# Definition for singly-linked list.%0A# class ListNode(object):%0A# def __init__(self, x):%0A# self.val = x%0A# self.next = None%0... | |
13b3320399e51bbbb4018ea5fb3ff6d63c8864c7 | Add quick run script for celex fullscale tests | celexRunScript.py | celexRunScript.py | Python | 0 | @@ -0,0 +1,894 @@
+from celex import Celex%0A'''%0A- Allows for a quick run of a desired size pulled from any evolution file.%0A- Automatically loads the best chromosome from the evolution to test.%0A- Useful for running large-scale tests of a chromosome that appears%0Ato be performing well.%0A- For small tests to ensu... | |
26040edd17b7b1eff3317bbc87aa4548fe27aefa | reset random seed before each scenario | features/environment.py | features/environment.py | Python | 0 | @@ -0,0 +1,74 @@
+import random%0A%0Adef before_scenario(context, scenario):%0A random.seed(0)%0A
| |
ec6d4042f13a641975bbcd2598e76b0cefef0b54 | add extractor.py | fileparser/extractor.py | fileparser/extractor.py | Python | 0.000003 | @@ -0,0 +1,1332 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Ar%22%22%22%0A # .---. .-----------%0A # / %5C __ / ------%0A # / / %5C( )/ ----- (%60-') _ _(%60-') %3C-. (%60-')_%0A # ////// '%5C/ %60 --- ( OO).-/( (OO ).-%3E .-%3E ... | |
c839d8ce8fb6a1f7c7ab0acc3a8840bb3569d27d | Add merge migration | workshops/migrations/0015_merge.py | workshops/migrations/0015_merge.py | Python | 0.000001 | @@ -0,0 +1,283 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('workshops', '0011_person_badges'),%0A ('workshops', '0014_merge'),%0A %5D%0A%0A operation... | |
aa7f40c4451fa5816d456012aec94dff83b784b0 | Add Actual Converter | flac_to_alac_convert.py | flac_to_alac_convert.py | Python | 0 | @@ -0,0 +1,1425 @@
+import os%0D%0Aimport subprocess%0D%0A%0D%0A#this is the default folder it traverses%0D%0Adefault = r'C:%5CUsers%5CMikey%5CMusic%5CThe_Strokes'%0D%0Aprint (%22Default Directory is: %22 + default)%0D%0Arootdir = input(%22Input the Directory (Or leave blank for default directory): %22)%0D%0A%0D%0A#thi... | |
25a4c9ba978aef7f648904c654fcc044f429acd4 | Add Subjects model, methods for report and export | custom/openclinica/models.py | custom/openclinica/models.py | Python | 0 | @@ -0,0 +1,2970 @@
+from collections import defaultdict%0Afrom corehq.apps.users.models import CouchUser%0Afrom custom.openclinica.const import AUDIT_LOGS%0Afrom custom.openclinica.utils import (%0A OpenClinicaIntegrationError,%0A is_item_group_repeating,%0A is_study_event_repeating,%0A get_item_measurement... | |
1068a19af6fc6c5ec7be8d59cc4bb1d76eb40bc7 | add homeassistant-entrypoint.py | homeassistant-entrypoint.py | homeassistant-entrypoint.py | Python | 0.000005 | @@ -0,0 +1,1051 @@
+import os%0Aimport argparse%0Aimport homeassistant.config as config_util%0A%0Afrom homeassistant.const import (%0A __version__,%0A EVENT_HOMEASSISTANT_START,%0A REQUIRED_PYTHON_VER,%0A RESTART_EXIT_CODE,%0A)%0A%0Adef get_arguments() -%3E argparse.Namespace:%0A %22%22%22Get parsed pass... | |
9d2a2b0e1f066b2606e62ec019b56d4659ed86b1 | Add cluster evaluation: adjusted rand index | pygraphc/clustering/ClusterEvaluation.py | pygraphc/clustering/ClusterEvaluation.py | Python | 0.000001 | @@ -0,0 +1,639 @@
+from sklearn import metrics%0A%0A%0Aclass ClusterEvaluation(object):%0A @staticmethod%0A def get_evaluated(evaluated_file):%0A with open(evaluated_file, 'r') as ef:%0A evaluations = ef.readlines()%0A%0A evaluation_labels = %5Bevaluation.split(';')%5B0%5D for evaluation ... | |
b4b8f3554ae569ed42ba261de89e2d186418e71e | add html helper. | dp_tornado/helper/html.py | dp_tornado/helper/html.py | Python | 0 | @@ -0,0 +1,1456 @@
+# -*- coding: utf-8 -*-%0A%0A%0Afrom dp_tornado.engine.helper import Helper as dpHelper%0A%0Atry:%0A # py 2.x%0A import HTMLParser%0A html_parser = HTMLParser.HTMLParser()%0A%0Aexcept:%0A # py 3.4-%0A try:%0A import html.parser%0A html_parser = html.parser.HTMLParser()%0... | |
f06e5a8c701f06d40597cd268a6739988c2fff56 | Add functions for parsing log file | corehq/apps/cleanup/tasks.py | corehq/apps/cleanup/tasks.py | Python | 0.000001 | @@ -0,0 +1,2223 @@
+import os%0Afrom collections import defaultdict%0A%0Afrom django.conf import settings%0Afrom django.core.management import call_command%0A%0Afrom celery.schedules import crontab%0Afrom celery.task import periodic_task%0Afrom datetime import datetime%0A%0Afrom corehq.apps.cleanup.management.commands.... | |
095b9cc5f2e9a87220e6f40f88bf6ecd598ca681 | Add abstract box for ComponentSearch so users can drag it into their workflows. | vistrails/packages/componentSearch/init.py | vistrails/packages/componentSearch/init.py | Python | 0 | @@ -0,0 +1,699 @@
+#Copied imports from HTTP package init.py file%0Afrom PyQt4 import QtGui%0Afrom core.modules.vistrails_module import ModuleError%0Afrom core.configuration import get_vistrails_persistent_configuration%0Afrom gui.utils import show_warning%0Aimport core.modules.vistrails_module%0Aimport core.modules%0A... | |
c3a9d78ca3ffbad0e11192e896db8cd0c2758154 | UPDATE - add migration file | vote/migrations/0002_auto_20160315_0006.py | vote/migrations/0002_auto_20160315_0006.py | Python | 0 | @@ -0,0 +1,400 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('vote', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
23ad5049477c272ca1666f90e73246c4de8e5c48 | Add utility functions for processing partitioned objects | corehq/sql_db/util.py | corehq/sql_db/util.py | Python | 0 | @@ -0,0 +1,3371 @@
+from corehq.form_processor.backends.sql.dbaccessors import ShardAccessor%0Afrom corehq.sql_db.config import partition_config%0Afrom django.conf import settings%0A%0A%0Adef get_object_from_partitioned_database(model_class, partition_value, partitioned_field='pk'):%0A %22%22%22%0A Determines fro... | |
b073397008a07e50b79c7cf97d91765de3fa4fed | add daemon example | library/daemon.py | library/daemon.py | Python | 0 | @@ -0,0 +1,916 @@
+%0Aimport time%0Aimport os%0Aimport sys%0A%0Adef run():%0A while True:%0A print '1time'%0A time.sleep(1)%0A%0Adef daemon():%0A try:%0A pid = os.fork()%0A if pid %3E 0:%0A sys.exit(0)%0A except OSError, e:%0A print 'fork #1 fail', e%0A sys.e... | |
c9cc92c47192132926660efb3416349a5f946a89 | Test for ConversationMessage serializer | yunity/tests/unit/test__api_serializers.py | yunity/tests/unit/test__api_serializers.py | Python | 0 | @@ -0,0 +1,415 @@
+from yunity.api import serializers%0Afrom yunity.models import Conversation as ConversationModel%0Afrom yunity.utils.tests.abc import BaseTestCase, AnyResult%0A%0A%0Aclass TestSerializers(BaseTestCase):%0A def test_chat_with_empty_messages_serializable(self):%0A self.given_data(ConversationM... | |
bddea45a0ddf4efa911aae8af74fb1c78b91b152 | Create max2.py | Code/max2.py | Code/max2.py | Python | 0.000015 | @@ -0,0 +1,176 @@
+#Program to find maximum of 2 numbers%0Awhile 1:%0A%09n,m=map(int, raw_input())%0A%09k = max(m,n)%0A%09print k%0A%09print %22Do you want to continue(yes/no): %22%0A%09s=raw_input()%0A%09if s==%22no%22:%0A%09%09break%0A
| |
25b19d18c75feeb46139898e9a9c270d909e135e | add L4 quiz - Ember Shortcuts and Aliases | lesson4/quizEmberShortcuts/unit_tests.py | lesson4/quizEmberShortcuts/unit_tests.py | Python | 0 | @@ -0,0 +1,1700 @@
+is_correct = False%0A%0Aport_alias = widget_inputs%5B%22check1%22%5D%0Anew_alias = widget_inputs%5B%22check2%22%5D%0Ahelp_alias = widget_inputs%5B%22check3%22%5D%0Agenerate_alias = widget_inputs%5B%22check4%22%5D%0A%0Acomments = %5B%5D%0Adef commentizer(new):%0A if new not in comments:%0A ... | |
9a9ee99129cee92c93fbc9e2cc24b7b933d51aac | Add on_delete in foreign keys. | confirmation/migrations/0001_initial.py | confirmation/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Confirmation',
fields... | Python | 0.000007 | @@ -99,16 +99,49 @@
rations%0A
+import django.db.models.deletion%0A
%0A%0Aclass
@@ -753,16 +753,61 @@
eignKey(
+on_delete=django.db.models.deletion.CASCADE,
to='cont
|
b807fe4e5a2120acb93f8f67ba44fa3c6b7ce92f | Add a benchmark for observation speeds. | pysc2/bin/benchmark_observe.py | pysc2/bin/benchmark_observe.py | Python | 0.004248 | @@ -0,0 +1,2844 @@
+#!/usr/bin/python%0A# Copyright 2018 Google Inc. All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licens... | |
46fdde37823c1c52bd78fc0922ec97a832fc191e | add 031 | python/031_next_permutation.py | python/031_next_permutation.py | Python | 0.999986 | @@ -0,0 +1,1016 @@
+%22%22%22%0AImplement next permutation, which rearranges numbers into the lexicographically%0Anext greater permutation of numbers.%0A%0AIf such arrangement is not possible, it must rearrange it as the lowest%0Apossible order (ie, sorted in ascending order).%0A%0AThe replacement must be in-place, do ... | |
548cd2efbb73e39a3e067cb66d5fc466d797cfb9 | add python dir for random test code that I write | python/context_manager_test.py | python/context_manager_test.py | Python | 0 | @@ -0,0 +1,749 @@
+#!/usr/bin/env python3%0A%0A%22%22%22%0AThis script was used to verify the behaviour of nested context managers in%0Apython 3.%0A%22%22%22%0A%0Aimport tempfile%0Afrom contextlib import contextmanager%0A%0A@contextmanager%0Adef first_manager():%0A print('Entering First Manager')%0A yield%0A p... | |
a394375911b11d06ad5466f45a5fcda4b970febf | Create get_gene_co-ordinates.py | Get_gene_co-ordinates/get_gene_co-ordinates.py | Get_gene_co-ordinates/get_gene_co-ordinates.py | Python | 0.000003 | @@ -0,0 +1,1459 @@
+#!/usr/bin/env python%0A%0A# dealing with command line input%0Aimport argparse%0Aparser = argparse.ArgumentParser()%0Aparser.add_argument(%22-genes%22, type=str)%0Aparser.add_argument(%22-gtf%22, type=str)%0Aargs = parser.parse_args()%0Agenes_filename = args.genes%0Agtf_filename = args.gtf%0A%0A# ma... | |
5fc129f83dc68bb005dea34a61e2bbe1751e2ca3 | add custom module: ec2_placement_group | library/ec2_placement_group.py | library/ec2_placement_group.py | Python | 0.000002 | @@ -0,0 +1,1611 @@
+#!/usr/bin/python%0A%0Aimport sys%0A%0A__arg_spec = None%0Adef get_arg_spec():%0A if __arg_spec is not None: return __arg_spec%0A%0A strats = %5B%22cluster%22%5D%0A states = %5B%22present%22, %22absent%22%5D%0A%0A __ arg_spec = ec2_argument_spec()%0A arg_spec.update(%7B%0A %22n... | |
a182633b03f654f9d8f933aab3c0aa99f8deadd2 | Add alg_bfs.py | alg_bfs.py | alg_bfs.py | Python | 0.000485 | @@ -0,0 +1,230 @@
+from __future__ import absolute_import%0Afrom __future__ import print_function%0Afrom __future__ import division%0A%0Afrom ds_queue import Queue%0A%0A%0Adef breadth_first_search():%0A%09pass%0A%0A%0Adef main():%0A%09pass%0A%0A%0Aif __name__ == '__main__':%0A%09main()%0A
| |
2270317a8abbc288cdb757ba583fed5135317e67 | Add embedding example | embedding-example/main.py | embedding-example/main.py | Python | 0.000002 | @@ -0,0 +1,473 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom __future__ import division, print_function, absolute_import%0Aimport argparse%0Aimport logging%0A%0Alogging.basicConfig(%0A level='DEBUG', format='%25(asctime)s%7C%25(name)s%7C%25(levelname)s%7C%25(message)s')%0Alogger = logging.getLogger(_... | |
714829cb8ecec9edec07b4fce9a3340ee228e77f | Add encoding benchmark | raiden/tests/encoding_speed.py | raiden/tests/encoding_speed.py | Python | 0.000005 | @@ -0,0 +1,1068 @@
+import pytest%0Afrom timeit import timeit%0A%0Asetup = %22%22%22%0Aimport cPickle%0Aimport umsgpack%0Afrom raiden.messages import Ping, decode, MediatedTransfer, Lock, Ack%0Afrom raiden.utils import privtoaddr, sha3%0A%0Aprivkey = 'x' * 32%0Aaddress = privtoaddr(privkey)%0A%0Am0 = Ping(nonce=0)%0Am0... | |
385c46ec48593cd7d3233e0ab7cfca98c321bcf3 | Create 3dproject.py | 3dproject.py | 3dproject.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
a97f7931b597a8c4273fb7e47081f5c1224e1441 | add new module | cno/core/standalone.py | cno/core/standalone.py | Python | 0.000001 | @@ -0,0 +1,1836 @@
+# -*- python -*-%0A#%0A# This file is part of CNO software%0A#%0A# Copyright (c) 2014 - EBI-EMBL%0A#%0A# File author(s): Thomas Cokelaer %3Ccokelaer@ebi.ac.uk%3E%0A#%0A# Distributed under the GPLv3 License.%0A# See accompanying file LICENSE.txt or copy at%0A# http://www.gnu.org/licenses/gp... | |
8c6ce0a8b30bd000687eac9593ecbdc07130bd0e | Add lc739_daily_temperatures.py | lc739_daily_temperatures.py | lc739_daily_temperatures.py | Python | 0.000875 | @@ -0,0 +1,759 @@
+%22%22%22Leetcode 739. Daily Temperatures%0AMedium%0A%0AGiven a list of daily temperatures T, return a list such that, for each day %0Ain the input, tells you how many days you would have to wait until a warmer %0Atemperature. If there is no future day for which this is possible, put 0 %0Ainstead.%0A... | |
7ab0cc93703abf6716b353f38a009897ab154ce4 | Add the plugin framework from common; use and test. | nova/tests/test_plugin_api_extensions.py | nova/tests/test_plugin_api_extensions.py | Python | 0.000015 | @@ -0,0 +1,2869 @@
+# Copyright 2011 OpenStack LLC.%0A# All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/license... | |
19218b0b1f2198c1b0c01594658a3a4cd4dd0444 | Remove no more needed try import | jedihttp/hmac_plugin.py | jedihttp/hmac_plugin.py | # Copyright 2015 Cedraro Andrea <a.cedraro@gmail.com>
# 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... | Python | 0 | @@ -659,187 +659,8 @@
ort%0A
-%0A# XXX(vheon): If I don't do this then some tests are going to fail because%0A# handlers.py could not find utils.py; I don't know why though.%0Atry:%0A import hmaclib%0Aexcept:%0A from .
impo
|
3cdc40906fb055679b0989ee98cb808a741caa12 | Solve challenge 10 | Challenges/chall_10.py | Challenges/chall_10.py | Python | 0.999586 | @@ -0,0 +1,1426 @@
+#!/Applications/anaconda/envs/Python3/bin%0A# Python challenge - 10%0A# http://www.pythonchallenge.com/pc/return/bull.html%0A# http://www.pythonchallenge.com/pc/return/sequence.txt%0A%0A%0Adef main():%0A '''%0A Hint: len(a%5B30%5D) = ?%0A a = %5B1, 11, 21, 1211, 111221,%0A %3Carea shape=... | |
7d92ef550b1b1d649fe460959d823248b72f336e | Add staging settings module | service/settings/staging.py | service/settings/staging.py | Python | 0.000001 | @@ -0,0 +1,110 @@
+from service.settings.production import *%0A%0AALLOWED_HOSTS = %5B%0A 'fantastic-doodle--staging.herokuapp.com',%0A%5D%0A
| |
42c17abdb9e82cc8ce5bdd9cd6ef5c8c4d2c5c5b | Add support for full_width pages | devsitePage.py | devsitePage.py | import os
import re
import yaml
import logging
import markdown
import devsiteHelper
from google.appengine.ext.webapp.template import render
SOURCE_PATH = os.path.join(os.path.dirname(__file__), 'src/content/')
UNSUPPORTED_TAGS = [
r'{% link_sample_button .+%}',
r'{% include_code (.+)%}'
]
def getPage(requestPath,... | Python | 0 | @@ -486,16 +486,47 @@
r(lang)%0A
+ template = 'gae/article.tpl'%0A
fileLo
@@ -4415,24 +4415,300 @@
ath, lang)%0A%0A
+ # Checks if the page should be displayed in full width mode%0A if 'full_width' in md.Meta and len(md.Meta%5B'full_width'%5D) == 1:%0A fullWidth = md.Meta%5B'full_width'%5D%5... |
0aec7900d2ed6aae024df13b4edf32bf21d2c979 | Fix mezzanune_user reference in base blog importer. | mezzanine/blog/management/base.py | mezzanine/blog/management/base.py | """
This is the base importer class for the commands to pull in blogs from
other services into Mezzanine
"""
from datetime import datetime, timedelta
from time import mktime, strftime, strptime, timezone
from optparse import make_option
from xml.dom.minidom import parse, parseString
from django.contrib.auth.models im... | Python | 0 | @@ -3662,25 +3662,16 @@
%22%22%22%0A
- %0A
@@ -3700,16 +3700,16 @@
ptions)%0A
+
%0A
@@ -3896,20 +3896,16 @@
user is
-not
None:%0A
@@ -3918,12 +3918,66 @@
-try:
+raise CommandError(%22No Mezzanine user has been specified%22)
%0A
@@ -3981,24 +3981,29 @@
+try:%0A
... |
27db11c0e2887f3d8b5ae5c95fa602f778f872ba | fix widgets safe_import on python 3.2 | libqtile/widget/__init__.py | libqtile/widget/__init__.py | import logging
import traceback
import importlib
logger = logging.getLogger('qtile')
def safe_import(module_name, class_name):
"""
try to import a module, and if it fails because an ImporError
it logs on WARNING, and logs the traceback on DEBUG level
"""
if type(class_name) is list:
for ... | Python | 0.000033 | @@ -391,16 +391,128 @@
return%0A
+ package = __package__%0A # python 3.2 don't set __package__%0A if not package:%0A package = __name__%0A
try:
@@ -566,27 +566,23 @@
e_name,
-__
package
-__
)%0A
|
4ef62836086ea0c6adb0430af78c75614afaacfd | Create reminders.py | Misc/reminders.py | Misc/reminders.py | Python | 0.000001 | @@ -0,0 +1,446 @@
+#Python reminders - those pesky Gotchas!%0A%0A''.join(list) # Collapse the list%0A%0A%5Ba,b,c,d,e%5D.count(item) #Count occurrences of item in list%0A%0Aa%5B0%5D #put anything in square brackets to search list index%0A%0A#Strange list rotation%0Adef rotate_left3(nums):%0A a = nums%5B0%5D%0A nums%5B... | |
82b06e07348a21d509e2d1865913e2faed864b11 | Add time series analysis | StatusAnalysis.py | StatusAnalysis.py | Python | 0.000003 | @@ -0,0 +1,1186 @@
+import math%0Aimport collections%0A%0Adef analyze_series(series):%0A%09'''%0A%09This is a time series analysis. The input is a list of number, %0A%09and it returns a score showing how normal the potential pattern is.%0A%09We assume the data are normally distributed, and likelihood is %0A%09then used... | |
b23b86265dd952a3bfa1684549ab2087682c9733 | add dispatch namespace | datashape/dispatch.py | datashape/dispatch.py | Python | 0.000001 | @@ -0,0 +1,139 @@
+from multipledispatch import dispatch%0Afrom functools import partial%0A%0Anamespace = dict()%0A%0Adispatch = partial(dispatch, namespace=namespace)%0A
| |
285236e1045915706b0cf2c6137273be7f9eb5d6 | Add generic abstract Module class | modules/module.py | modules/module.py | Python | 0.000001 | @@ -0,0 +1,924 @@
+# module.py%0A# Author: S%C3%A9bastien Comb%C3%A9fis%0A# Version: May 25, 2016%0A%0Afrom abc import *%0A%0Aclass Module(metaclass=ABCMeta):%0A '''Abstract class representing a generic module.'''%0A def __init__(self, name):%0A self.__name = name%0A %0A @property%0A def name(self... | |
66c5f0d6d44c6bf9e72c52864268cf64dddf4b42 | Add metadata reader script | src/main/resources/script_templates/Hadim_Scripts/Metadata/Read_Metadata.py | src/main/resources/script_templates/Hadim_Scripts/Metadata/Read_Metadata.py | Python | 0.000001 | @@ -0,0 +1,273 @@
+# @ImageJ ij%0A%0Afrom io.scif import FieldPrinter%0A%0AfilePath = %22/home/hadim/.data/Test/IM000556.Tif%22%0Aformat = ij.scifio().format().getFormat(filePath)%0A%0Ametadata = format.createParser().parse(filePath)%0A#print(FieldPrinter(metadata))%0A%0AimageMeta = metadata.get(0)%0Aprint(imageMeta)
| |
8587cfb3f36af6f39f54b072a0518e9b81cac850 | add record_wav | pyaudio/record_wav.py | pyaudio/record_wav.py | Python | 0.000023 | @@ -0,0 +1,838 @@
+# !/usr/bin/env python%0A%0A%22%22%22PyAudio example: Record a few seconds of audio and save to a WAVE file.%22%22%22%0A%0Aimport pyaudio%0Aimport wave%0A%0ACHUNK = 1024%0AFORMAT = pyaudio.paInt16%0ACHANNELS = 2%0ARATE = 44100%0ARECORD_SECONDS = 5%0AWAVE_OUTPUT_FILENAME = %22output.wav%22%0A%0Ap = py... | |
245cdcd483f40bbe91e9c9695a73e7ef875d4eb4 | Add harvester for CiteSeerX | scrapi/harvesters/citeseerx.py | scrapi/harvesters/citeseerx.py | Python | 0 | @@ -0,0 +1,661 @@
+'''%0AHarvester for the %22CiteSeerX Scientific Literature Digital Library and Search Engine%22 for the SHARE project%0A%0AExample API call: http://citeseerx.ist.psu.edu/oai2?verb=ListRecords&metadataPrefix=oai_dc%0A'''%0Afrom __future__ import unicode_literals%0A%0Afrom scrapi.base import OAIHarvest... | |
3b25faf6a2e95e3278cde45c04c4adcb50b3659a | add script find_duplicates | scripts/find_duplicate_acts.py | scripts/find_duplicate_acts.py | Python | 0 | @@ -0,0 +1,1835 @@
+#!/usr/bin/env python%0Aimport os%0Aimport datetime as dt%0Afrom collections import defaultdict%0A%0Aif __name__ == %22__main__%22:%0A os.environ.setdefault(%22DJANGO_SETTINGS_MODULE%22, %22calebasse.settings%22)%0A from calebasse.actes.validation import get_days_with_acts_not_locked%0A fro... | |
e110c968ece35e41c467aeb5fceb9274023e7e82 | Create child class for Rainbow bulb | pyplaybulb/rainbow.py | pyplaybulb/rainbow.py | Python | 0 | @@ -0,0 +1,577 @@
+from pyplaybulb.playbulb import Playbulb%0A%0AEFFECT_FLASH = '00'%0AEFFECT_PULSE = '01'%0AEFFECT_RAINBOW = '02'%0AEFFECT_RAINBOW_FADE = '03'%0A%0Aclass Rainbow(Playbulb):%0A hexa_set_colour = '0x001b'%0A hexa_effect = '0x0019'%0A hexa_get_colour = '0x0019'%0A%0A def set_colour(self, colou... | |
c2a2bb683df9f86fefadace4a0375e696b8c06d9 | add up2difiles | python/up2diffiles.py | python/up2diffiles.py | Python | 0.000002 | @@ -0,0 +1,400 @@
+#!/usr/bin/python%0A%0Alines = None%0A%0Awith open('ftp-betterdefaultpasslist.txt', 'r') as f: lines=f.readlines()%0A%0Afor line in lines: %0A user,pwd = line.split(':') %0A print(user, pwd) %0A%0Afor line in lines: %0A user,pwd = line.split(':') %0A with open('users.txt', 'w') as f: %0A ... | |
e233352d5016c2b57ec4edbc4366ca4347bc1d98 | Create a single script to run the three demo services | demo/start_servers.py | demo/start_servers.py | Python | 0 | @@ -0,0 +1,1049 @@
+%22%22%22%0Astart_servers.py%0A%0A%3CPurpose%3E%0A A simple script to start the three cloud-side Uptane servers:%0A the Director (including its per-vehicle repositories)%0A the Image Repository%0A the Timeserver%0A%0A To run the demo services in non-interactive mode, run:%0A python sta... | |
d45ac0f452f109811ddc5577be84c32036cfbbff | 1094. Car Pooling | LeetCode/CarPooling.py | LeetCode/CarPooling.py | Python | 0.99929 | @@ -0,0 +1,747 @@
+# idea: Convert each interval into 2 points, one adding passengers and one removing, go through list and see if it ever goes over capacity.%0A%0Aclass Solution:%0A def carPooling(self, trips: List%5BList%5Bint%5D%5D, capacity: int) -%3E bool:%0A trip_points = %5B%5D%0A for trip in tr... | |
71af3a9b46094d94eb47e662cd30726140213de5 | Read graph. | algo_pathfinding/graph_input.py | algo_pathfinding/graph_input.py | Python | 0.000001 | @@ -0,0 +1,155 @@
+def read_graph(path_file):%0A graph = %7B%7D%0A with open(path_file, 'r') as f:%0A data = f.read()%0A graph_data = eval(data)%0A return graph_data
| |
ca9144c68d0c5fe08a109f26f595f3c7f0b6500d | Add errors.py and FontmakeError | Lib/fontmake/errors.py | Lib/fontmake/errors.py | Python | 0.000001 | @@ -0,0 +1,92 @@
+%0Aclass FontmakeError(Exception):%0A %22%22%22Base class for all fontmake exceptions.%22%22%22%0A pass%0A
| |
294aee87691857636cb433a800a85f395e359fcb | Add gallery example for grdview (#502) | examples/gallery/grid/grdview_surface.py | examples/gallery/grid/grdview_surface.py | Python | 0 | @@ -0,0 +1,1366 @@
+%22%22%22%0APlotting a surface%0A------------------%0A%0AThe :meth:%60pygmt.Figure.grdview()%60 method can plot 3-D surfaces with %60%60surftype=%22s%22%60%60. Here,%0Awe supply the data as an :class:%60xarray.DataArray%60 with the coordinate vectors %60%60x%60%60 and%0A%60%60y%60%60 defined. Note t... | |
1058ed0847d151246299f73b325004fc04946fa0 | Set 1 - Challenge 2 | Basics/challenge_2.py | Basics/challenge_2.py | Python | 0.003614 | @@ -0,0 +1,171 @@
+#!/usr/bin/env python%0A%0Aif __name__ == '__main__':%0A s1 = 0x1c0111001f010100061a024b53535009181c%0A s2 = 0x686974207468652062756c6c277320657965%0A%0A print(hex(s1 %5E s2))%0A
| |
2c30746908108aaeea40f5bf8511e0a1f343e1d9 | Create mapoon.py | ideasbox/conf/mapoon.py | ideasbox/conf/mapoon.py | Python | 0.000001 | @@ -0,0 +1,2674 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Mapmoon box in Australia%22%22%22%0Afrom .base import * # noqa%0Afrom django.utils.translation import ugettext_lazy as _%0A%0AIDEASBOX_NAME = u%22Mapoon%22%0ACOUNTRIES_FIRST = %5B'AU'%5D%0ATIME_ZONE = 'Australia/Darwin'%0ALANGUAGE_CODE = 'en'%0AMONITORING_ENTRY_EX... | |
ea3dca7a2fb203d639b2eba74f21f95b24fecfbc | Create sdfdfdf.py (#13) | sdfdfdf.py | sdfdfdf.py | Python | 0.000001 | @@ -0,0 +1,10 @@
+efefefdsf%0A
| |
9f6572a9ea20cdeaeba93c4029b5409966d25535 | add a reboot example | examples/reboot/reboot.py | examples/reboot/reboot.py | Python | 0.000002 | @@ -0,0 +1,908 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom __future__ import print_function%0A%0Afrom dronekit import connect%0Aimport time%0A%0A# Set up option parsing to get connection string%0Aimport argparse%0Aparser = argparse.ArgumentParser(description='Reboots vehicle')%0Aparser.add_argument('-... | |
902473ff170fffb635cf73e742f94e352994e954 | Create FetchNCBIseq.py | Online/FetchNCBIseq.py | Online/FetchNCBIseq.py | Python | 0 | @@ -0,0 +1,671 @@
+### Fetch Genomics Sequence Using Coordinates In Biopython%0A%0Afrom Bio import Entrez, SeqIO%0AEntrez.email = %22A.N.Other@example.com%22 # Always tell NCBI who you are%0Ahandle = Entrez.efetch(db=%22nucleotide%22, %0A id=%22307603377%22, %0A rettype=... | |
927776d61abe9aae55689ffd7bb6ea12114b31fd | add main package file | angel/__init__.py | angel/__init__.py | Python | 0 | @@ -0,0 +1,189 @@
+from angel.html import HTML%0Afrom angel.css import CSS%0Afrom angel.dom import DOM%0A%0A%0A__version__ = '0.1.0'%0AVERSION = tuple(map(int, __version__.split('.')))%0A%0A__all__ = %5B'HTML', 'CSS', 'DOM'%5D%0A%0A
| |
f9cc8e04255d07c82d1a96682eebf044a6cdb977 | Fix conflicting migrations (#101) | projects/migrations/0003_auto_20160928_2137.py | projects/migrations/0003_auto_20160928_2137.py | Python | 0.000003 | @@ -0,0 +1,521 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('projects', '0002_auto_20151208_1553'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterF... | |
37704a2e905342bf867225fb5a8a3fec0c55a9fd | Add strDiff problem and tests. Minor tweak to setup.py | Problems/stringDiff.py | Problems/stringDiff.py | Python | 0 | @@ -0,0 +1,1270 @@
+#!/Applications/anaconda/envs/Python3/bin%0A%0A%0Adef main():%0A # Test suite%0A tests = %5B%0A %5BNone, None, None%5D, # Should throw a TypeError%0A %5B'abcd', 'abcde', 'e'%5D,%0A %5B'aaabbcdd', 'abdbacade', 'e'%5D,%0A %5B'abdbacade', 'aaabbcdd', 'e'%5D%0A %5D%0... | |
856a47b3b570da26a5cdf02b0e3dc0c2b1980307 | Add PLL routing fuzzer | fuzzers/LIFCL/120-pll-routing/fuzzer.py | fuzzers/LIFCL/120-pll-routing/fuzzer.py | Python | 0 | @@ -0,0 +1,1405 @@
+from fuzzconfig import FuzzConfig%0Afrom interconnect import fuzz_interconnect%0Aimport re%0A%0Aconfigs = %5B%0A %7B%0A %22cfg%22: FuzzConfig(job=%22PLLULC%22, device=%22LIFCL-40%22, sv=%22../shared/route_40.v%22, tiles=%5B%22CIB_R0C1:GPLL_ULC%22%5D),%0A %22rc%22: (1, 1),%0A %7D,... | |
e120f5fac68e2daf7cdf6e9d7b17b1f63a330595 | Fix ExpressionNode names that changed in django 1.5 | djangoappengine/db/expressions.py | djangoappengine/db/expressions.py | from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.expressions import ExpressionNode
OPERATION_MAP = {
ExpressionNode.ADD: lambda x, y: x + y,
ExpressionNode.SUB: lambda x, y: x - y,
ExpressionNode.MUL: lambda x, y: x * y,
ExpressionNode.DIV: lambda x, y: x / y,
Expres... | Python | 0.000057 | @@ -366,16 +366,19 @@
ionNode.
+BIT
AND: lam
@@ -417,11 +417,15 @@
ode.
+BIT
OR:
+
lam
|
69f7bbc9cd0715d0076a78f7cc4f8c044ba7199b | add examples directory and idaho image viewer example | examples/view_idaho_image.py | examples/view_idaho_image.py | Python | 0 | @@ -0,0 +1,369 @@
+from gbdxtools import Interface%0Aimport json%0A%0Agi = Interface()%0A%0A#catid = '101001000DB2FB00'%0A#catid = '1020010013C4CF00'%0Acatid = '10400100120FEA00'%0A%0Aidaho_images = gi.get_idaho_images_by_catid(catid)%0Adescription = gi.describe_idaho_images(idaho_images)%0Aprint json.dumps(description... | |
03971196d5399851b17ff05b7ad03f438797f973 | Fix regen of EventInterfaces.in by depending on list | Source/bindings/core_bindings_generated.gyp | Source/bindings/core_bindings_generated.gyp | # Copyright 2014 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.
# Generate EventInterfaces.in, used by core/ but depends on modules/,
# hence placed in bindings/ to avoid direct core/ -> modules/ dependency.
{
'include... | Python | 0.000067 | @@ -936,32 +936,69 @@
/utilities.py',%0A
+ '%3C(event_idl_files_list)',%0A
'%3C@(ev
|
de350de6093600cf891385fafd875485051219c3 | Add core urls to project urls | apps/core/urls.py | apps/core/urls.py | Python | 0.000001 | @@ -0,0 +1,128 @@
+from django.conf.urls import url%0A%0Afrom . import views%0A%0Aurlpatterns = %5B%0A url(r'%5E$', views.HomeView.as_view(), name='home'),%0A%5D%0A
| |
31f16844dd98516b1f57e3913d0fdba3e5715aa8 | Delete method now softdeletep's all FK related objects | logicaldelete/models.py | logicaldelete/models.py | import datetime
from django.db import models
from logicaldelete import managers
class Model(models.Model):
"""
This base model provides date fields and functionality to enable logical
delete functionality in derived models.
"""
date_created = models.DateTimeField(default=datetime.datetime.... | Python | 0 | @@ -241,20 +241,16 @@
%22%22%22%0A
-
%0A dat
@@ -259,17 +259,16 @@
created
-
= models
@@ -402,17 +402,16 @@
removed
-
= models
@@ -448,20 +448,16 @@
k=True)%0A
-
%0A obj
@@ -496,21 +496,17 @@
nager()%0A
-
%0A
+
def
@@ -586,21 +586,17 @@
= True%0A
-
%0A
+
def
@@ -62... |
b043749daafecc08d059e15c0e4a5d74fa683505 | Add support for pickle | powerline/lint/markedjson/markedvalue.py | powerline/lint/markedjson/markedvalue.py | __all__ = ['gen_marked_value', 'MarkedValue']
try:
from __builtin__ import unicode
except ImportError:
unicode = str
def gen_new(cls):
def __new__(arg_cls, value, mark):
r = super(arg_cls, arg_cls).__new__(arg_cls, value)
r.mark = mark
r.value = value
return r
return __new__
def gen_init(cls):
def __... | Python | 0 | @@ -394,16 +394,126 @@
nit__%0A%0A%0A
+def gen_getnewargs(cls):%0A%09def __getnewargs__(self):%0A%09%09return (self.value, self.mark)%0A%09return __getnewargs__%0A%0A%0A
class Ma
@@ -561,16 +561,58 @@
unicode)
+%0A%09__getnewargs__ = gen_getnewargs(unicode)
%0A%0A%09def _
@@ -1224,16 +1224,54 @@
ew(int)%0A
+%09__g... |
3dfc4bfbb71d1e97a6b8213f338df487fbae5fcc | Add auto migration for minor model changes | topics/migrations/0016_auto_20151221_0923.py | topics/migrations/0016_auto_20151221_0923.py | Python | 0 | @@ -0,0 +1,1222 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0Aimport django.utils.timezone%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('topics', '0015_auto_20151218_1823'),%0A %5D%0A%0A operations = %... | |
9ce0f7d3dad6b588f5e494edf68070e6c80c3339 | Add conversion to SAT | tutorials/2017/thursday/graphColouring.py | tutorials/2017/thursday/graphColouring.py | Python | 0.000833 | @@ -0,0 +1,407 @@
+from boolean import *%0A%0Adef graphColouring2SAT(G, k):%0A conj = %5B%5D%0A for i in range(len(G)):%0A conj.append(Or(*((i, j) for j in range(k))))%0A for j in range(k):%0A for jj in range(j+1, k):%0A conj.append(Or(Not((i, j)), Not((i, jj))))%0A ... | |
48a0fe0a4f841fb58783e2c021d29bd8f2b657ab | Create Settings.py | pyplatformerengine/utilities/Settings.py | pyplatformerengine/utilities/Settings.py | Python | 0 | @@ -0,0 +1,678 @@
+import pygame%0A%0A%22%22%22%0A Settings manager %0A%22%22%22%0Aclass Settings:%0A %0A %22%22%22 %0A Initializes the object%0A %22%22%22%0A def __init__(self,path):%0A self.settings = %7B%7D%0A settingsFile = open(path, %22r%22)%0A for line in settingsFile:... | |
2207351e805f11c39f843ca0e0eff261a7a5bde8 | Add half-naive solution to problem 10 | python/010_summation_of_primes/primes.py | python/010_summation_of_primes/primes.py | Python | 0.998373 | @@ -0,0 +1,516 @@
+from math import sqrt%0Afrom typing import Generator%0A%0A%0Adef prime_generator(limit: int) -%3E Generator%5Bint, None, int%5D:%0A if limit %3C 2:%0A return%0A else:%0A yield 2%0A primes = %5B2%5D%0A for x in range(3, limit + 1, 2):%0A if any(map(lambda divisor: x %2... | |
5980018bdf6989f1d86e9eabb24bf55b26df5115 | add forms.py for the group router | go/routers/group/forms.py | go/routers/group/forms.py | Python | 0 | @@ -0,0 +1,725 @@
+from django import forms%0A%0A%0Aclass GroupEditForm(forms.Form):%0A%0A groups = forms.MultipleChoiceField(%0A label=%22Select Groups%22,%0A choices=%5B%5D%0A )%0A%0A def __init__(self, *args, **kwargs):%0A groups = kwargs.pop('groups', %5B%5D)%0A super(GroupEditF... | |
747ff2fbaf9e6216ba932f446418819723611174 | Add solution for problem 12 | euler/solutions/solution_12.py | euler/solutions/solution_12.py | Python | 0.998799 | @@ -0,0 +1,2172 @@
+%22%22%22Highly divisible triangular number%0A%0AThe sequence of triangle numbers is generated by adding the natural numbers.%0A%0AThe 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28.%0A%0AThe first ten terms would be:%0A%0A1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...%0A%0ALet us list the fa... | |
65aee742ea0e95b200152f8a90d9ad5ee86b2512 | Add a Locust load testing script | scripts/locustfile.py | scripts/locustfile.py | Python | 0 | @@ -0,0 +1,1105 @@
+from locust import HttpLocust, TaskSet, task%0Aimport urllib%0Afrom faker import Faker%0A%0Afake = Faker()%0A%0Aclass SPARQLQueryTasks(TaskSet):%0A @task%0A def query_simple(self):%0A self.client.get(%22/sparql/?query=select+%252A+where+%257B+%253Fs+%253Fp+%253Fo+%257D+limit+0%22)%0A%0A... | |
e84d811f13347da3625e3a30d200e836f6393e9d | Store OBO data into a suitable queryable format | scripts/obo_to_sql.py | scripts/obo_to_sql.py | Python | 0 | @@ -0,0 +1,2437 @@
+# Note: based on - http://blog.adimian.com/2014/10/cte-and-closure-tables/%0Aimport sqlite3%0A%0Aconn = sqlite3.connect('test.db')%0Acursor = conn.cursor()%0A%0A%0Adef create_tables():%0A '''%0A Creates the two tables used to store the ontology concepts and terms.%0A - 'nodes' stores th... | |
5649a284826b4e85af29854f443a1fc421613932 | add solution for Binary Tree Right Side View | src/binaryTreeRightSideView.py | src/binaryTreeRightSideView.py | Python | 0 | @@ -0,0 +1,561 @@
+# Definition for a binary tree node%0A# class TreeNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0A%0Aclass Solution:%0A # @param root, a tree node%0A # @return a list of integers%0A%0A def rightSideView(self, root... | |
fd0b8035035d23276496428747c35329741a49e1 | fix group invitation handler | groupInvitationHandler.py | groupInvitationHandler.py | Python | 0.000001 | @@ -0,0 +1,284 @@
+import cgi%0Afrom google.appengine.ext import webapp%0Afrom model import *%0Afrom google.appengine.api import users%0Aimport registration as registration%0Aimport os%0Afrom google.appengine.ext.webapp import template%0A%0Aclass GroupInvitationHandler(webapp.RequestHandler):%0A%09%09%0A%09def get(self... | |
7d3114e1cc934cc122de641f864690f81794d10b | add scripts folder to fill-app folder | fill-app/scripts/fetch_gae_sdk.py | fill-app/scripts/fetch_gae_sdk.py | Python | 0.000001 | @@ -0,0 +1,2968 @@
+#!/usr/bin/env python%0A# Copyright 2015 Google Inc. All rights reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/lic... | |
9b48cb18980ae2e55ce02a84576f65f0bd8a27bb | Add wiki macro for the Like button. | FacebookPlugins.py | FacebookPlugins.py | Python | 0 | @@ -0,0 +1,1932 @@
+%22%22%22%0A@note: enable X%0A%22%22%22%0A%0Afrom trac.core import Component%0Afrom trac.wiki.macros import WikiMacroBase%0A%0A%0Aclass FacebookPlugins(Component):%0A %22%22%22%0A Support for Facebook plugins.%0A %22%22%22%0A%0A revision = %22$Rev$%22%0A url = %22$URL$%22%0A%0A %0A... | |
fd032cf6b7b8793be5b6653c72286d5e5a458d25 | support for trigger Maker IFTTT | homeassistant/components/ifttt.py | homeassistant/components/ifttt.py | Python | 0 | @@ -0,0 +1,2472 @@
+%22%22%22%0Ahomeassistant.components.ifttt%0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0AThis component enable you to trigger Maker IFTTT recipes.%0ACheck https://ifttt.com/maker for details.%0A%0AConfiguration:%0A%0ATo use Maker IFTTT you will need to add something like the following to your%0Aconfig/configura... | |
7cb546ba28a53b50969db384e79dc6bb394de4ad | use explicit relative import on djangoitem tests | scrapy/tests/test_djangoitem/__init__.py | scrapy/tests/test_djangoitem/__init__.py | import os
from twisted.trial import unittest
from scrapy.contrib_exp.djangoitem import DjangoItem, Field
os.environ['DJANGO_SETTINGS_MODULE'] = 'scrapy.tests.test_djangoitem.settings'
try:
import django
except ImportError:
django = None
if django:
from models import Person
else:
Person = None
clas... | Python | 0.000001 | @@ -262,16 +262,17 @@
from
+.
models i
|
4f2a481d0739b7eab5826a7198e768f364e97cdf | introduce configurable base type | openaps/configurable.py | openaps/configurable.py | Python | 0 | @@ -0,0 +1,1287 @@
+import json%0Aclass Configurable (object):%0A name = None%0A required = %5B %5D%0A optional = %5B %5D%0A prefix = '%7Bname:s%7D'%0A url_template = %22%22%0A def __init__ (self, name, **kwargs):%0A self.name = name%0A self.fields = kwargs%0A def section_name (self):%0A return '%25s %2... | |
fc72ca537e6eaf5f4bf04ed4511ec1acdd9eae11 | Add check script to test 'deprecated' decorator | checks/check_deprecation_warning.py | checks/check_deprecation_warning.py | Python | 0 | @@ -0,0 +1,685 @@
+from __future__ import print_function, absolute_import, division%0A%0Aimport imgaug as ia%0A%0A%0Aclass Dummy1(object):%0A @ia.deprecated(alt_func=%22Foo%22)%0A def __init__(self):%0A pass%0A%0A%0Aclass Dummy2(object):%0A @ia.deprecated(alt_func=%22Foo%22, comment=%22Some example comm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.