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 |
|---|---|---|---|---|---|---|---|
c15c4a663c257cad6763cf92c50b7ad706017c74 | Remove extraneous imports in the base view package | evesrp/views/__init__.py | evesrp/views/__init__.py | from flask import render_template
from flask.ext.login import login_required
from .. import app
@app.route('/')
@login_required
def index():
return render_template('base.html')
| from collections import OrderedDict
from urllib.parse import urlparse
import re
from flask import render_template, redirect, url_for, request, abort, jsonify,\
flash, Markup, session
from flask.views import View
from flask.ext.login import login_user, login_required, logout_user, \
current_user
from fl... | Python | 0 |
d40b4c250f7d1c0c6a6c198b3e1ea69e0049830e | Create syb.py | syb.py | syb.py | # -*- coding: utf-8 -*-
"""
Star Yuuki Bot
~~~~~~~~~~~
LineClient for sending and receiving message from LINE server.
Copyright: (c) 2015 SuperSonic Software Foundation and Star Inc.
Website:
SuperSonic Software Foundation: http://supersonic-org.cf
Star Inc.: http://startw.cf
Li... | Python | 0.000039 | |
100d30d4f541541a63e4b05adfbd9644d70af453 | Add the lovecat utils. | src/crosscat/lovecat.py | src/crosscat/lovecat.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | Python | 0.000001 | |
774877893b9f94711b717d01b896deefe65eb211 | create file | app.py | app.py | """
@import rdflib external lib
"""
import rdflib
jsonldData = open("LearningObjectsExpanded.jsonld").read()
queryData = open("findRecommendations.query").read()
graph = rdflib.Graph()
graph.parse(data=jsonldData,format='json-ld')
results = graph.query(queryData)
for result in results:
print(result)
| Python | 0.000003 | |
921221e4ad7d74b6f9d8b0b75417fe84fd01715f | Add script to concatenate all titers to one file tracking source/passage Fixes #76 | tdb/concatenate.py | tdb/concatenate.py | import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--files', nargs='*', default=[], help="tsvs that will be concatenated")
parser.add_argument('-o', '--output', type=str, default="data/titers_complete.tsv")
def concat(files,out):
with open(out, 'w') as o:
for filename in files:
... | Python | 0.000003 | |
c26d570e949483224b694574120e37a215dcc348 | Add dataframewriter api example to python graphene (#4520) | ppml/trusted-big-data-ml/python/docker-graphene/examples/sql_dataframe_writer_example.py | ppml/trusted-big-data-ml/python/docker-graphene/examples/sql_dataframe_writer_example.py | from pyspark.sql.functions import *
from pyspark.sql import Row, Window, SparkSession, SQLContext
from pyspark.sql.types import IntegerType, FloatType, StringType
from pyspark.sql import functions as F
from pyspark.sql.functions import rank, min, col, mean
import random
import os
import tempfile
def sql_dataframe_writ... | Python | 0 | |
ad489edc8059b75d9ec78d0aeb03ac3592b93923 | Add Federal Labor Relations Authority. | inspectors/flra.py | inspectors/flra.py | #!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# https://www.flra.gov/OIG
# Oldest report: 1999
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
#
... | Python | 0 | |
241cc8fc668b9f6c38d23a97d9ff28cc4c481bf3 | Create github_watchdog,py | github_watchdog.py | github_watchdog.py | #!/usr/bin/bash
| Python | 0.000126 | |
45af6f13e302fb4e790f8ec5a5730f25c6a9450b | add new segmenter debugging script | kraken/contrib/heatmap_overlay.py | kraken/contrib/heatmap_overlay.py | #! /usr/bin/env python
"""
Produces semi-transparent neural segmenter output overlays
"""
import sys
import torch
import numpy as np
from PIL import Image
from kraken.lib import segmentation, vgsl, dataset
import torch.nn.functional as F
from typing import *
import glob
from os.path import splitext, exists
model = vg... | Python | 0 | |
d39a3bae3f6ca66df044e725cd164082170f4ec7 | Modify the config file. | snippet/lib/python/config.py | snippet/lib/python/config.py | # coding: utf-8
from oslo_config import cfg
from oslo_log import log
CONF = cfg.CONF
_ROOTS = ["root"]
_DEFAULT_LOG_LEVELS = ['root=INFO']
_DEFAULT_LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
def parse_args(argv, project, version=None, default_config_files=None,
default_log_f... | Python | 0 | |
be2f50aae308377dbabd66b5ec78ffb2bd8ae218 | Add tse_number as index | politicos/migrations/versions/488fc5ad2ffa_political_party_add_tse_number_as_index.py | politicos/migrations/versions/488fc5ad2ffa_political_party_add_tse_number_as_index.py | """political party: add tse_number as index
Revision ID: 488fc5ad2ffa
Revises: 192bd4ccdacb
Create Date: 2015-07-08 13:44:38.208146
"""
# revision identifiers, used by Alembic.
revision = '488fc5ad2ffa'
down_revision = '192bd4ccdacb'
from alembic import op
def upgrade():
op.create_index('idx_tse_number', 'pol... | Python | 0.002058 | |
96ecfaa423b2d7829fcda0e56e9adba41a4c6819 | Add unit_tests/s2s_vpn | unit_tests/s2s_vpn.py | unit_tests/s2s_vpn.py | import logging
import fmcapi
import time
def test_ftds2svpns(fmc):
logging.info('Testing FTDS2SVPNs class. Requires at least one registered device.')
starttime = str(int(time.time()))
namer = f'_fmcapi_test_{starttime}'
# Create a Site2Site VPN Policy
vpnpol1 = fmcapi.FTDS2SVPNs(fmc=fmc, name=... | Python | 0.000001 | |
75756f20d4b63daa8425609620e4b32dcb9faab4 | Add cryptography unit with morse code functions | units/cryptography.py | units/cryptography.py |
from .errors import UnitOutputError
character_to_morse = {
'A': ".-", 'B': "-...", 'C': "-.-.", 'D': "-..", 'E': '.', 'F': "..-.", 'G': "--.", 'H': "....",
'I': "..", 'J': ".---", 'K': "-.-", 'L': ".-..", 'M': "--", 'N': "-.", 'O': "---", 'P': ".--.",
'Q': "--.-", 'R': ".-.", 'S': "...", 'T': '-', 'U': "..-", 'V... | Python | 0.000001 | |
93b3cfb5dd465f956fa6c9ceb09be430684c85ae | Add two pass solution | leetcode/q019/solution.py | leetcode/q019/solution.py | """
Given a linked list, remove the n-th node from the end of list and return its head.
Example:
Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from the end, the linked list becomes 1->2->3->5.
Note:
Given n will always be valid.
"""
# Definition for singly-linked list.
#... | Python | 0.000031 | |
295823afe17cedaa1934afbcd19d955974089c63 | Add producer written in Python | python/send.py | python/send.py | #!/usr/bin/env python
import pika
# Host in which RabbitMQ is running.
HOST = 'localhost'
# Name of the queue.
QUEUE = 'pages'
# The message to send.
MESSAGE = 'Hi there! This is a test message =)'
# Getting the connection using pika.
# Creating the channel.
# Declaring the queue.
connection = pika.BlockingConnecti... | Python | 0.000005 | |
04c8b38ac43c84abe64858cfd22a721e803b87eb | add mocked tests for internal /run folder | tests/core/test_run_files.py | tests/core/test_run_files.py | # stdlib
import os
import shlex
import signal
import subprocess
import time
import unittest
# 3p
import mock
from nose.plugins.attrib import attr
# Mock gettempdir for testing
import tempfile; tempfile.gettempdir = mock.Mock(return_value='/a/test/tmp/dir')
# project
# Mock _windows_commondata_path for testing
import... | Python | 0 | |
cf9299aad62828f1cd116403076b2a6b086721d8 | add meta utilities | flask_ember/util/meta.py | flask_ember/util/meta.py | import inspect
def get_class_fields(klass, predicate=None):
return [(name, field) for name, field in klass.__dict__.items()
if (predicate(name, field) if predicate else True)]
def get_fields(klass, predicate=None):
fields = list()
for base in inspect.getmro(klass)[::-1]:
fields.exten... | Python | 0.000001 | |
481a920fe89ea7f0e518b8cf815f966715b20ca3 | add new package : activemq (#14142) | var/spack/repos/builtin/packages/activemq/package.py | var/spack/repos/builtin/packages/activemq/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 Activemq(Package):
"""
Apache ActiveMQ is a high performance Apache 2.0 licensed Messa... | Python | 0 | |
6b9adf9f00b481562cedf2debc5aede947734744 | remove dot | addons/account_analytic_analysis/cron_account_analytic_account.py | addons/account_analytic_analysis/cron_account_analytic_account.py | #!/usr/bin/env python
from osv import osv
from mako.template import Template
import time
try:
import cStringIO as StringIO
except ImportError:
import StringIO
import tools
MAKO_TEMPLATE = u"""Hello ${user.name},
Here is a list of contracts that have to be renewed for two
possible reasons:
- the end of cont... | #!/usr/bin/env python
from osv import osv
from mako.template import Template
import time
try:
import cStringIO as StringIO
except ImportError:
import StringIO
import tools
MAKO_TEMPLATE = u"""Hello ${user.name},
Here is a list of contracts that have to be renewed for two
possible reasons:
- the end of cont... | Python | 0.000012 |
2aa7a6260d9d5a74ee81677be2bd5f97774f9116 | Add tests for internal gregorian functions. | calexicon/internal/tests/test_gregorian.py | calexicon/internal/tests/test_gregorian.py | import unittest
from calexicon.internal.gregorian import is_gregorian_leap_year
class TestGregorian(unittest.TestCase):
def test_is_gregorian_leap_year(self):
self.assertTrue(is_gregorian_leap_year(2000))
self.assertTrue(is_gregorian_leap_year(1984))
self.assertFalse(is_gregorian_leap_yea... | Python | 0 | |
9524230502819a3bfaa670e344e6760f61afbcbe | Create 2048.py | 2048.py | 2048.py | #coding by forsenlol
#!/usr/bin/env python
import pygame
from random import randint
from pygame import font
pygame.font.init()
class Window:
__name = "2048"
__size = [450, 450]
__background_color = "#AA9C99"
__square_size = [98, 98]
__square_clean_color = "#BBADA0"
__square_space = 12
... | Python | 0.998661 | |
387d05dbdb81bacc4851adffbfd7f827e709d4cc | Add Step class - Create Step.py to hold code for the Step class. - The Step class represents a single step/instruction for a Recipe object. | Step.py | Step.py | # Step object
class Step:
# Initiate object
def __init__(self,description):
self.description = description
| Python | 0 | |
7d8a566ac51e7e471603c2160dce2046eb698738 | add sn domains conversion tool | conv.py | conv.py | #!/usr/bin/env python
# Read the wiki for more infomation
# https://github.com/lennylxx/ipv6-hosts/wiki/sn-domains
import sys
table = '1023456789abcdefghijklmnopqrstuvwxyz'
def iata2sn(iata):
global table
sn = ''
for v in iata[0:3]:
i = ((ord(v) - ord('a')) * 7 + 5) % 36
sn += table[i]
... | Python | 0 | |
d2bdbd0d851fda046c0be55105a211a382c22766 | Add Day 2 | day2.py | day2.py | #Advent of Code December 2
#Written by icydoge - icydoge AT gmail dot com
with open('paper.txt') as f:
content = f.read().splitlines()[:-1] #Remove last empty line
part_one_answer = 0
part_two_answer = 0
for box in content:
dimensions = sorted(map(int,box.split('x')))
slack = dimensions[0] * dimensions[1... | Python | 0.000031 | |
acf4ad1e5948354281fec040badfe412f5194529 | add wsgi | flaskr/flaskr.wsgi | flaskr/flaskr.wsgi | <VirtualHost *>
ServerName example.com
WSGIDaemonProcess flaskr user=user1 group=group1 threads=5
WSGIScriptAlias / /var/www/FlaskDB/flaskr/flaskr.wsgi
<Directory /var/www/FlaskDB/flaskr>
WSGIProcessGroup flaskr
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from... | Python | 0.999824 | |
b6fbdd70a0486718d711a7efc310e350a1837b9c | add collapse reads code | seqcluster/collapse.py | seqcluster/collapse.py | import os
from libs.fastq import collapse, splitext_plus
import logging
logger = logging.getLogger('seqbuster')
def collapse_fastq(args):
"""collapse fasq files after adapter trimming
"""
idx = 0
try:
seqs = collapse(args.fastq)
out_file = splitext_plus(os.path.basename(args.fastq))[... | Python | 0.000001 | |
871ec5597059934bce64f7d31fa7e5ab165063ee | Add basic GUI frontend | memorise-frontend.py | memorise-frontend.py | #!/usr/bin/env python
# -*- Coding: utf-8 -*-
from tkinter import Tk, Menu
from ttk import Frame, Button, Style
class MemoriseFrontend(Frame):
version = "0.1-py"
padding = 10
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.style = Style()
... | Python | 0 | |
db81e8ca0b0321994f188daf45211e6ae2dda4a4 | Make a control dataset that only contains sequences with titer data. | dengue/utils/make_titer_strain_control.py | dengue/utils/make_titer_strain_control.py | from Bio import SeqIO
from pprint import pprint
with open('../../data/dengue_titers.tsv', 'r') as f:
titerstrains = set([ line.split()[0] for line in f ])
with open('../../data/dengue_titers.tsv', 'r') as f:
serastrains = set([ line.split()[1] for line in f ])
autologous = titerstrains.intersection(serastrains)
pri... | Python | 0.00001 | |
9a67c8eca45daa2f706e8fc6bde958c37229c837 | Create mpd_mouse_control.py | mpd_mouse_control.py | mpd_mouse_control.py | from evdev import InputDevice
from select import select
import os
import mpd
import socket
import alsaaudio
import time
client = mpd.MPDClient(use_unicode=True)
dev = InputDevice('/dev/input/event2')
drop_lb_event = False
drop_rb_event = False
while True:
r,w,x = select([dev], [], [])
try:
... | Python | 0.000002 | |
d1024a2892c6e171b3d465d56c8a1fad25d7fbdc | Create ESLint styler | zazu/plugins/eslint_styler.py | zazu/plugins/eslint_styler.py | # -*- coding: utf-8 -*-
"""eslint plugin for zazu."""
import zazu.styler
zazu.util.lazy_import(locals(), [
'subprocess',
'os',
'tempfile'
])
__author__ = "Patrick Moore"
__copyright__ = "Copyright 2018"
class eslintStyler(zazu.styler.Styler):
"""ESLint plugin for code styling."""
def style_strin... | Python | 0 | |
6d53fcd788ef985c044657a6bf2e6faa5b8b9673 | Create CVE-2014-2206.py | CVE-2014-2206/CVE-2014-2206.py | CVE-2014-2206/CVE-2014-2206.py | #!/usr/bin/python
# Exploit Title: GetGo Download Manager HTTP Response Header Buffer Overflow Remote Code Execution
# Version: v4.9.0.1982
# CVE: CVE-2014-2206
# Date: 2014-03-09
# Author: Julien Ahrens (@MrTuxracer)
# Homepage: http://www.rcesecurity.com
# Software Link: http://ww... | Python | 0.000011 | |
7cf6d0d214fe0ef8c93bf661e008b256a35a8def | Add tests for unauth_portscan alert | tests/alerts/test_unauth_portscan.py | tests/alerts/test_unauth_portscan.py | from positive_alert_test_case import PositiveAlertTestCase
from negative_alert_test_case import NegativeAlertTestCase
from alert_test_suite import AlertTestSuite
class TestAlertUnauthPortScan(AlertTestSuite):
alert_filename = "unauth_portscan"
# This event is the default positive event that will cause the
... | Python | 0 | |
690b5a994bc20b561632d9aa3e332061457a3d72 | Add missing __init__.py to overkiz tests (#62727) | tests/components/overkiz/__init__.py | tests/components/overkiz/__init__.py | """Tests for the overkiz component."""
| Python | 0.000001 | |
c6b9788296f87a88655778b5d604316f3df11199 | Initial basic setup of openstack and tempest config file | tools/tempest_auto_config.py | tools/tempest_auto_config.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# 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.apach... | Python | 0.998657 | |
318b775a150f03e3311cb1a2b93cf21999fac70d | Create base class for openbox messages and create most of the Messages objects | openbox/messages.py | openbox/messages.py | """
Messages between OBC and OBI
"""
import json
class MessageParsingError(Exception):
pass
class MessageMeta(type):
def __init__(cls, name, bases, dct):
if not hasattr(cls, "messages_registry"):
# this is the base class. Create an empty registry
cls.messages_registry = {}
... | Python | 0 | |
d08426ffde22c2ded72425f1d1c54923b9aa0b97 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/4b193958ac9b893b33dc03cc6882c70ad4ad509d. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "4b193958ac9b893b33dc03cc6882c70ad4ad509d"
TFRT_SHA256 = "5b011d3f3b25e6c9646da078d0db... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "f5ea7e9c419b881d7f3136de7a7388a23feee70e"
TFRT_SHA256 = "723c9b1fabc504fed5b391fc766e... | Python | 0 |
79a38e9ef0ac04c4efef55c26f74ad2b11442a7b | add a command to fix the missing packages | crate_project/apps/crate/management/commands/fix_missing_files.py | crate_project/apps/crate/management/commands/fix_missing_files.py | from django.core.management.base import BaseCommand
from packages.models import ReleaseFile
from pypi.processor import PyPIPackage
class Command(BaseCommand):
def handle(self, *args, **options):
i = 0
for rf in ReleaseFile.objects.filter(digest="").distinct("release__package"):
p = P... | Python | 0.000009 | |
50b9aff7914885b590748ebd8bca4350d138670c | Add admin section for the ``Resources``. | us_ignite/resources/admin.py | us_ignite/resources/admin.py | from django.contrib import admin
from us_ignite.resources.models import Resource
class ResourceAdmin(admin.ModelAdmin):
list_display = ('name', 'slug', 'status', 'is_featured')
search_fields = ('name', 'slug', 'description', 'url')
list_filter = ('is_featured', 'created')
date_hierarchy = 'created'
... | Python | 0 | |
20c9f1416243c020b270041621098ca20e09eca4 | tag retrieval script added | private/scripts/extras/timus_tag_retrieval.py | private/scripts/extras/timus_tag_retrieval.py | """
Copyright (c) 2015-2018 Raj Patel(raj454raj@gmail.com), StopStalk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
... | Python | 0 | |
9932b1989038bd3376b1c5d3f5d9c65a21670831 | add energy calibration to xpd | profile_collection/startup/42-energy-calib.py | profile_collection/startup/42-energy-calib.py | from __future__ import division, print_function
import numpy as np
from lmfit.models import VoigtModel
from scipy.signal import argrelmax
import matplotlib.pyplot as plt
def lamda_from_bragg(th, d, n):
return 2 * d * np.sin(th / 2.) / n
def find_peaks(chi, sides=6, intensity_threshold=0):
# Find all potential... | Python | 0 | |
0136d50265fc390d194436238b88655327982231 | add gobOauth.py | gobOauth.py | gobOauth.py | import praw
import configparser
SAVEFILE = "oauth.ini"
def read_ini():
cfg = configparser.ConfigParser()
cfg.read(SAVEFILE)
return cfg
def get_refreshable_instance():
cfg = read_ini()
reddit = praw.Reddit(client_id=cfg['app']['client_id'],
client_secret=cfg['app']['client_... | Python | 0.000003 | |
e0b84a97e4c7ad5dcef336080657a884cff603fc | Test two windows drawing GL with different contexts. | tests/gl_test_2.py | tests/gl_test_2.py | #!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import pyglet.window
from pyglet.window.event import *
import time
from pyglet.GL.VERSION_1_1 import *
from pyglet.GLU.VERSION_1_1 import *
from pyglet import clock
factory = pyglet.window.WindowFactory()
factory.config._attribut... | Python | 0.000005 | |
bdaa80badf1f3d8c972c5da7d0fe65a0c3f63752 | Update maasutils.py to fix pep8 | tests/maasutils.py | tests/maasutils.py | #!/usr/bin/env python
import os
import sys
import click
from rackspace_monitoring.providers import get_driver
from rackspace_monitoring.types import Provider
import requests
@click.group()
@click.option("--username", required=True)
@click.option("--api-key", required=True)
@click.pass_context
def cli(ctx, api_key, u... | #!/usr/bin/env python
import os
import sys
import click
from rackspace_monitoring.providers import get_driver
from rackspace_monitoring.types import Provider
import requests
@click.group()
@click.option("--username", required=True)
@click.option("--api-key", required=True)
@click.pass_context
def cli(ctx, api_key, u... | Python | 0 |
8affb8e4a3744e604b88157a918ef690203cbfa8 | Remove disallowed characters from stream names. | zerver/migrations/0375_invalid_characters_in_stream_names.py | zerver/migrations/0375_invalid_characters_in_stream_names.py | import unicodedata
from django.db import connection, migrations
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
# There are 66 Unicode non-characters; see
# https://www.unicode.org/faq/private_use.html#nonchar4
unicode_non_chars = set(
chr(x)
... | Python | 0 | |
1deb35d9aa62a6c950cb978063c7f4aed645067b | Add utility module for logging | mediacloud/mediawords/util/log.py | mediacloud/mediawords/util/log.py | import logging
def create_logger(name):
"""Create and return 'logging' instance."""
formatter = logging.Formatter(fmt='%(asctime)s - %(levelname)s - %(module)s - %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
l = logging.getLogger(name)
l.setLevel(logging.DEB... | Python | 0 | |
12c483953f39a3bacaab6d49ba17c4920db52179 | Add script to clean up all FD phone and fax numbers. | firecares/firestation/management/commands/cleanup_phonenumbers.py | firecares/firestation/management/commands/cleanup_phonenumbers.py | from django.core.management.base import BaseCommand
from firecares.firestation.models import FireDepartment
from phonenumber_field.modelfields import PhoneNumber
import re
"""
This command is for cleaning up every phone and fax number in the
database. It removes all non-numeric characters, such as parenthesis,
hyphens... | Python | 0 | |
07d723368550b94202804aa2cc29c6242fbde26e | Add virtual keyboard tool | weboob/tools/virtkeyboard.py | weboob/tools/virtkeyboard.py | # -*- coding: utf-8 -*-
# Copyright(C) 2011 Pierre Mazière
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | Python | 0 | |
c99b4c9c4b42d7f6c1e3800ed5595e86db95b6cf | finish hello world program for dajax | gui/ajax.py | gui/ajax.py | # -*- coding: UTF-8 -*-
'''
Created on 2013-03-25
@author: tianwei
Desc: This module will be used for ajax request, such as form valid, search
query, calculated submit.
'''
import simplejson
from dajaxice.decorators import dajaxice_register
@dajaxice_register(method='GET')
@dajaxice_register(method='POST', n... | Python | 0.997924 | |
88cacd862477ded4344ac1ab3de1580d09f6db9c | add org level and lables | indicators/test.py | indicators/test.py | from django.test import TestCase
from django.test import RequestFactory
from django.test import Client
from indicators.models import Indicator, IndicatorType, DisaggregationType, ReportingFrequency, CollectedData
from workflow.models import Program, Country, Organization
from django.contrib.auth.models import User
cl... | from django.test import TestCase
from django.test import RequestFactory
from django.test import Client
from indicators.models import Indicator, IndicatorType, DisaggregationType, ReportingFrequency, CollectedData
from workflow.models import Program, Country, Organization
from django.contrib.auth.models import User
cl... | Python | 0.000008 |
2db51d6c117bbe0555ddffe34f52679685c68fbb | update url | indicators/urls.py | indicators/urls.py | from django.conf.urls import patterns, include, url
from .views import CollectedDataList, CollectedDataCreate, CollectedDataUpdate, CollectedDataDelete, IndicatorCreate, IndicatorDelete, IndicatorUpdate,\
IndicatorList, IndicatorExport
urlpatterns = patterns('',
###INDICATOR PLANING TOOL
#Home
url(r... | from django.conf.urls import patterns, include, url
from .views import CollectedDataList, CollectedDataCreate, CollectedDataUpdate, CollectedDataDelete, IndicatorCreate, IndicatorDelete, IndicatorUpdate,\
IndicatorList, IndicatorExport, CollectedDataExport
urlpatterns = patterns('',
###INDICATOR PLANING TOO... | Python | 0.000001 |
7d128f2386fd3bbcbff1a407018f9ab9ed580810 | Add tests for path join | tests/test_path.py | tests/test_path.py | from gypsy.path import _join
def test_join():
assert _join('s3://', 'bucket', 'prefix') == 's3://bucket/prefix'
assert _join('s3://bucket', 'prefix') == 's3://bucket/prefix'
assert _join('bucket', 'prefix') == 'bucket/prefix'
| Python | 0 | |
7589e8c746d264b4e8ebcdcf932ddd9620d419a3 | Implement user tests | tests/test_user.py | tests/test_user.py | import unittest
import json
from app import create_app, db
class UserTest(unittest.TestCase):
def setUp(self):
"""Define test variables and initialize app."""
self.app = create_app(config_name="testing")
self.client = self.app.test_client
# binds the app to the current context
... | Python | 0.000048 | |
af2654df47b8b7ea60d78fd7f692e911c2d3a82c | allow oveerride of font used | tests/text_test.py | tests/text_test.py | import sys
import os
import time
import pyglet.window
from pyglet.window.event import *
from pyglet.GL.VERSION_1_1 import *
from pyglet.GLU.VERSION_1_1 import *
from pyglet import clock
from pyglet.text import Font
from ctypes import *
factory = pyglet.window.WindowFactory()
factory.config._attributes['doublebuffer'... | import sys
import os
import time
import pyglet.window
from pyglet.window.event import *
from pyglet.GL.VERSION_1_1 import *
from pyglet.GLU.VERSION_1_1 import *
from pyglet import clock
from pyglet.text import Font
from ctypes import *
factory = pyglet.window.WindowFactory()
factory.config._attributes['doublebuffer'... | Python | 0 |
73e3d7140a6bf24375e08498f754eeac827ca9a1 | Add spider for YMCA | locations/spiders/ymca.py | locations/spiders/ymca.py | # -*- coding: utf-8 -*-
from datetime import datetime
import json
import re
from urllib.parse import urlencode
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
SINGLE_POINT_STATES = [
("0,64.0685,-152.2782,AK"),
("1,20.6538883744,-157.8631750471,HI"),
]
HUN... | Python | 0.000003 | |
4e5a1a799bea020c145e544de255e3322ecc5aed | add kerasCNN | kerasCNN.py | kerasCNN.py | from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import pandas as pd
np.random.seed(1337) # for reproducibility
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, Ma... | Python | 0.999712 | |
7336cc3c89727383c7a9cbbf564f6cfce7f198f9 | add similiarty3.py | app/find_similarity3.py | app/find_similarity3.py | import sys
import string
import requests
import json
import pymysql
import numpy as np
import pandas as pd
from operator import itemgetter
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.decomposition import PCA, RandomizedPCA, TruncatedSVD
from sklearn.preprocessing import Normalizer
def find_com... | Python | 0 | |
08988d19c712ad4604f0acced71a069c7c20067a | Add kv store for file storage | zou/app/stores/file_store.py | zou/app/stores/file_store.py | import flask_fs as fs
from zou.app import app
pictures = fs.Storage("pictures", overwrite=True)
movies = fs.Storage("movies", overwrite=True)
pictures.configure(app)
movies.configure(app)
def make_key(prefix, id):
return "%s-%s" % (prefix, id)
def add_picture(prefix, id, path):
key = make_key(prefix, id... | Python | 0 | |
56c27d56ca16f6659a478af0b6529291b1140636 | Create find-peak-element-ii.py | Python/find-peak-element-ii.py | Python/find-peak-element-ii.py | # Time: O(max(m, n))
# Space: O(1)
class Solution:
#@param A: An list of list integer
#@return: The index of position is a list of integer, for example [2,2]
def findPeakII(self, A):
upper, down = 0, len(A) - 1
left, right = 0, len(A[0]) - 1
while upper < down and le... | Python | 0.00137 | |
49882e51faa26dbaa17a5f3510f0ba215b317dac | add simple test | test/simple.py | test/simple.py | import matplotlib.pyplot as plt
import numpy
numpy.random.seed(0)
N = 1000
Ne = N * 0.8
Ni = N - Ne
a = numpy.concatenate((
0.02 * numpy.ones((Ne, 1)),
0.1 * numpy.ones((Ni, 1))
))
b = numpy.concatenate((
0.2 * numpy.ones((Ne, 1)),
0.2 * numpy.ones((Ni, 1))
))
c = numpy.concatenate((
-65 * numpy.... | Python | 0.000011 | |
32c5a681c7dd498204d38d5d1152aa7f67e09069 | Add feedback entries to the Admin panel | taiga/feedback/admin.py | taiga/feedback/admin.py | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the F... | Python | 0 | |
bcc6639b2a60542b165c38bcff4211d2ed7db816 | add unit tests for dbadmin | testDBAdmin.py | testDBAdmin.py | import unittest
import dbadmin
from unittest.mock import call
from unittest.mock import patch
from unittest.mock import PropertyMock
class TestDBAdmin(unittest.TestCase):
def testHumanizeTime(self):
self.assertEqual(dbadmin.humanize_time(0), '00:00')
self.assertEqual(dbadmin.humanize_time(100... | Python | 0 | |
f68b1a9d5aa2c36f9301588a55bc217a9ed120c1 | Create PowerofThree_001.py | leetcode/326-Power-of-Three/PowerofThree_001.py | leetcode/326-Power-of-Three/PowerofThree_001.py | class Solution(object):
def isPowerOfThree(self, n):
"""
:type n: int
:rtype: bool
"""
return n > 0 and 3 ** round(math.log(n, 3)) == n
| Python | 0.000002 | |
6c00711a5440fe958691c8064227565461e0acdf | add tools for laa analysis | sequana/laa.py | sequana/laa.py | from sequana import BAM
import glob
import pandas as pd
import pylab
class LAA():
def __init__(self, where="bc*"):
self.filenames = glob.glob(where + "/" + "amplicon_*summary.csv")
self.data = [pd.read_csv(this) for this in self.filenames]
def hist_amplicon(self, fontsize=12):
data = ... | Python | 0 | |
bbbe3b7d79d57e350b1203a636b6ea64fe818caa | Update migration chain | src/ggrc/migrations/versions/20160421141928_1257140cbce5_delete_responses_table.py | src/ggrc/migrations/versions/20160421141928_1257140cbce5_delete_responses_table.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: goodson@google.com
# Maintained By: goodson@google.com
"""Delete responses table and any other references to responses
Create Date: 2016-04-21 14:... | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: peter@reciprocitylabs.com
"""Delete responses table and any other references to responses
Create Date: 20... | Python | 0.000001 |
1d3327d8d804a6e53c020e69b77efbea2086379b | Add staging settings file | manchester_traffic_offences/settings/staging.py | manchester_traffic_offences/settings/staging.py | from .base import *
import os
DEBUG = False
TEMPLATE_DEBUG = DEBUG
INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
RAVEN_CONFIG = {
'dsn': os.environ['RAVEN_DSN'],
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ['POSTGRES_DB'],
... | Python | 0 | |
0d2520001a0666114f9a977f6a5dc2d3ed640464 | Create parse.py | BS-seq_oxBS-seq_fixed_parameters/parse.py | BS-seq_oxBS-seq_fixed_parameters/parse.py | #!/usr/bin/env python
import sys
import os
import numpy
import scipy.stats
import scipy.special
import argparse
def generate_output_files(data_file,prior_file,bsEff,bsBEff,oxEff,seqErr,prefix):
# prior for g
g_a, g_b = 2, 2/6.0
# read the input files
data = numpy.loadtxt(data_file,delimiter='\t',skiprows=0,... | Python | 0.00002 | |
a79a463624ab8bf62fe54d2392d4768c5a38626a | Add migration for removing challenge from Participant. (#203) | apps/participants/migrations/0003_remove_participant_challenge.py | apps/participants/migrations/0003_remove_participant_challenge.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-02 14:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('participants', '0002_participantteam_participantteammember'),
]
operations = [
migr... | Python | 0 | |
d78b6c8d0efa3c4b29f254b7465e5e6fcb889395 | Initialize P1_multiplicationTable | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P1_multiplicationTable.py | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P1_multiplicationTable.py | # Create a program multiplicationTable.py that takes a number N from the
# command line and creates an N×N multiplication table in an Excel spreadsheet.
# Row 1 and column A should be used for labels and should be in bold.
| Python | 0.000405 | |
58cfcfbde61859a98b317f0498f35f7b7921e41b | Add dummy FileBrowseField | mezzanine_grappelli/filebrowser/fields.py | mezzanine_grappelli/filebrowser/fields.py | from filebrowser.fields import FileBrowseField as BaseFileBrowseField
class FileBrowseField(BaseFileBrowseField):
pass
| Python | 0 | |
775104979a8ee5be040ac830133e69ca848d1ce1 | add snpPriority.py, LD score and effect size weighted SNP scoring | snpPriority.py | snpPriority.py | '''
snpPriority.py - score SNPs based on their LD score and SE weighted effect sizes
===============================================================================
:Author: Mike Morgan
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
.. Score SNPs based on their LD score and SE weighted effect sizes from... | Python | 0 | |
80d579bd9376d955eab4a431fb3bcb493518582a | Create __init__.py | kernel/__init__.py | kernel/__init__.py | Python | 0.000429 | ||
6deb5c1f2f614e6e6cb420c56c250a27fa032c8b | Add undelete script | bin/undelete.py | bin/undelete.py | #!/usr/bin/env python
"""
Remove the `deleted` tag from containers (recursively) or from individual files.
"""
import argparse
import logging
import sys
import bson
from api import config
from api.dao.containerutil import propagate_changes
log = logging.getLogger('scitran.undelete')
def main():
cont_names = [... | Python | 0.000001 | |
32f29eac0582e73bc17b774a98891d11de760458 | use different implementation for weakmethod, much easier to understand. | kivy/weakmethod.py | kivy/weakmethod.py | '''
Weak Method
===========
:class:`WeakMethod` is used in Clock class to prevent the clock from taking
memory if the object is deleted. Check examples/core/clock_method.py for more
information.
This WeakMethod class is taken from the recipe
http://code.activestate.com/recipes/81253/, based on the nicodemus version.
... | '''
Weak Method
===========
:class:`WeakMethod` is used in Clock class to prevent the clock from taking
memory if the object is deleted. Check examples/core/clock_method.py for more
information.
This WeakMethod class is taken from the recipe
http://code.activestate.com/recipes/81253/, based on the nicodemus version.
... | Python | 0 |
d0cb340a874cc0430c8b77a0af052d8f2fd4d8c3 | test script to cache Genewiki content | scheduled_bots/cache/genes/getWDHumanGenes.py | scheduled_bots/cache/genes/getWDHumanGenes.py | from wikidataintegrator import wdi_core
import pandas as pd
from rdflib import Graph
import time
import sys
query = """
SELECT * WHERE {
?item wdt:P31 wd:Q7187 ;
wdt:P703 wd:Q15978631 .
}
"""
kg = Graph()
results = wdi_core.WDItemEngine.execute_sparql_query(query)
i =0
for qid in results["results"]["binding... | Python | 0 | |
4f2df78c7d8a9621340ff4ee5cfc6f22548d26d5 | add TracedThread that continues the context propagation | proposal/helpers.py | proposal/helpers.py | """Helpers that are used in examples. In the current state, we may not require
to put these classes and functions as part of the main proposal.
"""
from threading import Thread
from proposal import tracer
class TracedThread(Thread):
"""Helper class OpenTracing-aware, that continues the propagation of
the curr... | Python | 0 | |
8f1beddb8e3d1a63df10fcde9d3faae0d8d11171 | Add kodi_automation.py | kodi_automation.py | kodi_automation.py |
import sys
import argparse
def Classification(paths):
return ([], [])
def MoveMoveFile(path, movies_dir, dry_run=False):
if dry_run:
sys.stderr.write('Moving movie', path)
return
def MoveEpisodeFile(path, seria, season, episode, series_dir, dry_run=False):
if dry_run:
sys.stderr.write('Moving e... | Python | 0.00001 | |
d1ca3e7363b835aeca7be2fa00cd7083d9fc8c08 | Create divide_by_year.py | pipeline/preprocessing/google/divide_by_year.py | pipeline/preprocessing/google/divide_by_year.py | import glob
import gzip
import codecs
import re
import sys
import os
with_pos = False
targets = {}
my_buffer = {}
def flush(a_buffer, some_targets, a_year):
for line in a_buffer[a_year]:
some_targets[a_year].write(line)
a_buffer[a_year].clear()
if len(sys.argv) != 3:
raise ... | Python | 0.999031 | |
8832a542405a1999c296cc8b55d454b8cf35b5ea | Add merge.py | algorithms/merge.py | algorithms/merge.py | import sys
sys.setrecursionlimit(1000000)
class Merge:
def merge_sort(self, lists):
if len(lists) <= 1:
return lists
num = len(lists) // 2
left = self.merge_sort(lists[:num])
right = self.merge_sort(lists[num:])
return self.merge(left, right)
def merge(sel... | Python | 0.000003 | |
85b518638e990cb7be298ea4b533aa465dd681b5 | Add models to store data in... | acctwatch/models.py | acctwatch/models.py | from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
relationship,
)
DBSession = scoped_session(sessionmaker())
Base = declarative_base()
class LoginItem(Base):
__table__ = Table('login_item', Base.metadata,
... | Python | 0 | |
42e88bc8e6d81916164e8e0fe6b8b6c476567526 | add script to integrate disambiguated results | integrate.py | integrate.py | #!/usr/bin/env python
"""
Takes in a CSV file that represents the output of the disambiguation engine:
Patent Number, Firstname, Lastname, Unique_Inventor_ID
Groups by Unique_Inventor_ID and then inserts them into the Inventor table using
lib.alchemy.match
"""
import sys
import lib.alchemy as alchemy
from lib.util.c... | Python | 0 | |
80ecafd51cf258880bb5b1e183d5dd166c2d18fc | Add lockrun.py | lockrun.py | lockrun.py | import optparse
import signal
import threading
import syslog
import time
import os
import re
def find_process(first_pid, process):
# Find a process in /proc
process = re.sub(" +", " ", process).strip()
m = re.compile("^[0-9]+$")
all_proc = [ x for x in os.listdir("/proc") if m.search(x)]
for p in ... | Python | 0.000002 | |
1551cb57ab21364a4e96fa109786ccb0a4ccc3a0 | Create MergeCSVs.py | utils/MergeCSVs.py | utils/MergeCSVs.py | # merge all columns of the csv file in current directory into a single 'merge.csv' file.
# requires pandas librairy to be installed.
# you can customize the merge in many ways: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.concat.html
import pandas as pd
import glob
dfs = glob.glob('*.csv')
resul... | Python | 0 | |
9b6c1af3420653124495103169865036df4f7705 | Add logging module for Pyro-related debugging | osbrain/logging.py | osbrain/logging.py | import os
os.environ["PYRO_LOGFILE"] = "pyro_osbrain.log"
os.environ["PYRO_LOGLEVEL"] = "DEBUG"
| Python | 0 | |
bb188bcc196b12842378aa1c0c535800717a6b61 | add example to extract word frequencies | polbotcheck/word_frequencies.py | polbotcheck/word_frequencies.py | import nltk
from nltk.corpus import stopwords
def get_word_frequencies(text, words_n=10, lang='german'):
default_stopwords = set(nltk.corpus.stopwords.words(lang))
words = nltk.tokenize.word_tokenize(text)
words = [word for word in words if len(word) > 1]
words = [word for word in words if not word.isn... | Python | 0.001091 | |
1281d0e298d5b68f55e5c290e145ec0255552d7a | add tests | tests/test_backlight.py | tests/test_backlight.py | import i3pystatus.backlight as backlight
import os
import pytest
from contextlib import contextmanager
from operator import itemgetter
from tempfile import TemporaryDirectory
@contextmanager
def setattr_temporarily(obj, attr, value):
old_value = getattr(obj, attr)
setattr(obj, attr, value)
yield
set... | Python | 0 | |
20ecbf00c05d1f959e78cbf87cf459fd46dea59f | Create pythonhelloworld.py | pythonhelloworld.py | pythonhelloworld.py | print "hello world"
| Python | 0.999993 | |
99a63431e441a1c52d3f16f6faf0594497755d45 | add a new special case install_zstack. It only installs zstack and initalize database, but not do any real cloud deployment | integrationtest/vm/basic/install_zstack.py | integrationtest/vm/basic/install_zstack.py | '''
@author: Youyk
'''
import os
import zstackwoodpecker.setup_actions as setup_actions
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_util as test_util
USER_PATH = os.path.expanduser('~')
EXTRA_SUITE_SETUP_SCRIPT = '%s/.zstackwoodpecker/extra_suite_setup_config.sh' % USER_PATH
... | Python | 0 | |
c6ded12845f25e305789840e1687bfee83e82be5 | Add a few simple pytest tests | tests/test_standings.py | tests/test_standings.py | #!/usr/bin/env python
import pytest
from datetime import datetime
from mlbgame import standings
date = datetime(2017, 5, 15, 19, 4, 59, 367187)
s = standings.Standings(date)
def test_standings_url():
standings_url = 'http://mlb.mlb.com/lookup/json/named.standings_schedule_date.bam?season=2017&' \
'sche... | Python | 0 | |
b04cc629279dc6d8cf09b4ed3e559e7693a77e02 | Add unit tests to check for all files in conf/ to be commented out | tests/unit/conf_test.py | tests/unit/conf_test.py | # -*- coding: utf-8 -*-
'''
Unit tests for the files in the salt/conf directory.
'''
# Import Python libs
from __future__ import absolute_import
import os
# Import Salt Testing libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import (
NO_MOCK,
... | Python | 0 | |
5f5c98df4349fb31f0311b1fb7f0e6b9092b4b59 | add API example | apibinding/examples/example.py | apibinding/examples/example.py | import httplib
import json
import time
# return a dict containing API return value
def api_call(session_uuid, api_id, api_content):
conn = httplib.HTTPConnection("localhost", 8080)
headers = {"Content-Type": "application/json"}
if session_uuid:
api_content["session"] = {"uuid": session_uuid}
... | Python | 0 | |
01ee5e64093bfd6f6c57c27d189408f2f765f2b4 | Create load_from_numpy.py | load_from_numpy.py | load_from_numpy.py | import os
import torch
from torch.autograd import Variable
from torch import optim
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import models
import argparse
import time
import math
parser = argparse.ArgumentParser(description='load_from_numpy.py')
parser.add_argument('-save_model', defau... | Python | 0.000005 | |
03123c64835f0a1d4cb16cbc638a432b99cc9d04 | Add a test case for #605 - the issue has been fixed by #606 | integration_tests/rtm/test_issue_605.py | integration_tests/rtm/test_issue_605.py | import asyncio
import collections
import logging
import os
import threading
import time
import unittest
import pytest
from integration_tests.env_variable_names import SLACK_SDK_TEST_CLASSIC_APP_BOT_TOKEN, \
SLACK_SDK_TEST_RTM_TEST_CHANNEL_ID
from slack import RTMClient, WebClient
class TestRTMClient_Issue_605(u... | Python | 0 | |
54a41d23554c16c768a1113d8ad74291ad44bd67 | Add initial distributed hash map index | maras/index/dhm.py | maras/index/dhm.py | '''
A hash based index
'''
# Write sequence:
# 1. Get hash map file and file num
# 2. Write to associated storage file
# 3. Write to associated index file
# 4. Write to associated hash map file
# Import python libs
import struct
import os
# Import maras libs
import maras.utils
# Import third party libs
import msgpac... | Python | 0 | |
66d3d329674521c8756a8644f2f0a58824a1ec41 | add spider for ups freight | locations/spiders/ups_freight_service_centers.py | locations/spiders/ups_freight_service_centers.py | # -*- coding: utf-8 -*-
import re
import scrapy
from locations.items import GeojsonPointItem
class UPSFreightServiceCenter(scrapy.Spider):
download_delay = 0.2
name = "ups_freight_service_centers"
allowed_domains = ["upsfreight.com"]
start_urls = (
'https://www.upsfreight.com/ProductsandServi... | Python | 0.000001 | |
9311d3d4acd8c67c20d76cc74d00e0f5a83318e6 | add product-of-array-except-self | vol5/product-of-array-except-self/product-of-array-except-self.py | vol5/product-of-array-except-self/product-of-array-except-self.py | class Solution(object):
def productExceptSelf(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
n = len(nums)
ret = [1] * n
product = 1
for i in range(n):
ret[i] = product
product *= nums[i]
product = 1
... | Python | 0.999376 | |
2c1e5286eca392854bf311e01d1131c45167973f | add coco benchmarking | benchmarks/coco.py | benchmarks/coco.py | """
This benchmark example uses the coco benchmark set of functions
(<http://coco.gforge.inria.fr/>, <https://github.com/numbbo/coco>)
to compare optimizers provided by fluentopt between themselves and also
with CMA-ES[1].
To run these benchmarks, the package 'cocoex' must be installed,
check <https://github.com/numbbo... | Python | 0.000001 | |
6ae6544cca07e857d680d199b2c2f436cb1d9a82 | add wordpress stats | wordpress_stats.py | wordpress_stats.py | from utils import *
import urllib, json
import time
import datetime
def dump(blogid,filepath):
posts = []
offset = 0
while True:
puts("offset",offset)
url = "https://public-api.wordpress.com/rest/v1/sites/" + blogid + "/posts?number=100&offset=" + str(offset)
response = ... | Python | 0.000001 | |
3a5d29bbdbe60558d5f76e6311635bd340b21a57 | add test_lopf_constraints test | test/test_lopf_constraints.py | test/test_lopf_constraints.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 1 15:20:12 2022
@author: fabian
"""
import pytest
import pandas as pd
from pypsa.descriptors import (
expand_series,
get_switchable_as_dense as get_as_dense,
nominal_attrs,
)
TOLERANCE = 1e-2
def describe_storage_unit_contraints(n)... | Python | 0.001036 | |
e349a43ad33abf0e6cce2a410e0e6cb2342456f1 | No in Python | 2017-05-06/no.py | 2017-05-06/no.py | print('No!') | Python | 0.999311 | |
9cc09c6143025d88eedfa4f8eedcd23e2fe7990e | Create sahilprakash.py | Python/sahilprakash.py | Python/sahilprakash.py | print("Hello World!")
| Python | 0.000024 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.