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 |
|---|---|---|---|---|---|---|---|
0be0d20fc667f0734b85d98f1d359130f7ed5b98 | Add failing specs for current/future class names. | plotly/tests/test_core/test_graph_objs/test_graph_objs.py | plotly/tests/test_core/test_graph_objs/test_graph_objs.py | Python | 0 | @@ -0,0 +1,1878 @@
+from unittest import TestCase%0A%0Aimport plotly.graph_objs as go%0Aimport plotly.graph_reference as gr%0A%0AOLD_CLASS_NAMES = %5B'AngularAxis', 'Annotation', 'Annotations', 'Area',%0A 'Bar', 'Box', 'ColorBar', 'Contour', 'Contours',%0A 'Data', 'ErrorX', 'ErrorY',... | |
6b53d081b78d3ea2073bdc13112b146660595b5f | Add tests for resource_renderer | tests/test_resource_renderer.py | tests/test_resource_renderer.py | Python | 0 | @@ -0,0 +1,863 @@
+from nose.tools import assert_true, assert_equals%0Afrom pyramid.testing import DummyRequest%0Afrom pyramid.response import Response%0A%0Aclass SUTResource(object):%0A%0A def __init__(self):%0A self.request = DummyRequest()%0A%0A def index(self):%0A return %7B%7D%0A%0Aclass TestRe... | |
22b2446546ce59b99980e98e81b3571d81085304 | Test that daily westminster pages load | tests/test_westminster_daily.py | tests/test_westminster_daily.py | Python | 0 | @@ -0,0 +1,892 @@
+import datetime as dt%0A%0Afrom flask_application import app%0A%0A%0Adef test_daily_westminster_pages_exist():%0A start_date = dt.date(2015, 01, 01)%0A%0A with app.test_client() as c:%0A for days in range(365):%0A date = start_date + dt.timedelta(days=days)%0A month... | |
eb828764ddbe3988f71b98082e1560e594c3f65d | Add a bot message to display TeamCity test results | ci/teamcity/comment_on_pr.py | ci/teamcity/comment_on_pr.py | Python | 0 | @@ -0,0 +1,1261 @@
+%22%22%22%0APost the comment like the following to the PR:%0A%60%60%60%0A:robot: TeamCity test results bot :robot:%0A%0A%3CLogs from pytest%3E%0A%60%60%60%0A%22%22%22%0A%0Afrom github import Github%0Aimport os%0Aimport sys%0A%0A# Check if this is a pull request or not based on the environment variab... | |
b0006bf92ae221558d47a0b3c9010cfaacde2bfe | add checkmein.py with __init__ function | autocheckin/checkmein.py | autocheckin/checkmein.py | Python | 0.000029 | @@ -0,0 +1,266 @@
+from selenium import webdriver%0Afrom selinium.webdriver.common.keys import Keys%0A%0Aclass CheckMeIn(object): %0A %0A%0A def __init__(self, firstName, lastName, confNum):%0A self.firstName = firstName%0A self.lastName = lastName%0A self.confNum = confNum%0A%0A
| |
528401b2c5cab29e301814da1754f0c0c41bdcd1 | Update shortest-distance-to-a-character.py | Python/shortest-distance-to-a-character.py | Python/shortest-distance-to-a-character.py | # Time: O(n)
# Space: O(n)
# Given a string S and a character C,
# return an array of integers representing the shortest distance
# from the character C in the string.
#
# Example 1:
#
# Input: S = "loveleetcode", C = 'e'
# Output: [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0]
#
# Note:
# - S string length is in [1, 10000].
#... | Python | 0.000054 | @@ -18,17 +18,17 @@
pace: O(
-n
+1
)%0A%0A# Giv
|
231bc7bb7bd7e373d4b4c9a3e33d6539d0637828 | Add xfailing test for #3345 | spacy/tests/regression/test_issue3345.py | spacy/tests/regression/test_issue3345.py | Python | 0 | @@ -0,0 +1,985 @@
+%22%22%22Test interaction between preset entities and sentence boundaries in NER.%22%22%22%0Aimport spacy%0Afrom spacy.tokens import Doc%0Afrom spacy.pipeline import EntityRuler, EntityRecognizer%0A%0A%0A@pytest.mark.xfail%0Adef test_issue3345():%0A %22%22%22Test case where preset entity crosses s... | |
d358a799ce726706543ac1d440f5b60112125a52 | Add psf building directory | photutils/psf/building/__init__.py | photutils/psf/building/__init__.py | Python | 0 | @@ -0,0 +1,151 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst%0A%22%22%22%0AThis subpackage contains modules and packages to build point spread%0Afunctions.%0A%22%22%22%0A
| |
e19c8d52719d1bc00023406842e9a445580d98d3 | add wrappers.py just a dispatch wrapper for linear models | scikits/statsmodels/wrappers.py | scikits/statsmodels/wrappers.py | Python | 0 | @@ -0,0 +1,1263 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Convenience Wrappers%0A%0ACreated on Sat Oct 30 14:56:35 2010%0A%0AAuthor: josef-pktd%0ALicense: BSD%0A%22%22%22%0A%0Aimport numpy as np%0Aimport scikits.statsmodels as sm%0Afrom scikits.statsmodels import GLS, WLS, OLS%0A%0Adef remove_nanrows(y, x):%0A '''remov... | |
c63ad26327f294393434dcfe4d5454656a0c1b4b | Add initial generate movie | scripts/generate-movie-plots.py | scripts/generate-movie-plots.py | Python | 0.000001 | @@ -0,0 +1,411 @@
+#!/usr/bin/env python3%0A%0Aimport os%0Aimport argparse%0A%0A%0Adef main():%0A parser = argparse.ArgumentParser()%0A parser.add_argument('sim_dir', help='Simulation directory')%0A parser.add_argument('output_dir', help='Output directory')%0A parser.add_argument('-s', '--skip', help='Skip ... | |
dbdb247ad03ca6b9168f193eadaf28638d718072 | Change docstring for NamedEntity filth | scrubadub/filth/named_entity.py | scrubadub/filth/named_entity.py | from .base import Filth
class NamedEntityFilth(Filth):
"""
Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org)
"""
type = 'named_entity'
def __init__(self, *args, label: str, **kwargs):
super(NamedEntityFilth, self).__init__(*args, **kwargs)
s... | Python | 0 | @@ -66,97 +66,175 @@
-Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org)
+Default filth type, for named entities (e.g. the ones in https://nightly.spacy.io/models/en#en_core_web_lg-labels),%0A except the ones represented in any other filth.
%0A
|
e84414c822a073848152787868c41bd97f713551 | Fix syntax (and unused variable) in #1675 | beetsplug/embedart.py | beetsplug/embedart.py | # This file is part of beets.
# Copyright 2015, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, ... | Python | 0.000001 | @@ -2531,75 +2531,8 @@
ool)
-%0A remove_art_file = self.config%5B'remove_art_file'%5D.get(bool)
%0A%0A
@@ -5867,24 +5867,25 @@
file(album)%0A
+%0A
def remo
@@ -5899,32 +5899,33 @@
ile(self, album)
+:
%0A if self
|
11f4add6873c7c089b5674415276a71b4c03cb42 | add example mbsubmit plugin | beetsplug/mbsubmit.py | beetsplug/mbsubmit.py | Python | 0 | @@ -0,0 +1,2984 @@
+# -*- coding: utf-8 -*-%0A# This file is part of beets.%0A# Copyright 2015, Adrian Sampson and Diego Moreda.%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining%0A# a copy of this software and associated documentation files (the%0A# %22Software%22), to deal in the Software ... | |
27bec5bc3dab9798d4ddbfcd84563b3c5056e8c8 | delete again | pychart/pychart_datarender/migrations/0001_initial.py | pychart/pychart_datarender/migrations/0001_initial.py | Python | 0 | @@ -0,0 +1,2121 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.5 on 2017-02-15 00:50%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A initial = True%0A%0A dependencies = %5B%0A ... | |
27896063f7632afa327c4933248435c874b91b7a | Create __init__.py | tests/__init__.py | tests/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
b66b696483608de022c25b3e14a1b23351ba86da | 4-9 cubed2 | 04/cubed2.py | 04/cubed2.py | Python | 0.999414 | @@ -0,0 +1,146 @@
+squares = %5B%5D%0D%0Afor value in range(1,11):%0D%0A square = value **3%0D%0A squares.append(square)%0D%0A%0D%0A #print(squares)%0D%0Aprint(squares)%0D%0A#%E7%9B%B4%E6%8E%A5%E9%80%BB%E8%BE%91,99%E4%B9%98%E6%B3%95%E8%A1%A8%E7%9A%84%E5%8E%9F%E7%90%86
| |
24c85bf4550c4560e2a192fd8513f3788ea2148e | add tools calcuate microseconds between two times | skills/time-tool/microsecond.py | skills/time-tool/microsecond.py | Python | 0.000188 | @@ -0,0 +1,1667 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A#%0A# Copyright (c) 2016 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A# * Redistributions of sourc... | |
b52a1aee01a95e499da47e8a039ee7106475cef3 | Move Django log to resources/logs | source/memex/common_settings.py | source/memex/common_settings.py | """
Common Django settings for memex explorer project (both dev and deploy)
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like t... | Python | 0.000001 | @@ -2929,24 +2929,33 @@
R, '
-memex/logs/debug
+resources/logs/django-app
.log
|
cb3158cbb116153d516a01ba1f63e26301338bbb | Create sigmoid_upper_bounds.py (#629) | scripts/sigmoid_upper_bounds.py | scripts/sigmoid_upper_bounds.py | Python | 0.000005 | @@ -0,0 +1,785 @@
+# Upper bounds for sigmoid function%0A%0Aimport numpy as np%0Aimport math%0Aimport matplotlib.pyplot as plt%0Aimport pyprobml_utils as pml%0A%0Asigmoid = lambda x: np.exp(x) / (1 + np.exp(x))%0Afstar = lambda eta: -eta * math.log(eta) - (1 - eta) * math.log(1 - eta)%0Asigmoid_upper = lambda eta, x: n... | |
9bfb182f92b8ac82ddb1b35c886b4a3f79708696 | Add script for train/test split | scripts/split_train_and_test.py | scripts/split_train_and_test.py | Python | 0 | @@ -0,0 +1,1075 @@
+import os%0Aimport shutil%0Aimport argparse%0Aimport random%0Arandom.seed(47297)%0A%0A%0Aparser = argparse.ArgumentParser(description='Split data into train and test sets.')%0Aparser.add_argument('subjects_root_path', type=str, help='Directory containing subject sub-directories.')%0Aargs, _ = parser... | |
284da54cc9fc322c32e44706716b548bcd652dc4 | Test axe app. | tests/test_axe.py | tests/test_axe.py | Python | 0 | @@ -0,0 +1,547 @@
+# -*- coding: utf-8 -*-%0A%0Aimport pytest%0Afrom axe import Axe, errors%0A%0A@pytest.fixture%0Adef axe():%0A return Axe()%0A%0Adef test_build_from_urls(axe):%0A func = lambda: ''%0A axe.build(%7B'/': func%7D)%0A assert '/' in axe.urls%0A assert axe.urls%5B'/'%5D == func%0A%0Adef test_... | |
134445f62244c4b85395be1c381d60cbdb1fd20e | Fix some rfxtrx devices with multiple sensors (#12264) | homeassistant/components/sensor/rfxtrx.py | homeassistant/components/sensor/rfxtrx.py | """
Support for RFXtrx sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.rfxtrx/
"""
import logging
import voluptuous as vol
import homeassistant.components.rfxtrx as rfxtrx
from homeassistant.components.rfxtrx import (
ATTR_DATA_TYPE,... | Python | 0 | @@ -2695,23 +2695,306 @@
for
-key in sensors:
+data_type in sensors:%0A # Some multi-sensor devices send individual messages for each%0A # of their sensors. Update only if event contains the%0A # right data_type for the sensor.%0A if data_type not in event.v... |
ed82f23da38f9663f55b32f05046b235bf5da9bd | fix overlooked issue with statically defined names (#10053) | homeassistant/components/switch/tplink.py | homeassistant/components/switch/tplink.py | """
Support for TPLink HS100/HS110/HS200 smart switch.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.tplink/
"""
import logging
import time
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
fr... | Python | 0 | @@ -1339,27 +1339,27 @@
elf._name =
-Non
+nam
e%0A se
|
f9d7612dfbad8d5f394bd7c0a9ed6db5f6234eb5 | add imf_tools | imf_tools.py | imf_tools.py | Python | 0.000001 | @@ -0,0 +1,1228 @@
+'''%0ADefine several stellar initial mass functions,%0A with some tools for working with them%0A'''%0A%0Aclass IMF(object):%0A '''%0A stellar initial mass function%0A '''%0A%0A __version__ = '0.1'%0A%0A def __init__(self, imftype='salpeter', ml=0.1, mh=150., mf=1., dm=.005):%0A ... | |
9efa97198f81f5afce03e30c3bce5f5fc23a8d28 | add test for Row | tests/test_row.py | tests/test_row.py | Python | 0 | @@ -0,0 +1,512 @@
+%0Aimport unittest%0Afrom eatable import Table, Row%0A%0Aclass RowTestCase(unittest.TestCase):%0A def setUp(self):%0A self.header = ('A', 'B', 'C')%0A self.table = Table(self.header)%0A%0A def test_init(self):%0A Row(self.table, 0, ('a1', 'b2', 'c2'))%0A%0A def test_geti... | |
fd5ccdb154cc00a1ff58d13043435f7b1927ca68 | fix apparent paste-buffer corruption | direct/src/distributed/CRCache.py | direct/src/distributed/CRCache.py | """CRCache module: contains the CRCache class"""
import DirectNotifyGlobal
import DistributedObject
class CRCache:
notify = DirectNotifyGlobal.directNotify.newCategory("CRCache")
def __init__(self, maxCacheItems=10):
self.maxCacheItems = maxCacheItems
self.dict = {}
self.fifo = []
... | Python | 0.000026 | @@ -2590,39 +2590,33 @@
lete it%0A
-oldestD
+d
istObj.delete()%0A
|
4407d1e42d3be45cbbd7b746d961f02cfc0d6d85 | use new api for display region | direct/src/showbase/ShadowDemo.py | direct/src/showbase/ShadowDemo.py |
"""Create a cheesy shadow effect by rendering the view of an
object (e.g. the local avatar) from a special camera as seen from
above (as if from the sun), using a solid gray foreground and a
solid white background, and then multitexturing that view onto the
world.
This is meant primarily as a demonstration of multipa... | Python | 0 | @@ -1357,20 +1357,17 @@
-laye
+d
r = self
@@ -1378,53 +1378,8 @@
fer.
-getChannel(0).makeLayer()%0A dr = layer.
make
|
e0bfc2bdff3d44c8839e4c04948e8da824f7b260 | Write requests-like get() | spyglass/util.py | spyglass/util.py | Python | 0.004638 | @@ -0,0 +1,169 @@
+from urllib2 import urlopen%0Afrom collections import namedtuple%0A%0AResponse = namedtuple('Response', %5B'text'%5D)%0A%0Adef get(url):%0A return Response(text=urlopen(url).read())%0A
| |
96c08b94d40850b5dd703b052943de2827ebf9f9 | create command.py and abstract command template | foxybot/command.py | foxybot/command.py | Python | 0 | @@ -0,0 +1,1268 @@
+%22%22%22Provide a template for making commands and a decorator to register them.%22%22%22%0A%0Afrom abc import abstractmethod, abstractclassmethod, ABCMeta%0Afrom enum import Enum%0A%0Afrom registrar import CommandRegistrar%0A%0Adef bot_command(cls):%0A command = cls()%0A%0A if not issubclass... | |
657620bcb755185244363062b41a3e6b942d1e77 | Fix config error on ubuntu machine | module/pych/configuration.py | module/pych/configuration.py | """
Loads and stores pyChapel configuration.
"""
# pylint: disable=maybe-no-member
# The configuration object does have the "__file__" member via the module.
# pylint: disable=too-few-public-methods
# The configuration wraps around the configuration state, access is provided
# through __getitem__ it is perfectly valid ... | Python | 0.000001 | @@ -968,16 +968,40 @@
== %22lib%22
+ or directory == %22local%22
:%0A
|
e85d1f0e9b198184103973f198bf1ceddbca6a65 | declare the federica rspec schemas | sfa/rspecs/versions/federica.py | sfa/rspecs/versions/federica.py | Python | 0.998416 | @@ -0,0 +1,594 @@
+from sfa.rspecs.versions.pgv2 import PGv2Ad, PGv2Request, PGv2Manifest%0A%0Aclass FedericaAd (PGv2Ad):%0A enabled = True%0A schema = 'http://sorch.netmode.ntua.gr/ws/RSpec/ad.xsd'%0A namespace = 'http://sorch.netmode.ntua.gr/ws/RSpec'%0A%0Aclass FedericaRequest (PGv2Request):%0A enabled =... | |
cbac6a809eb401dfc64ef4fe7d7935d06f7b703e | comment un-necesssary codes | hps/settings.py | hps/settings.py | """
Django settings for hps project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import... | Python | 0.000007 | @@ -1852,17 +1852,20 @@
tabases%0A
-%0A
+#%0A#
DATABASE
@@ -1870,20 +1870,22 @@
SES = %7B%0A
+#
+
'default
@@ -1885,24 +1885,26 @@
default': %7B%0A
+#
'ENG
@@ -1939,16 +1939,18 @@
lite3',%0A
+#
@@ -1995,22 +1995,26 @@
ite3'),%0A
+#
%7D%0A
+#
%7D%0A%0A# Int
|
c055009077546b22090897f79f4facce8bdb97d5 | change module names in hvc/__init__.py | hvc/__init__.py | hvc/__init__.py | """
__init__.py imports key functions from modules to package level
"""
from .utils.features import load_feature_file
from .featureextract import extract
from .labelpredict import predict
from .modelselect import select
from .parseconfig import parse_config
from . import metrics
from . import plot | Python | 0.000017 | @@ -118,23 +118,16 @@
e%0Afrom .
-feature
extract
@@ -151,13 +151,8 @@
om .
-label
pred
@@ -180,13 +180,8 @@
om .
-model
sele
|
67737629c2d507c0e9fc96bb53695d2fbdcc1e8f | point_of_sale : Removed print statement. | addons/point_of_sale/report/pos_invoice.py | addons/point_of_sale/report/pos_invoice.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
#... | Python | 0.998475 | @@ -149,9 +149,8 @@
tion
-%09
%0A#
@@ -1308,22 +1308,8 @@
%7D)
-%0A print
%0A%0A
|
fa375d06128e493f86524e82fa93c892f4d925b7 | Add script to find forms missing in ES | corehq/apps/data_pipeline_audit/management/commands/find_sql_forms_not_in_es.py | corehq/apps/data_pipeline_audit/management/commands/find_sql_forms_not_in_es.py | Python | 0.000001 | @@ -0,0 +1,2757 @@
+from __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import unicode_literals%0A%0Afrom __future__ import print_function%0Afrom datetime import datetime%0Afrom django.core.management.base import BaseCommand%0Aimport sys%0Afrom django.db.models import Q, F%0Afrom ... | |
51372b15e9abe4c0ae35294ec51694751fe2ae32 | Add a py2exe configuration setup. | src/bin/setup.py | src/bin/setup.py | Python | 0 | @@ -0,0 +1,260 @@
+from distutils.core import setup%0Aimport py2exe, sys%0Afrom glob import glob%0Asys.path.append(%22C:%5C%5CTemp%5C%5CMicrosoft.VC90.CRT%22)%0Adata_files = %5B(%22Microsoft.VC90.CRT%22, glob(r'C:%5CTemp%5CMicrosoft.VC90.CRT%5C*.*'))%5D%0Asetup(%0A data_files=data_files,%0A console=%5B'ride.py'%5... | |
d8521011d5be28812c222b58901a07e8f30e87ac | Add testing code for memory leak. | neuralstyle/testing-train.py | neuralstyle/testing-train.py | Python | 0 | @@ -0,0 +1,2177 @@
+from __future__ import print_function%0A%0Aimport argparse%0A%0Aimport numpy as np%0Aimport torch%0Afrom torch.autograd import Variable%0Afrom torch.optim import Adam%0Afrom torch.utils.data import DataLoader%0Afrom torchvision import transforms%0Afrom torchvision import datasets%0A%0Afrom transform... | |
5a2308cc98a99e9c74c14611fdb45adf7601d390 | prepare bruteforce for http basic authentication; do not forget to create the b64 encoder in zap payload processor; | payload_generator/bruteforce.py | payload_generator/bruteforce.py | Python | 0 | @@ -0,0 +1,1648 @@
+# Auxiliary variables/constants for payload generation.%0A%0AINITIAL_VALUE = 0;%0Acount = INITIAL_VALUE;%0Auser = str('admin');%0Apassfile_path = 'C:%5C%5CUsers%5C%5Cuser%5C%5CDocuments%5C%5Cwordlists%5C%5Ctest.txt';%0ANUMBER_OF_PAYLOADS = sum(1 for line in open(passfile_path));%0Apasswd = list();%0... | |
0ced2a66affd65a3dda90dc49bac8bd43e1c6fa7 | Remove index on LogRecord.message. | peavy/migrations/0004_drop_message_index.py | peavy/migrations/0004_drop_message_index.py | Python | 0 | @@ -0,0 +1,2042 @@
+# encoding: utf-8%0Afrom south.db import db%0Afrom south.v2 import SchemaMigration%0A%0A%0Aclass Migration(SchemaMigration):%0A%0A def forwards(self, orm):%0A # Removing index on 'LogRecord', fields %5B'message'%5D%0A db.delete_index('peavy_logrecord', %5B'message'%5D)%0A%0A def ... | |
f3e91020f0426fedfe229e94bf1ddc69dd64a136 | Add new example plot for `match_template`. | doc/examples/plot_template_alt.py | doc/examples/plot_template_alt.py | Python | 0 | @@ -0,0 +1,1662 @@
+%22%22%22%0A=================%0ATemplate Matching%0A=================%0A%0AIn this example, we use template matching to identify the occurrence of an%0Aimage patch (in this case, a sub-image centered on a single coin). Here, we%0Areturn a single match (the exact same coin), so the maximum value in t... | |
fc1c0a563f8bd4fd33e63285ab6af79825b8b927 | Add a modified terminalcolors.py | bin/terminalcolors.py | bin/terminalcolors.py | Python | 0.000001 | @@ -0,0 +1,792 @@
+#!/usr/bin/env python%0A# Copyright (C) 2006 by Johannes Zellner, %3Cjohannes@zellner.org%3E%0A# modified by mac@calmar.ws to fit my output needs%0A# modified by crncosta@carloscosta.org to fit my output needs%0A# modified by joeyates, 2014%0A%0Afrom os import system%0A%0Adef foreground(n):%0A sys... | |
1de610b2460b3b3bff24b79398d214001097e562 | Implement Gmail OAuth 2.0. | notifyhere/dash/api/gmail.py | notifyhere/dash/api/gmail.py | Python | 0.000055 | @@ -0,0 +1,1552 @@
+from httplib import HTTPSConnection%0Aimport json%0A%0Aimport base%0Aimport tools%0Aimport secrets%0A%0Aclass GmailApi(base.ApiBase):%0A%0A def __init__(self):%0A base.ApiBase.__init__(self, %22gmail%22)%0A self.token = %22%22%0A%0A def icon_url(self):%0A return %22https:/... | |
5f81d53c16816289cf52a5b4118e482b7650defe | Add MaintenanceMiddleware | app/soc/middleware/maintenance.py | app/soc/middleware/maintenance.py | Python | 0 | @@ -0,0 +1,2257 @@
+#!/usr/bin/python2.5%0A#%0A# Copyright 2009 the Melange authors.%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/licenses/LICEN... | |
4f1bb01bba0c2241a190bbf7fb21683be630abfa | Create Glyph3D.py | src/Python/Filtering/Glyph3D.py | src/Python/Filtering/Glyph3D.py | Python | 0.000001 | @@ -0,0 +1,1182 @@
+#!/usr/bin/env python%0A%0Aimport vtk%0A%0Adef main():%0A colors = vtk.vtkNamedColors()%0A %0A points = vtk.vtkPoints()%0A points.InsertNextPoint(0,0,0)%0A points.InsertNextPoint(1,1,1)%0A points.InsertNextPoint(2,2,2)%0A %0A polydata = vtk.vtkPolyData()%0A polydata.SetPoi... | |
ff4f7273925df677b67b31e2b532768a392e18f8 | Implement Section.__hash__() to avoid Python 2’s DeprecationWarning | elftools/elf/sections.py | elftools/elf/sections.py | #-------------------------------------------------------------------------------
# elftools: elf/sections.py
#
# ELF sections
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from ..construct import CString
from ..c... | Python | 0.000001 | @@ -1279,16 +1279,73 @@
.header%0A
+ def __hash__(self):%0A return hash(self.header)%0A
%0A%0Aclass
|
89262fbd2375724ff9120fe01799a036b1c34f6f | add new package at v1.1.6 (#20598) | var/spack/repos/builtin/packages/py-mercantile/package.py | var/spack/repos/builtin/packages/py-mercantile/package.py | Python | 0 | @@ -0,0 +1,674 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyMercantile(PythonPackage):%0A %22%22%22Web mercator XY... | |
41bc3c33cc1442105f019e06c40d189c27f65758 | add save_json helper | vsmlib/misc/data.py | vsmlib/misc/data.py | Python | 0.000001 | @@ -0,0 +1,227 @@
+import json%0A%0A%0Adef save_json(data, path):%0A # if not os.path.isdir(path):%0A # os.makedirs(path)%0A s = json.dumps(data, ensure_ascii=False, indent=4, sort_keys=True)%0A f = open(path, 'w')%0A f.write(s)%0A f.close()%0A
| |
8483a311f75a3d3682e66fba2f805ea20ebf6870 | add memory usage beacon | salt/beacons/memusage.py | salt/beacons/memusage.py | Python | 0.000001 | @@ -0,0 +1,1590 @@
+# -*- coding: utf-8 -*-%0A'''%0ABeacon to monitor memory usage.%0A%0A.. versionadded::%0A%0A:depends: python-psutil%0A'''%0A%0A# Import Python libs%0Afrom __future__ import absolute_import%0Aimport logging%0Aimport re%0A%0A# Import Salt libs%0Aimport salt.utils%0A%0A# Import Third Party Libs%0Atry:%... | |
9e6f8768d60d38e69074c5275637deaa62e6fc9e | check how often URL matching would match the right documents in the test corpus | baseline/url_matching.py | baseline/url_matching.py | Python | 0.000001 | @@ -0,0 +1,3041 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Aimport sys%0Aimport os%0Afrom strip_language_from_uri import LanguageStripper%0Aimport chardet%0Afrom collections import defaultdict%0Aimport re%0Aimport urlparse%0A%0A%0Adef has_prefix(prefixes, s):%0A %22Returns true if s starts with one of the ... | |
d1ffd984bae034076244ac4449632a1aa04d5ffe | Refactor to Linter v2 API | bears/php/PHPLintBear.py | bears/php/PHPLintBear.py | import re
from coalib.bearlib.abstractions.Lint import Lint
from coalib.bears.LocalBear import LocalBear
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
class PHPLintBear(LocalBear, Lint):
executable = 'php'
arguments = '-l -n -d display_errors=On -d log_errors=Off {filename}'
output_regex = r... | Python | 0 | @@ -1,15 +1,4 @@
-import re%0A%0A
from
@@ -30,24 +30,26 @@
ons.Lint
+er
import
Lint%0Afro
@@ -44,56 +44,13 @@
ort
-Lint%0Afrom coalib.bears.LocalBear import LocalBea
+linte
r%0Afr
@@ -112,48 +112,16 @@
Y%0A%0A%0A
-class PHPLintBear(LocalBear, Lint):%0A
+@linter(
exec
@@ -130,205 +130,149 @@
able
- =
+=... |
a0b9ce2f711aaf7c4bc94cdae3ddb0262164d607 | remove comment | Integrations/PhishLabsIOC/PhishLabsIOC_test.py | Integrations/PhishLabsIOC/PhishLabsIOC_test.py | from CommonServerPython import *
def test_populate_context_files():
from PhishLabsIOC import populate_context, get_file_properties, create_phishlabs_object
files_json = """
{
"attributes": [
{
"createdAt": "2019-05-14T13:03:45Z",
"id"... | Python | 0 | @@ -5580,91 +5580,8 @@
%5D)%0A%0A
- # context%5B'PhishLabs.Email(val.ID && val.ID === obj.ID)'%5D%5B0%5D.pop('Attribute')%0A%0A
|
34560978ee8f33ab8ddc60a1a3525979119a952e | Add run script | profile_compressible_solver/run_profiler.py | profile_compressible_solver/run_profiler.py | Python | 0.000001 | @@ -0,0 +1,2789 @@
+from firedrake.petsc import PETSc%0Afrom argparse import ArgumentParser%0Afrom driver import run_profliler%0Aimport sys%0A%0A%0APETSc.Log.begin()%0A%0Aparser = ArgumentParser(description=(%22%22%22%0AProfile of 3D compressible solver for the Euler equations (dry atmosphere).%0A%22%22%22), add_help=F... | |
55f0e8bbddee976f020628c552eb22d8ed894c1a | question 0001 solved | vvzwvv/0001/0001.py | vvzwvv/0001/0001.py | Python | 0.999999 | @@ -0,0 +1,228 @@
+import uuid%0A%0Adef gen(num, len):%0A%09L = %5B%5D%0A%09for i in range(num):%0A%09%09ran = str(uuid.uuid4()).replace('-', '')%5B:len%5D%0A%09%09if not ran in L:%0A%09%09%09L.append(ran)%0A%09return L%0A%0Aif __name__ == '__main__':%0A%09for item in gen(200, 16):%0A%09%09print(item)%0A%09%09
| |
ee2a4c1edb6d2f1273bb08080e8fc00b0a0e9074 | add pack1/mymodule1.py | python/18-package/parent/pack1/mymodule1.py | python/18-package/parent/pack1/mymodule1.py | Python | 0.000023 | @@ -0,0 +1,209 @@
+#!/usr/bin/env python%0A#-*- coding=utf-8 -*-%0A%0Adef function1():%0A print %22function1 running%22%0A%0A%0Aif __name__ == %22__main__%22:%0A print %22mymodule1 running as main program%22%0Aelse:%0A print %22mymodule1 initializing%22%0A%0A
| |
a29e340efa60ecb05d85e9c6d87ec709ba26822f | Add new extractor(closes #14361) | youtube_dl/extractor/bibeltv.py | youtube_dl/extractor/bibeltv.py | Python | 0 | @@ -0,0 +1,1102 @@
+# coding: utf-8%0Afrom __future__ import unicode_literals%0A%0Afrom .common import InfoExtractor%0A%0A%0Aclass BibelTVIE(InfoExtractor):%0A _VALID_URL = r'https?://(?:www%5C.)?bibeltv%5C.de/mediathek/videos/(?:crn/)?(?P%3Cid%3E%5Cd+)'%0A _TESTS = %5B%7B%0A 'url': 'https://www.bibeltv.de... | |
76cce82d65868619b096d74a5adb3a616cfe771d | Create new package. (#5810) | var/spack/repos/builtin/packages/r-affyilm/package.py | var/spack/repos/builtin/packages/r-affyilm/package.py | Python | 0 | @@ -0,0 +1,2062 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
da42b3854d85b1df42c67e4e5f3d9131aacecd2c | Turn on template debugging in test settings | {{cookiecutter.project_slug}}/config/settings/test.py | {{cookiecutter.project_slug}}/config/settings/test.py | # -*- coding: utf-8 -*-
'''
Test settings
- Used to run tests fast on the continuous integration server and locally
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
# Turn debug off so tests run faster
DEBUG = False
TEMPLATES[0]['OPTIONS']['d... | Python | 0.997035 | @@ -287,16 +287,84 @@
= False%0A
+# But template debugging must be enabled for django_coverage_plugin%0A
TEMPLATE
@@ -390,20 +390,19 @@
bug'%5D =
-Fals
+Tru
e%0A%0A# SEC
|
d7017acef8ed540bb2f3c00d268cd417d75f09e3 | add import script for Fareham (closes #858) | polling_stations/apps/data_collection/management/commands/import_fareham.py | polling_stations/apps/data_collection/management/commands/import_fareham.py | Python | 0 | @@ -0,0 +1,392 @@
+from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter%0A%0Aclass Command(BaseXpressDemocracyClubCsvImporter):%0A council_id = 'E07000087'%0A addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017 (1).tsv'%0A stations_name = 'parl.2017-06-08/Versio... | |
57d66ddf50b31c2561526075be9c8796df209e2d | Fix Linux Swarming bots | infra/bots/flavor/default_flavor.py | infra/bots/flavor/default_flavor.py | #!/usr/bin/env python
#
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Default flavor utils class, used for desktop bots."""
import os
import shutil
import sys
class DeviceDirs(object):
def __init__(self,
dm_... | Python | 0.998793 | @@ -2002,28 +2002,24 @@
f._bot_info.
-bot_
name and%0A
@@ -2052,20 +2052,16 @@
ot_info.
-bot_
name):%0A
|
675b87d5bc072d5b6fbd1f9a54ec61d98b1139ac | Add lab2 file. | lab2.py | lab2.py | Python | 0 | @@ -0,0 +1,596 @@
+# -*- coding: utf-8 -*-%0A%0Afrom math import pow%0A%0Adef mymap1(fun, l):%0A res = %5B%5D%0A for i in l:%0A res.append(fun(i))%0A return res%0A%0A#print(mymap1(str, %5B3, 1, 7, 4, 6, 9%5D))%0A%0A%0Adef mymap2(fun, *l):%0A res = %5B%5D%0A for i in zip(*l):%0A print(i)%0A ... | |
252925fa998412ac868eb63790fbd515c429ac67 | add main entry point (untested, but should be complete now) | main.py | main.py | Python | 0 | @@ -0,0 +1,2138 @@
+%22%22%22%0ACore namespace. Handles: %0A1. Call out to hashio to check hashes, save log, and return results%0A2. Load tweetlog and tweet creds%0A3. Generate and log tweets for changed files%0A4. Generate and log tweets for new files%0A4. Save tweetlog %0A%22%22%22%0A%0Aimport hash, hashio, twi... | |
21028c13585fbcd5315efd74ab55f5d03d69c500 | add probe nsrl | nsrl.py | nsrl.py | Python | 0.000001 | @@ -0,0 +1,1093 @@
+import hashlib%0Afrom pymongo import MongoClient%0Afrom lib.irma.common.exceptions import IrmaDatabaseError%0A%0Aclass NsrlInfo(object):%0A _uri = %22mongodb://localhost:27017/%22%0A _dbname = %22nsrl%22%0A _collection = %22hashset%22%0A%0A def __init__(self):%0A self._dbh = None%... | |
f151d1cc5ddb3b60c6410153e147ccd5c0378904 | Add Sequence object | oeis.py | oeis.py | Python | 0.00001 | @@ -0,0 +1,757 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%22%22%22%0Apy-oeis%0A%0AA Python library to access the OEIS.%0A%0ASumant Bhaskaruni%0Av0.1%0A%22%22%22%0A%0Aimport requests%0A%0A%0Aclass Sequence(object):%0A %22%22%22An object to represent a single OEIS sequence.%0A%0A Initializer arguments:... | |
eb56d833efad16e9a84724d18121528177f37adb | add 41 | p041.py | p041.py | Python | 0.999998 | @@ -0,0 +1,296 @@
+import utils%0A%0Aprimes = utils.primes(7654321)%0A%0Adef p(n):%0A sn = str(n)%0A lsn = len(sn)%0A%0A if lsn %3E 10:%0A return False%0A %0A return set(%5B int(d) for d in sn %5D) == set(range(1, len(sn) + 1))%0A%0A%0Aprimes.reverse()%0Afor prime in primes:%0A if p(prime):%0A ... | |
9efa33b28b86feaa204ebb84955022b7716a98ba | resolve conflicts | seqr/migrations/0057_merge_20190513_2009.py | seqr/migrations/0057_merge_20190513_2009.py | Python | 0.00004 | @@ -0,0 +1,333 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.20 on 2019-05-13 20:09%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('seqr', '0056_auto_20190513_1621'),%0A ('seqr', '005... | |
ba8d38f278169b5d71e85e4d74a43fcd4a3892ae | Test decorator | 99_misc/decorator.py | 99_misc/decorator.py | Python | 0.000002 | @@ -0,0 +1,774 @@
+#/usr/bin/env python%0Adef my_func1(callback):%0A def func_wrapper(x):%0A print(%22my_func1: %7B0%7D %22.format(callback(x)))%0A return func_wrapper%0A%0A@my_func1%0Adef my_func2(x):%0A return x%0A%0A# Actuall call sequence is similar to:%0A# deco = my_func1(my_func2)%0A# deco(%22test... | |
82d5856b09c42b09f857976075d40b6c6568a7c8 | Create gate_chk_aws.py | gate_chk/gate_chk_aws.py | gate_chk/gate_chk_aws.py | Python | 0.000003 | @@ -0,0 +1,1679 @@
+#!/usr/bin/env python%0A%0A# -*- coding: utf-8 -*-%0A%0Aimport nfc%0Aimport spidev%0Aimport smbus%0Aimport re%0Aimport mysql.connector%0Aimport time%0A%0Adef getid(tag):%0A global id%0A a = '%25s' %25 tag%0A id = re.findall(%22ID=(%5B0-9A-F%5D*)%22,a)%5B0%5D%0A%0Acon = mysql.connector.conne... | |
870d30a0cb7788055cfc9c22854cdbe6293036fa | create class to list preset and metapreset | settingMod/PresetList.py | settingMod/PresetList.py | Python | 0 | @@ -0,0 +1,1280 @@
+#!/usr/bin/python3.4%0A# -*-coding:Utf-8 -*%0A'''module to manage preset list'''%0Aimport xml.etree.ElementTree as xmlMod%0Aimport os%0A%0Aclass PresetList:%0A%09'''class to manage preset list'''%0A%09%0A%09%0A%09def __init__(self, xml= None):%0A%09%09'''initialize preset list with default value or ... | |
430ca4b6a6f134346efaae430fac2bfaff195fe1 | Add files via upload | 1stANNrecoded2Python.py | 1stANNrecoded2Python.py | Python | 0 | @@ -0,0 +1,582 @@
+#imports here: numpy, os, whatever I need%0A%0An = 1000%0Ae = (1.0 + 1.0/n)%5En%0A%0A#Instantiate a new layer with the number of neurons desired, give the neurons (Q: do neurons have separate values than their weights?) random values.%0Adef layerFactory(numberOfNeurons):%0A%0A%0A#create weights betw... | |
5b098392cee7f6526947d45bfc620573c631e4cf | Create add-P67-wikidata-url | my-ACG/add-P67-wikidata-url/edit.py | my-ACG/add-P67-wikidata-url/edit.py | Python | 0 | @@ -0,0 +1,1142 @@
+# -*- coding: utf-8 -*-%0Aimport argparse%0Aimport csv%0Aimport os%0A%0Aos.environ%5B'PYWIKIBOT_DIR'%5D = os.path.dirname(os.path.realpath(__file__))%0Aimport pywikibot%0A%0A%0Asite = pywikibot.Site()%0Asite.login()%0Adatasite = site.data_repository()%0A%0A%0Adef addWikidataUrl(title, targettitle):%... | |
52fd7e5e6ae5ec6ab7de8a858fd2b132fe0d4081 | Create CGOLprintToScreen.py | CGOLprintToScreen.py | CGOLprintToScreen.py | Python | 0 | @@ -0,0 +1,2606 @@
+import sys%0A%0Atiles_size = 64%0A%0A%0Aclass cell:%0A def __init__(self, location, alive=False):%0A self.alive = alive%0A self.location = location%0A%0A%0Aclass Rules:%0A def rule(self): # if alive%0A for i in range(tiles_size):%0A for j in range(tiles_size):%... | |
9b5f070705de9896c8c6f8347dc0f733ae748793 | Add harvesting blog data example | harvesting_blog_data.py | harvesting_blog_data.py | Python | 0 | @@ -0,0 +1,709 @@
+import os%0Aimport sys%0Aimport json%0Aimport feedparser%0Afrom bs4 import BeautifulSoup%0A%0AFEED_URL = 'http://g1.globo.com/dynamo/rss2.xml'%0A%0Adef cleanHtml(html):%0A return BeautifulSoup(html, 'lxml').get_text()%0A%0Afp = feedparser.parse(FEED_URL)%0A%0Aprint %22Fetched %25s entries from '%2... | |
f40788bdc60566fc15a7abb46bfca61bb9131823 | Test update | test.py | test.py | Python | 0 | @@ -0,0 +1,100 @@
+#!/usr/bin/env python%0A%0A%0Adef main():%0A print %22Hello world%22%0A%0A%0Aif __name__ == %22__main__%22:%0A main()%0A
| |
b07ca938d68dff3386007885a6da4f5b2e593941 | Add prototype | test.py | test.py | Python | 0.000001 | @@ -0,0 +1,1351 @@
+#!/usr/bin/python%0A%0Afrom construct import *%0Aimport sys%0A%0Adef align4(n):%0A%09return n + ((n+4) %25 4)%0A%0Achunk_atom = Struct(%22chunk_atom%22,%0A%09UBInt32(%22len%22),%0A%09Array(lambda ctx: ctx.len, PascalString(%22atom%22))%0A%09)%0A%0Achunk_expt = Struct(%22chunk_expt%22,%0A%09UBInt32(%... | |
d5aecde4806a130550786f21f8fdd13c27996e16 | add test.py and copyright comments | test.py | test.py | Python | 0 | @@ -0,0 +1,342 @@
+# encoding: utf-8%0Afrom toPersian import *%0A%0Aprint enToPersianNumb('%D8%B4%D9%85%D8%A7%D8%B1%D9%87 %DA%A9%D9%84%D8%A7%D8%B3 312')%0Aprint enToPersianNumb(3123123.9012)%0Aprint enToPersianNumb(123)%0Aprint enToPersianchar('sghl %5Di ofv')%0Aprint arToPersianNumb('%D9%A3%D9%A4%D9%A5%D9%A6')%0Aprin... | |
3a160d3aed9d5eb7cebe2427f9009b4e0e2f07c4 | return doi resolver url instead of doi resolver name | searx/plugins/oa_doi_rewrite.py | searx/plugins/oa_doi_rewrite.py | from flask_babel import gettext
import re
from searx.url_utils import urlparse, parse_qsl
from searx import settings
regex = re.compile(r'10\.\d{4,9}/[^\s]+')
name = gettext('Open Access DOI rewrite')
description = gettext('Avoid paywalls by redirecting to open-access versions of publications when available')
defaul... | Python | 0.003718 | @@ -913,16 +913,68 @@
olver'%5D%0A
+ doi_resolver_url = doi_resolvers%5Bdoi_resolver%5D%0A
retu
@@ -988,16 +988,20 @@
resolver
+_url
%0A%0A%0Adef o
|
995e35c2a66fd51f9216ed5acc829bac0ac3ddeb | add i3-debug-console script to examples | examples/i3-debug-console.py | examples/i3-debug-console.py | Python | 0.000001 | @@ -0,0 +1,1438 @@
+#!/usr/bin/env python3%0A%0Aimport i3ipc%0Afrom curses import wrapper%0Afrom threading import Timer%0A%0Adef con_type_to_text(con):%0A if con.type != 'con':%0A return con.type%0A if len(con.nodes):%0A return 'container'%0A else:%0A return 'view'%0A%0Adef layout_txt(con)... | |
1524a8fd55c682bd8b77b52b9d2d5e5c030c9d2d | Add first tests | test/sciluigi_test.py | test/sciluigi_test.py | Python | 0.000001 | @@ -0,0 +1,489 @@
+import sciluigi%0Afrom nose.tools import with_setup%0A%0A# Make these variables global%0A#shell_task = None%0A%0Adef setup():%0A global shell_task%0A shell_task = sciluigi.shell(%22cat %3Ci:input%3E %3E %3Co:output:out.txt%3E%22)%0A return shell_task%0A%0Adef teardown():%0A global shell_t... | |
6f3c212a3e376bed93d0a65722486ba36f432ae7 | Install pip_requirements_dev to DEV environment as well as SOLO. | buedafab/environments.py | buedafab/environments.py | """Application environments, which determine the servers, database and other
conditions for deployment.
"""
from fabric.api import require, env
import os
from buedafab import aws
def _not_localhost():
"""All non-localhost environments need to install the "production" pip
requirements, which typically includes... | Python | 0 | @@ -941,16 +941,169 @@
= %22DEV%22
+%0A if (hasattr(env, 'pip_requirements')%0A and hasattr(env, 'pip_requirements_dev')):%0A env.pip_requirements += env.pip_requirements_dev
%0A%0Adef st
|
ed63c9c828cc609d82eb5afb21f6e24b358bc3cf | Add DoubleLinkedQueue | DoubleLinkedQueue.py | DoubleLinkedQueue.py | Python | 0.000001 | @@ -0,0 +1,1772 @@
+class _DoubleLinkedList:%0A class _Node:%0A __slots__ = '_element', '_prev', '_next'%0A%0A def __init__(self, element, prev, next):%0A self._element = element%0A self._prev = prev%0A self._next = next%0A%0A def __init__(self):%0A self.heade... | |
42f66ea6e1921040d6e3055c41372b02511e6a5a | Add directory for CYK tests | tests/CYK/__init__.py | tests/CYK/__init__.py | Python | 0 | @@ -0,0 +1,113 @@
+#!/usr/bin/env python%0A%22%22%22%0A:Author Patrik Valkovic%0A:Created 31.08.2017 14:50%0A:Licence GNUv3%0APart of pyparsers%0A%0A%22%22%22
| |
4dc6462a0a8231ba4ffca09d5c9546d8b6d0dd6f | Fix bug in config. | DIE/Lib/DieConfig.py | DIE/Lib/DieConfig.py | import logging
import os
import ConfigParser
import idaapi
import yaml
from attrdict import AttrMap
class DIEConfig(object):
DEFAULT = os.path.join(os.path.dirname(__file__), "config.yml")
def __init__(self):
with open(self.DEFAULT, "rb") as f:
default = yaml.safe_load(f)
self.... | Python | 0 | @@ -761,28 +761,141 @@
-self._config
+custom = AttrMap(custom)%0A%0A for attr in self._config:%0A if attr in custom:%0A self._config%5Battr%5D
.update(
@@ -896,25 +896,32 @@
pdate(custom
-)
+%5Battr%5D)%0A
%0A%0A def sa
|
5ac4f0be3f9f1179a50670989915bae0d3ae157e | Add globals.ffmpeg module to retrieve ffmpeg executable | source/globals/ffmpeg.py | source/globals/ffmpeg.py | Python | 0.000001 | @@ -0,0 +1,527 @@
+# -*- coding: utf-8 -*-%0A%0A## %5Cpackage globals.ffmpeg%0A# %0A# Retrieves the FFmpeg executable%0A%0A# MIT licensing%0A# See: LICENSE.txt%0A%0A%0Aimport subprocess%0Afrom subprocess import PIPE%0Afrom subprocess import STDOUT%0A%0A%0Adef GetExecutable(cmd):%0A sp = subprocess.Popen(%5Bu'which... | |
4ae114dd1da8118cc9d2ee87e30f5e0a1f3324f2 | Add some tests for monitor class | tests/test_monitor.py | tests/test_monitor.py | Python | 0 | @@ -0,0 +1,2285 @@
+import unittest%0Aimport Monitors.monitor%0A%0A%0Aclass TestMonitor(unittest.TestCase):%0A%0A safe_config = %7B'partition': '/', 'limit': '10G'%7D%0A%0A one_KB = 1024%0A one_MB = one_KB * 1024%0A one_GB = one_MB * 1024%0A one_TB = one_GB * 1024%0A%0A def test_MonitorInit(self):%0A ... | |
b0f0ee685ca525de90fdcd5a57a203c8b42b936a | test for the bootstrap | tests/install_test.py | tests/install_test.py | Python | 0.000001 | @@ -0,0 +1,905 @@
+import urllib2%0Aimport sys%0Aimport os%0A%0Aprint '**** Starting Test'%0Aprint '%5Cn%5Cn'%0A%0Ais_jython = sys.platform.startswith('java')%0Aif is_jython:%0A import subprocess%0A%0Aprint 'Downloading bootstrap'%0Afile = urllib2.urlopen('http://nightly.ziade.org/bootstrap.py')%0Af = open('bootstra... | |
f9b2bba394ad6ce31ffae5cf6ccf445dc280ba95 | Solve C Mais ou Menos? in python | solutions/beecrowd/2486/2486.py | solutions/beecrowd/2486/2486.py | Python | 1 | @@ -0,0 +1,743 @@
+import sys%0A%0AMIN_VITAMIN_C = 110%0AMAX_VITAMIN_C = 130%0A%0Avitamin_c_catalogue = %7B%0A 'suco de laranja': 120,%0A 'morango fresco': 85,%0A 'mamao': 85,%0A 'goiaba vermelha': 70,%0A 'manga': 56,%0A 'laranja': 50,%0A 'brocolis': 34,%0A%7D%0A%0Afor test in sys.stdin:%0A t = ... | |
076fa3fcc50c9c9b236fc3e35e4e32f77f9fadbb | Fix power_spectrum tests | tests/test__signal.py | tests/test__signal.py | import numpy as np
from acoustics import Signal
import pytest
import itertools as it
#def test_operator():
#n = 10000
#fs = 5000
class TestSignal():
@pytest.fixture(params=[(1, 88200, 22050), (3, 88200, 22050), (3, 88200, 44100)])
def signal(self, request):
return Signal(n... | Python | 0.000009 | @@ -397,24 +397,30 @@
def test_
+power_
spectrum(sel
@@ -465,24 +465,30 @@
er = signal.
+power_
spectrum()%0A
@@ -3085,24 +3085,30 @@
def plot_
+power_
spectrum(sel
@@ -3135,24 +3135,30 @@
signal.plot_
+power_
spectrum()%0A
|
96c8d93cf1b6a01e867ca8250fee4dea5e870c79 | Add files via upload | 4ChanWebScraper.py | 4ChanWebScraper.py | Python | 0 | @@ -0,0 +1,1176 @@
+import requests%0Aimport os%0Aimport sys%0Aimport re%0Afrom BeautifulSoup import BeautifulSoup%0Afrom PIL import Image%0Afrom StringIO import StringIO%0A%0A# try: %0A# opts, args = getopt.getopt(argv, %22u:%22, %5B%22url=%22%5D) %0A# except getopt.GetoptError: ... | |
67c90811afb47fa57af6b61b894e6efd78fa699c | Find a key within a dictionary | python/reddit/find_my_key.py | python/reddit/find_my_key.py | Python | 0.999718 | @@ -0,0 +1,807 @@
+def find_key(info, key):%0A value = -1%0A if isinstance(info, dict):%0A if key in info:%0A print('Found %7B%7D in %7B%7D'.format(key, info))%0A return info.get(key)%0A else:%0A for element in info:%0A print('Testing element %7B%7D'.f... | |
27fca35a08278a44bb7ba693f222c6c182061872 | Add the enemy file and start it up. | Enemy.py | Enemy.py | Python | 0 | @@ -0,0 +1,253 @@
+import pygame%0A%0Aclass Enemy(pygame.sprite.Sprite):%0A%0A def __init__(self, x, y):%0A super().__init__()%0A self.image = pygame.image.load(%22images/enemy.png%22).convert_alpha()%0A self.rect = self.image.get_rect(center=(x, y))%0A%0A def %0A%0A
| |
982cd61d7532365d9de56b308c7a4d8308302c15 | Add a test to demonstrate issue with django 1.11 | tests/testapp/tests/test_model_create_with_generic.py | tests/testapp/tests/test_model_create_with_generic.py | Python | 0 | @@ -0,0 +1,1177 @@
+try:%0A from django.contrib.contenttypes.fields import GenericForeignKey%0Aexcept ImportError:%0A # Django 1.6%0A from django.contrib.contenttypes.generic import GenericForeignKey%0Afrom django.contrib.contenttypes.models import ContentType%0Afrom django.db import models%0Afrom django.test ... | |
efcda7dad6efb189713b8cebb20b4d8b64a85c71 | Add tools/msgpack2json.py | tools/msgpack2json.py | tools/msgpack2json.py | Python | 0.000005 | @@ -0,0 +1,84 @@
+import sys, json, umsgpack%0Ajson.dump(umsgpack.unpack(sys.stdin.buffer), sys.stdout)%0A
| |
0dc5154daa12ea196bb5fdeb1342f6f7b3e6e62b | Add markov model baseline | MarkovModel/model.py | MarkovModel/model.py | Python | 0 | @@ -0,0 +1,1241 @@
+'''%0A Markov Model for transportation%0A Ankur Goswami%0A'''%0A%0Adef load_inputs(datafiles):%0A inputs = %7B%7D%0A for file in datafiles:%0A with open(file, 'r') as rf:%0A for line in rf:%0A split = line.split('%5Ct', 1)%0A segnum = split... | |
50bfa56b660d5d39c1dd7b3d426fcd589a9719bb | add univdump.py for extracting password dumps [wip] | univdump.py | univdump.py | Python | 0 | @@ -0,0 +1,1476 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport re%0Aimport sys%0Aimport collections%0A%0A'''%0AThis script tries its best to fvck these various esoteric hard-to-process%0Auser database dump or leak files.%0A'''%0A%0Are_field = re.compile(r'(%3C%5Cw+%3E)')%0A%0ARecFormat = collections.n... | |
b2e27f42b3f8de10e11faf128183ca5fa3c0ea3f | Add 0025 | Jimmy66/0025/0025.py | Jimmy66/0025/0025.py | Python | 0.999934 | @@ -0,0 +1,1046 @@
+#!/usr/bin/env python3%0A%0Aimport speech_recognition as sr%0Aimport webbrowser%0A%0A# obtain path to %22test.wav%22 in the same folder as this script%0Afrom os import path%0AWAV_FILE = path.join(path.dirname(path.realpath(__file__)), %22test.wav%22)%0A%0A# use %22test.wav%22 as the audio source%0Ar... | |
07f522bed6a285507aadd66df89b14022e1e2a04 | add new package : openresty (#14169) | var/spack/repos/builtin/packages/openresty/package.py | var/spack/repos/builtin/packages/openresty/package.py | Python | 0 | @@ -0,0 +1,1054 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Openresty(AutotoolsPackage):%0A %22%22%22%0A OpenRes... | |
20fc164862f72527ef7d06bcbfe9dc4329ef9fa7 | add problem, hackerrank 005 plus minus | hackerrank/005_plus_minus.py | hackerrank/005_plus_minus.py | Python | 0.001174 | @@ -0,0 +1,1448 @@
+#!/bin/python3%0D%0A%0D%0A%22%22%22%0D%0Ahttps://www.hackerrank.com/challenges/plus-minus?h_r=next-challenge&h_v=zen%0D%0A%0D%0AGiven an array of integers, calculate which fraction of its elements are positive, which fraction of its elements are negative, and which fraction of its elements are zeroe... | |
6e0f585a8f8433d4f6800cb1f093f97f8a1d4ff7 | Update imports for new functions | imageutils/__init__.py | imageutils/__init__.py | Python | 0 | @@ -0,0 +1,840 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst%0A%22%22%22%0AImage processing utilities for Astropy.%0A%22%22%22%0A%0A# Affiliated packages may add whatever they like to this file, but%0A# should keep this content at the top.%0A# ------------------------------------------------------... | |
0573ed88c4de497b2da7088795b0d747bb2bd2ce | Add ICT device | pymodels/middlelayer/devices/ict.py | pymodels/middlelayer/devices/ict.py | Python | 0.000001 | @@ -0,0 +1,1686 @@
+#!/usr/bin/env python-sirius%0A%0Afrom epics import PV%0A%0A%0Aclass ICT:%0A%0A def __init__(self, name):%0A if name in %5B'ICT-1', 'ICT-2'%5D:%0A self._charge = PV('LI-01:DI-' + name + ':Charge-Mon')%0A self._charge_avg = PV('LI-01:DI-' + name + 'ICT-1:ChargeAvg-Mon'... | |
a080713a1dd0dd0c1b9c487f9c5413f3e4419db9 | Create MQTT2StepperMotor.py | MQTT2StepperMotor.py | MQTT2StepperMotor.py | Python | 0.000027 | @@ -0,0 +1,132 @@
+# Author: Anton Gustafsson%0A# Released under MIT license %0A%0A#!/usr/bin/python%0A%0A%0A%0Afrom StepperMotorDriver import MotorControl%0A%0A%0Aclass %0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.