repo_name stringlengths 8 92 | path stringlengths 5 221 | copies stringclasses 10
values | size stringlengths 4 6 | content stringlengths 974 828k | license stringclasses 15
values | hash int64 -9,212,977,344,346,658,000 9,220,224,517B | line_mean float64 8.67 91.6 | line_max int64 15 966 | alpha_frac float64 0.29 0.86 | autogenerated bool 1
class | nl_text stringlengths 0 164k | nl_size int64 0 164k | nl_language stringclasses 17
values | nl_language_score float64 0.04 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pansapiens/mytardis | tardis/apps/mx_views/views.py | 3 | 2892 | from django.conf import settings
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.http import HttpResponse
from tardis.tardis_portal.auth import decorators as authz
from tardis.tardis_portal.models import Dataset
from tardis.tardis_portal.shortcuts import get_experiment_referer
from tard... | bsd-3-clause | -8,726,488,663,588,781,000 | 37.052632 | 79 | 0.65491 | false | Displays a MX Dataset and associated information.
Shows a full (hundreds of images) dataset its metadata and a list
of associated files with the option to show metadata of each file
and ways to download those files. With write permission this page
also allows uploading and metadata editing.
Settings for this view:
I... | 687 | en | 0.873705 |
twidi/pytyrant | pytyrant.py | 1 | 14361 | """Pure python implementation of the binary Tokyo Tyrant 1.1.17 protocol
Tokyo Cabinet <http://tokyocabinet.sourceforge.net/> is a "super hyper ultra
database manager" written and maintained by Mikio Hirabayashi and released
under the LGPL.
Tokyo Tyrant is the de facto database server for Tokyo Cabinet written and
ma... | mit | -5,985,833,604,781,468,000 | 25.110909 | 114 | 0.572871 | false | Tyrant Protocol constants
Dict-like proxy for a Tyrant instance
Hot-copy the database to path
Call func(key, value) with opts
opts is a bitflag that can be RDBXOLCKREC for record locking
and/or RDBXOLCKGLB for global locking
Get up to the first maxkeys starting with prefix
Get the value of a key from... | 2,884 | en | 0.728095 |
HonzaKral/curator | test_curator/integration/test_time_based.py | 1 | 1872 | from datetime import datetime, timedelta
import curator
from . import CuratorTestCase
class TestTimeBasedDeletion(CuratorTestCase):
def test_curator_will_properly_delete_indices(self):
self.create_indices(10)
self.run_curator(delete_older=3)
mtd = self.client.cluster.state(index=self.args... | apache-2.0 | -1,606,032,251,548,790,800 | 40.6 | 91 | 0.634615 | false | wrong precision wrong prefix yesterday is always save since we reset to mignight and do <, not <= | 97 | en | 0.87491 |
chaubold/hytra | tests/core/test_conflictingsegmentations.py | 1 | 5839 | from __future__ import print_function, absolute_import, nested_scopes, generators, division, with_statement, unicode_literals
import logging
from hytra.core.ilastik_project_options import IlastikProjectOptions
from hytra.jst.conflictingsegmentsprobabilitygenerator import ConflictingSegmentsProbabilityGenerator
from hy... | mit | -4,230,047,409,174,636,000 | 43.572519 | 125 | 0.679911 | false | def test_twoSegmentations(): set up ConflictingSegmentsProbabilityGenerator ilpOptions = IlastikProjectOptions() ilpOptions.divisionClassifierPath = None ilpOptions.divisionClassifierFilename = None ilpOptions.rawImageFilename = 'tests/multiSegmentationHypothesesTestDataset/Raw.h5' ilpOptions.r... | 4,642 | en | 0.494544 |
makelove/OpenCV-Python-Tutorial | ch21-轮廓Contours/21-findContour.py | 1 | 1096 | # -*- coding: utf-8 -*-
import numpy as np
import cv2
# im = cv2.imread('test.jpg')#
# im = cv2.imread('poker5hearts.jpg')#
# im = cv2.imread('../data/black-white-rect.png')#contour.jpg #
im = cv2.imread('../data/chessboard.jpeg')
imgray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
cv2.imshow("imgray", imgray)
#需要注意的是cv2... | mit | -2,430,169,206,289,489,000 | 31.8 | 113 | 0.703252 | false | -*- coding: utf-8 -*- im = cv2.imread('test.jpg') im = cv2.imread('poker5hearts.jpg') im = cv2.imread('../data/black-white-rect.png')contour.jpg 需要注意的是cv2.findContours()函数接受的参数为二值图,即黑白的(不是灰度图) 所以读取的图像要先转成灰度的,再转成二值图 ret, thresh = cv2.threshold(imgray, 0, 25, 0) ret, thresh = cv2.threshold(imgray, 0, 100, 0)src, thresh, ... | 417 | zh | 0.186756 |
llllllllll/codetransformer | codetransformer/tests/test_code.py | 1 | 5761 | from dis import dis
from io import StringIO
from itertools import product, chain
import random
import sys
import pytest
from codetransformer.code import Code, Flag, pycode
from codetransformer.instructions import LOAD_CONST, LOAD_FAST, uses_free
@pytest.fixture(scope='module')
def sample_flags(request):
random.... | gpl-2.0 | -3,448,919,409,673,295,000 | 24.95045 | 79 | 0.571949 | false | ayy lmao DO NOT ADD EXTRA LINES HERE pragma: no cover return None return None not in instrs pragma: no cover | 108 | en | 0.443557 |
Azure/azure-sdk-for-python | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/models/_management_lock_client_enums.py | 1 | 1363 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | mit | 8,379,623,869,956,419,000 | 37.942857 | 94 | 0.599413 | false | The lock level of the management lock.
Return the enum member matching `name`
We use __getattr__ instead of descriptors or inserting into the enum
class' __dict__ in order to support `name` and `value` being both
properties for enum members (which live in the class' __dict__) and
enum members themselves.
coding=... | 765 | en | 0.715261 |
jvs/sourcer | tests/test_salesforce.py | 1 | 5119 | from sourcer import Grammar
# This is work in progress.
# See: https://help.salesforce.com/articleView?id=customize_functions.htm&type=5
g = Grammar(r'''
```
import ast
```
start = Expression
Expression = OperatorPrecedence(
Atom | "(" >> Expression << ")",
Postfix(ArgumentList |... | mit | -7,452,110,781,552,088,000 | 27.126374 | 83 | 0.540535 | false | This is work in progress. See: https://help.salesforce.com/articleView?id=customize_functions.htm&type=5 Incomplete collection of evaluators. Look up identifiers. Look up fields. Evaluate function calls and operators. Check if we're using an alias. Explicitly compare to True. Explicitly compare to False. | 305 | en | 0.781889 |
lsaffre/timtools | timtools/sdoc/feeders.py | 1 | 1705 | ## Copyright 2003-2009 Luc Saffre
## This file is part of the TimTools project.
## TimTools is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later v... | bsd-2-clause | 5,341,080,861,915,417,000 | 27.416667 | 71 | 0.63871 | false | Copyright 2003-2009 Luc Saffre This file is part of the TimTools project. TimTools is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. TimTools i... | 745 | en | 0.879061 |
souravbadami/zulip | zerver/views/home.py | 1 | 17065 | from __future__ import absolute_import
from typing import Any, List, Dict, Optional, Text
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse, HttpRequest
from django.shortcuts import redirect
from django.utils import translation
from... | apache-2.0 | -2,616,524,014,721,912,000 | 44.75067 | 113 | 0.642309 | false | Discrimiate CSS served to clients based on User Agent
Due to QTBUG-3467, @font-face is not supported in QtWebKit.
This may get fixed in the future, but for right now we can
just serve the more conservative CSS to all our desktop apps.
type: (HttpRequest) -> HttpResponse type: (UserProfile) -> int TODO: We may want t... | 2,607 | en | 0.851039 |
ZeitOnline/zeit.newsletter | src/zeit/newsletter/browser/edit.py | 1 | 2579 | from zeit.cms.i18n import MessageFactory as _
from zope.cachedescriptors.property import Lazy as cachedproperty
import os.path
import zeit.cms.browser.view
import zeit.cms.content.interfaces
import zeit.cms.interfaces
import zeit.content.image.interfaces
import zeit.content.video.interfaces
import zeit.edit.browser.for... | bsd-3-clause | -2,014,002,219,757,949,200 | 27.032609 | 79 | 0.67119 | false | Handler to drop objects to the body's landing zone.
Handler to drop objects after other objects.
XXX copy&paste&tweak of zeit.content.cp.browser.blocks.teaser.Display | 168 | en | 0.665579 |
vadyur/script.media.aggregator | anidub.py | 1 | 12586 | # coding: utf-8
import log
from log import debug
from settings import Settings
from base import *
import feedparser, urllib2, re
from bs4 import BeautifulSoup
from nfowriter import *
from strmwriter import *
import requests, filesystem
################################################################################... | gpl-3.0 | 2,000,693,373,387,839,200 | 26.610619 | 118 | 0.567228 | false | coding: utf-8============================================================================================================================================================================================html_doc = '<?xml version="1.0" encoding="UTF-8" ?>\n<html>' + content.encode('utf-8') + '\n</html>'===================... | 1,155 | fr | 0.288662 |
robdobsn/AmazonEchoShopping | WaitroseService/WaitroseScraper.py | 1 | 20691 | # Waitrose web scraper
__author__ = 'robdobsn'
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import selenium.webdriver.support.ui as webdriverui
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.common.exceptions import... | isc | -783,531,863,977,082,500 | 46.895833 | 169 | 0.581654 | false | Waitrose web scraper if self.execUsingJS: self.webDriver.execute_script("document.getElementsByClassName('" + elemId + "').value = '" + strToSend) else: Start the web driver (runs the browser) Clear current session file info Create WebDriver or add to your PATH Set the window size (seems to be n... | 1,408 | en | 0.793458 |
kidscancode/gamedev | pygame template.py | 1 | 1508 | # Pygame Template
# Use this to start a new Pygame project
# KidsCanCode 2015
import pygame
import random
# define some colors (R, G, B)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
BLACK = (0, 0, 0)
FUCHSIA = (255, 0, 255)
GRAY = (128, 128, 128)
LIME = (0, 128, 0)
MAROON = (128, 0, 0)
NAVYBLU... | mit | 3,454,655,415,024,161,000 | 22.936508 | 55 | 0.63992 | false | Pygame Template Use this to start a new Pygame project KidsCanCode 2015 define some colors (R, G, B) basic constants to set up your game initialize pygame initialize sound - uncomment if you're using sound pygame.mixer.init() create the game window and set the title start the clock set the 'running' variable to False t... | 611 | en | 0.796027 |
JacobFischer/Joueur.py | games/anarchy/forecast.py | 1 | 2074 | # Forecast: The weather effect that will be applied at the end of a turn, which causes fires to spread.
# DO NOT MODIFY THIS FILE
# Never try to directly create an instance of this class, or modify its member variables.
# Instead, you should only be reading its variables and calling its functions.
from games.anarchy.... | mit | 66,524,175,843,730,740 | 37.407407 | 146 | 0.671167 | false | The class representing the Forecast in the Anarchy game.
The weather effect that will be applied at the end of a turn, which causes fires to spread.
Initializes a Forecast with basic logic as provided by the Creer code generator.
The Player that can use WeatherStations to control this Forecast when its the nextForecas... | 1,437 | en | 0.896141 |
hhucn/git-vote | git-vote/__main__.py | 1 | 3022 | import argparse
import collections
import re
import subprocess
NOTES_REF = 'refs/notes/votes'
Vote = collections.namedtuple('Vote', ['commit', 'user'])
def vote(args):
assert args.user, 'TODO: determine user automatically'
vote = 'vote:%s' % args.user
subprocess.check_call([
'git', 'notes', '--ref', NOTES_R... | apache-2.0 | 2,600,720,082,252,724,000 | 28.627451 | 106 | 0.676704 | false | Returns a dict commit id => set of users
TODO: prevent voting twice as same user TODO use dulwich or something more efficient here TODO ignore invalid votes TODO check re for user spec TODO more algorithms | 208 | en | 0.611144 |
DigitalCampus/django-nurhi-oppia | oppia/tests/av/test_permissions.py | 1 | 2347 | from django.urls import reverse
from django.test import TestCase
from oppia.tests.utils import *
class PermissionsViewTest(TestCase):
fixtures = ['user.json', 'oppia.json', 'quiz.json', 'permissions.json']
def setUp(self):
super(PermissionsViewTest, self).setUp()
self.login_url = reverse('pr... | gpl-3.0 | -4,483,428,020,845,946,400 | 33.514706 | 79 | 0.608862 | false | upload media file | 17 | en | 0.967431 |
kerimlcr/ab2017-dpyo | ornek/lollypop/lollypop-0.9.229/src/web.py | 1 | 7411 | # Copyright (c) 2014-2016 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later vers... | gpl-3.0 | 2,696,436,820,573,915,000 | 36.619289 | 79 | 0.54716 | false | Web helper
Init helper
Save item into collection as album
@param item as SearchItem
@param persistent as DbPersistent
Save cover to store
@param item as SearchItem
@param album id as int
Save item into collection as track
@param item as SearchItem
@param persistent as DbPersistent
@param album artist as str
@return (al... | 1,679 | en | 0.90097 |
pybel/pybel | src/pybel/io/nodelink.py | 1 | 7238 | # -*- coding: utf-8 -*-
"""Conversion functions for BEL graphs with node-link JSON."""
import gzip
import json
from io import BytesIO
from itertools import chain, count
from operator import methodcaller
from typing import Any, Mapping, TextIO, Union
from networkx.utils import open_file
from .utils import ensure_ver... | mit | 2,647,336,991,651,230,700 | 31.168889 | 115 | 0.635811 | false | Add the SHA-512 identifier to a node's dictionary.
Return graph from node-link data format.
Adapted from :func:`networkx.readwrite.json_graph.node_link_graph`
Convert a BEL graph to a node-link format.
:param graph: BEL Graph
Adapted from :func:`networkx.readwrite.json_graph.node_link_data`
Build a graph from node-l... | 1,089 | en | 0.768174 |
seecr/meresco-examples | meresco/__init__.py | 1 | 1394 | ## begin license ##
#
# "Meresco Examples" is a project demonstrating some of the
# features of various components of the "Meresco Suite".
# Also see http://meresco.org.
#
# Copyright (C) 2007-2008 SURF Foundation. http://www.surf.nl
# Copyright (C) 2007-2010 Seek You Too (CQ2) http://www.cq2.nl
# Copyright (C) 2007... | gpl-2.0 | -214,853,663,805,945,660 | 42.5625 | 95 | 0.738164 | false | begin license "Meresco Examples" is a project demonstrating some of the features of various components of the "Meresco Suite". Also see http://meresco.org. Copyright (C) 2007-2008 SURF Foundation. http://www.surf.nl Copyright (C) 2007-2010 Seek You Too (CQ2) http://www.cq2.nl Copyright (C) 2007-2009 Stichting Kenni... | 1,252 | en | 0.812401 |
Mozu/mozu-python-sdk | mozurestsdk/platform/tenantextensions.py | 1 | 2242 |
"""
This code was generated by Codezu.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
"""
from mozurestsdk.mozuclient import default as default_client
from mozurestsdk.mozuurl import MozuUrl;
from mozurestsdk.urllocation import UrlLocation
from mozure... | apache-2.0 | -7,380,671,656,172,497,000 | 32.181818 | 266 | 0.727029 | false | Retrieves the Arc.js configuration settings for a site.
Args:
| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may ca... | 1,036 | en | 0.586329 |
nigelb/SerialGrabber | examples/MQTT/SerialGrabber_Settings.py | 1 | 2043 | #!/usr/bin/env python
# SerialGrabber reads data from a serial port and processes it with the
# configured processor.
# Copyright (C) 2012 NigelB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundatio... | gpl-2.0 | 1,560,382,958,900,706,000 | 33.05 | 75 | 0.751836 | false | !/usr/bin/env python SerialGrabber reads data from a serial port and processes it with the configured processor. Copyright (C) 2012 NigelB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either versi... | 856 | en | 0.885872 |
lqmanh/daethon | test_daethon.py | 1 | 1817 | import os
import sys
import time
import pytest
from daethon import Daemon
class TDaemon(Daemon):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
with open('testing_daemon', 'w') as f:
f.write('inited')
def run(self):
time.sleep(1)
with open(... | apache-2.0 | -3,047,666,419,461,129,700 | 22.597403 | 66 | 0.603192 | false | clean up files if necessary | 27 | en | 0.147904 |
msteinhoff/foption-bot | src/python/core/messages.py | 1 | 2244 | # -*- coding: UTF-8 -*-
"""
$Id$
$URL$
Copyright (c) 2010 foption
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modif... | mit | 6,695,913,913,734,353,000 | 27.769231 | 77 | 0.750446 | false | -*- coding: UTF-8 -*-reply.add('deine mutter hat gefailed.')return "OHFUCKOHFUCKOHFUCK Etwas lief schief! Datenbankfehler"return "Error 555!"reply.add('Deine Mutter hat die Datenbank gefressen') | 194 | de | 0.81264 |
logicabrity/aeon | test/test_measurement.py | 1 | 1229 | import time
import pytest
from aeon.measurement import Measurement
from aeon.errors import InvalidMeasurementState
def test_cant_start_measurement_twice():
m = Measurement("name", "group")
m.start()
with pytest.raises(InvalidMeasurementState):
m.start()
def test_cant_stop_measurement_before_star... | mit | -1,662,716,423,659,156,000 | 21.345455 | 58 | 0.656631 | false | 0 | en | 0.110449 | |
maas/maas | src/maasserver/middleware.py | 1 | 18463 | # Copyright 2012-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Access middleware."""
import http.client
import json
import logging
from pprint import pformat
import sys
import traceback
import attr
from crochet import TimeoutError
f... | agpl-3.0 | -8,170,894,622,841,870,000 | 34.505769 | 96 | 0.611222 | false | A middleware for handling RPC errors in API requests.
Protect access to views.
Most UI views are visible only to logged-in users, but there are pages
that are accessible to anonymous users (e.g. the login page!) or that
use other authentication (e.g. the MAAS API, which is managed through
piston).
A Middleware to deci... | 4,482 | en | 0.836426 |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 21