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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
andrewjrobinson/FreeCAD_sf_master | src/Mod/Draft/DraftTrackers.py | 1 | 34739 | #***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* ... | lgpl-2.1 | -1,483,052,015,789,805,300 | 37.945067 | 114 | 0.567259 | false | **************************************************************************** ** Copyright (c) 2011 * * Yorik van Havre <yorik@uncreated.net> * * ... | 2,334 | en | 0.785871 |
CiscoSystems/os-sqe | lab/scenarios/servers_from_snapshot_scenario.py | 1 | 1179 | from lab.test_case_worker import TestCaseWorker
class ServersFromSnapshotScenario(TestCaseWorker):
ARG_MANDATORY_N_SERVERS = 'n_servers'
ARG_MANDATORY_UPTIME = 'uptime'
def check_arguments(self):
assert self.n_servers >= 1
assert self.uptime > 10
@property
def n_servers(self):
... | apache-2.0 | 719,308,940,948,195,300 | 30.864865 | 174 | 0.648855 | false | 0 | en | 0.110449 | |
kreatorkodi/repository.torrentbr | plugin.video.youtube/resources/lib/youtube_plugin/kodion/impl/xbmc/xbmc_context_ui.py | 1 | 5105 | __author__ = 'bromix'
from six import string_types
import xbmc
import xbmcgui
from ..abstract_context_ui import AbstractContextUI
from .xbmc_progress_dialog import XbmcProgressDialog
from .xbmc_progress_dialog_bg import XbmcProgressDialogBG
from ... import constants
from ... import utils
class XbmcContextUI(Abstra... | gpl-2.0 | 5,859,240,278,206,949,000 | 33.261745 | 108 | 0.610382 | false | fallback for Frodo Starting with Gotham (13.X > ...) | 52 | en | 0.657464 |
fernan9/LANGEBIO-Internship | BLAST_rbh_run.py | 1 | 3987 | #! /usr/bin/env python
""" DESCRIPTION
"""
import glob, sys, csv
from tabulate import tabulate
from Bio.Blast.Applications import NcbiblastpCommandline
"""--- FUNCTIONS ---"""
def carga_csv(file_name):
""" creates a list of lists with a csv file """
tabla = []
cr = csv.reader(open(file_name,"rb"))
... | gpl-2.0 | -2,226,153,138,521,786,600 | 34.598214 | 118 | 0.610986 | false | ! /usr/bin/env python charge csv file present csv data present options: blast parameters, comparison parameters, run create commands for comparisons run commands, inform data created | 182 | en | 0.645674 |
CajetanP/code-learning | Python/Learning/Language/ifelse.py | 1 | 1729 | people = 30
cars = 40
trucks = 15
if cars > people:
print("Take the cars.")
elif cars < people:
print("Don't take the cars!")
else:
print("We can't decide ;/")
if trucks > cars:
print("Too many trucks!")
elif trucks < cars:
print("Maybe we could take the trucks?")
else:
print("We can't decide.... | mit | 6,353,056,969,983,072,000 | 24.80597 | 109 | 0.622325 | false | 0 | en | 0.110449 | |
brayden2544/Mystuff-final | account/views/reset_password.py | 1 | 1223 | from django import forms
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, Http404
from account import models as amod
from . import templater
import datetime
def process_request(request):
'''Creates a reset password form to email a unique link to the user'''
user ... | apache-2.0 | -6,399,470,654,394,678,000 | 30.358974 | 77 | 0.670482 | false | Creates a reset password form to email a unique link to the user | 64 | en | 0.807566 |
rootio/rootio_web | alembic/env.py | 1 | 2308 | from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python... | agpl-3.0 | -2,669,275,381,323,216,400 | 27.146341 | 79 | 0.687608 | false | Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
Run migrations in 'onli... | 892 | en | 0.841318 |
sam-roth/Keypad | keypad/qt/qt_util.py | 1 | 2494 |
from PyQt4.Qt import *
from collections import namedtuple
import contextlib
from ..core.key import SimpleKeySequence
from ..core.color import Color
from ..abstract.textview import KeyEvent
from ..core.responder import Responder
from .. import api
import abc
import math
def set_tab_order(parent, widgets):
for f... | gpl-3.0 | -4,094,260,488,308,843,500 | 20.135593 | 71 | 0.615477 | false | Converts a QSizeF to a QSize, rounding up.
:type size: PyQr4.Qt.QSizeF
QColor::name() actually returns an HTML-style hex string like AABBCC. | 142 | en | 0.516749 |
nextoa/comb | comb/slot.py | 1 | 2027 | # -*- coding: utf-8 -*-
class Slot(object):
"""
To use comb, you should create a python module file. we named *slot*.
A legal slot must be named 'Slot' in your module file and it must be at least contain four method:
* `initialize`
initial resource, e.g: database handle
* `__enter__`
g... | mit | -5,057,463,884,052,601,000 | 19.474747 | 102 | 0.51258 | false | To use comb, you should create a python module file. we named *slot*.
A legal slot must be named 'Slot' in your module file and it must be at least contain four method:
* `initialize`
initial resource, e.g: database handle
* `__enter__`
get next data to do,you can fetch one or more data.
* `slot`
user custom cod... | 1,072 | en | 0.670041 |
4ndreas/ROSCoffeButler | src/arbotix_python/src/arbotix_python/diff_controller.py | 1 | 10710 | #!/usr/bin/env python
"""
diff_controller.py - controller for a differential drive
Copyright (c) 2010-2011 Vanadium Labs LLC. All right reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributi... | mit | 5,647,903,849,542,350,000 | 40.034483 | 144 | 0.556489 | false | Controller to handle movement & odometry feedback for a differential
drive mobile base.
Handle movement requests.
Get a diagnostics status.
read 32-bit (signed) encoder values.
Send a closed-loop speed. Base PID loop runs at 30Hz, these values
are therefore in ticks per 1/30 second.
diff_controller.py - controlle... | 2,439 | en | 0.844378 |
juancarlospaco/css-html-js-minify | css_html_js_minify/js_minifier.py | 1 | 6476 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""JavaScript Minifier functions for CSS-HTML-JS-Minify."""
import re
from io import StringIO # pure-Python StringIO supports unicode.
from .css_minifier import condense_semicolons
__all__ = ('js_minify', )
def remove_commented_lines(js):
"""Force remove com... | lgpl-3.0 | 1,878,974,442,023,061,800 | 35.178771 | 79 | 0.468345 | false | Minify an input stream of Javascript, writing to an output stream.
Init class.
Force Javascript to a single line, even if need to add semicolon.
Minify a JavaScript string.
Return a minified version of the Javascript string.
Minify Javascript using StringIO.
Force remove commented out lines from Javascript.
Force strip... | 522 | en | 0.591873 |
YYWen0o0/python-frame-django | tests/admin_filters/tests.py | 2 | 41331 | from __future__ import unicode_literals
import datetime
from django.contrib.admin import (site, ModelAdmin, SimpleListFilter,
BooleanFieldListFilter, AllValuesFieldListFilter, RelatedOnlyFieldListFilter)
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.admin import UserAdmin
from dj... | bsd-3-clause | -9,038,131,155,378,770,000 | 43.925 | 168 | 0.656916 | false | Ensure ('fieldpath', ClassName ) lookups pass lookup_allowed checks
when fieldpath contains double underscore in value.
Refs #19182
Ensure that when a filter's queryset method fails, it fails loudly and
the corresponding exception doesn't get swallowed.
Refs #17828.
Ensure that a filter on a FK respects the FK's to_fie... | 4,221 | en | 0.897368 |
DataDog/integrations-core | vertica/datadog_checks/vertica/vertica.py | 1 | 28443 | # (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from __future__ import division
import logging
import ssl
from collections import OrderedDict, defaultdict
from datetime import datetime
from itertools import chain
import vertica_python as vertica
from ... | bsd-3-clause | 2,484,851,219,268,113,000 | 43.442188 | 135 | 0.589143 | false | (C) Datadog, Inc. 2019-present All rights reserved Licensed under a 3-clause BSD style license (see LICENSE) Python 3 only This remapper is used to support legacy Vertica integration config values If `tls_verify` is explicitly set to true, set `use_tls` to true (for legacy support) `tls_verify` used to do what `use_tls... | 3,054 | en | 0.707381 |
ofafa/pynotes | 2015.4.14.forum.py | 1 | 12428 | class panel:
def 瞿志豪(Michel):
Natsdaq
def vicent:
b84 華楊、悠遊卡董事
def Bruce:
EMBA95 矽谷創業,開曼控股
def 司徒嘉恆(Seetoo):
b84,台大經濟->國外法律,創拓法律事務
新創集資等等,到IPO或是併購階段從後端來探討
web 1.0時代,大學畢業做網路媒體,失敗跟當時的法律因素也有關
def 詹德弘(Joseph):
b80, Giga media,華威、之初、台式架構/美式架構,大... | cc0-1.0 | -4,045,274,517,115,713,000 | 33.045977 | 125 | 0.626772 | false | 0 | en | 0.110449 | |
garibaldu/boundary-seekers | Boundary Hunter Ideas/TensorFlow/RBF-BH-Network.py | 1 | 6690 | import tensorflow as tf
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import random
import math
np.random.seed(1234)
random.seed(1234)
plt.switch_backend("TkAgg")
def plotScatter(points, color):
xs = [x[0] for x in points]
ys = [y[1] for y in points]
plt.scatter(xs, ys, c=colo... | mit | -5,844,633,788,650,325,000 | 26.991632 | 108 | 0.582511 | false | generateChevronData()generate_clumps()generate_split_data() Peform Computationtf.add(0.5 * (1 - g), tf.multiply(g, prob))gated = tf.multiply(g, prob)hidden_out = sigmoid(gated)print(session.run(prob, feed_dict={inputs: points[d], targets: [out[d]]}))print(session.run(g, feed_dict={inputs: points[d], targets: [out[d]]})... | 426 | en | 0.341639 |
hamdyaea/Daylight-GNU-Linux | Version4/usr/share/daylight/PySpeaking-GUI/speak.py | 1 | 1687 | # Developer : Hamdy Abou El Anein
import os
import sys
from easygui import *
print("IMPORTANT\n\nThis software work only if google_speech is installed on the system. To install it go to this link please : https://pypi.python.org/pypi/google_speech/\n\n")
def language():
global lang
msg = "What's the langu... | gpl-3.0 | 3,731,881,394,284,948,500 | 24.575758 | 177 | 0.578542 | false | Developer : Hamdy Abou El Anein | 31 | en | 0.215876 |
dubvulture/pyku | pyku/digit_classifier.py | 1 | 4575 | # coding=utf-8
import os
import cv2
import numpy as np
from .utils import DSIZE, TRAIN_DATA
class DigitClassifier(object):
@staticmethod
def _feature(image):
"""
It's faster but still accurate enough with DSIZE = 14.
~0.9983 precision and recall
:param image:
:return:... | gpl-3.0 | -8,652,264,273,431,171,000 | 35.903226 | 80 | 0.532022 | false | :param saved_model: optional saved train set and labels as .npz
:param train_folder: optional custom train data to process
:param feature: feature function - compatible with saved_model
It's faster but still accurate enough with DSIZE = 14.
~0.9983 precision and recall
:param image:
:return: raw pixels as feature vecto... | 922 | en | 0.795673 |
jorgecarleitao/pt_law_parser | tests/test_full_doc.py | 1 | 3393 | from tests.test_basic import TestDocument
class TestDocStart(TestDocument):
"""
Test case intended to show that summary pages of a document are correctly
ignored.
"""
def test_107190_page_1(self):
file_name = 'tests/samples/107190.pdf'
self._run_test(file_name, [0])
self.a... | mit | 585,957,194,112,291,200 | 28.763158 | 79 | 0.605659 | false | Tests that we correctly ignore the content of the last pages.
Test case intended to show that summary pages of a document are correctly
ignored.
Document from 2014.
the contains only 4 paragraphs. | 198 | en | 0.78975 |
darrencheng0817/AlgorithmLearning | Python/leetcode/MergeKLists.py | 1 | 1442 |
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def mergeKLists(self, lists):
"""
:type lists: List[ListNode]
:rtype: ListNode
"""
from heapq import heappush, heappop, heapreplace, heapify
... | mit | -99,459,296,128,431,540 | 22.639344 | 65 | 0.511789 | false | :type lists: List[ListNode]
:rtype: ListNode
:type lists: List[ListNode]
:rtype: ListNode | 89 | en | 0.142586 |
pkill-nine/qutebrowser | tests/unit/completion/test_models.py | 1 | 24554 | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2017 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net>
#
# This file is part of qutebrowser.
#
# qutebrowser 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... | gpl-3.0 | -5,333,383,868,739,639,000 | 35.002933 | 79 | 0.590332 | false | Check that a model contains the expected items in any order.
Args:
expected: A dict of form
{
CategoryName: [(name, desc, misc), ...],
CategoryName: [(name, desc, misc), ...],
...
}
Patch the cmdutils module to provide fake commands.
Patch the configdata module t... | 3,103 | en | 0.877407 |
captainsafia/agate | agate/columns/base.py | 1 | 3431 | #!/usr/bin/env python
from collections import Mapping, Sequence
try:
from collections import OrderedDict
except ImportError: #pragma: no cover
from ordereddict import OrderedDict
import six
from agate.exceptions import ColumnDoesNotExistError
from agate.utils import memoize
class ColumnMapping(Mapping):
... | mit | -8,266,430,875,048,023,000 | 23.507143 | 75 | 0.568347 | false | Proxy access to column data. Instances of :class:`Column` should
not be constructed directly. They are created by :class:`.Table`
instances.
:param table: The table that contains this column.
:param index: The index of this column in the table.
Iterator over :class:`Column` instances within a :class:`.Table`.
:param ... | 849 | en | 0.631275 |
Pulgama/supriya | supriya/nonrealtime/Moment.py | 1 | 1816 | from supriya.nonrealtime.SessionObject import SessionObject
class Moment(SessionObject):
"""
A moment-in-time referencing a singleton non-realtime state.
::
>>> import supriya.nonrealtime
>>> session = supriya.nonrealtime.Session()
>>> moment = session.at(10.5)
"""
### ... | mit | -4,129,431,815,755,473,400 | 24.942857 | 80 | 0.590859 | false | A moment-in-time referencing a singleton non-realtime state.
::
>>> import supriya.nonrealtime
>>> session = supriya.nonrealtime.Session()
>>> moment = session.at(10.5)
CLASS VARIABLES INITIALIZER SPECIAL METHODS PUBLIC PROPERTIES | 249 | en | 0.469328 |
dennisss/sympy | sympy/functions/special/tests/test_error_functions.py | 2 | 24070 | from sympy import (
symbols, expand, expand_func, nan, oo, Float, conjugate, diff,
re, im, Abs, O, factorial, exp_polar, polar_lift, gruntz, limit,
Symbol, I, integrate, S,
sqrt, sin, cos, sinh, cosh, exp, log, pi, EulerGamma,
erf, erfc, erfi, erf2, erfinv, erfcinv, erf2inv,
gamma, uppergamma, l... | bsd-3-clause | -8,657,577,822,490,563,000 | 34.712166 | 102 | 0.523889 | false | XXX XXX XXXassert conjugate(erf2(x, y)) == erf2(conjugate(x), conjugate(y)) NOTE we multiply by exp_polar(I*pi) and need this to be on the principal branch, hence take x in the lower half plane (d=0). issue 6510 | 211 | en | 0.531645 |
kdebrab/pandas | pandas/core/resample.py | 1 | 52045 | from datetime import timedelta
import numpy as np
import warnings
import copy
from textwrap import dedent
import pandas as pd
from pandas.core.groupby.base import GroupByMixin
from pandas.core.groupby.ops import BinGrouper
from pandas.core.groupby.groupby import (
_GroupBy, GroupBy, groupby, _pipe_template
)
from ... | bsd-3-clause | -5,954,581,995,773,467,000 | 31.630094 | 79 | 0.550562 | false | Provides a resample of a groupby implementation
.. versionadded:: 0.18.1
Provides a resample of a groupby implementation
.. versionadded:: 0.18.1
Class for resampling datetimelike data, a groupby-like operation.
See aggregate, transform, and apply functions on this object.
It's easiest to use obj.resample(...) to us... | 15,550 | en | 0.575595 |
grze/parentheses | clc/eucadmin/eucadmin/describeinstances.py | 1 | 2047 | # Software License Agreement (BSD License)
#
# Copyright (c) 2013 Eucalyptus Systems, Inc.
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with or
# without modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code m... | gpl-3.0 | -8,749,896,958,695,378,000 | 40.77551 | 77 | 0.737665 | false | Software License Agreement (BSD License) Copyright (c) 2013 Eucalyptus Systems, Inc. All rights reserved. Redistribution and use of this software 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... | 1,373 | en | 0.881896 |
ryansb/disq | tests/test_job_commands.py | 1 | 2851 | # Copyright 2015 Ryan Brown <sb@ryansb.com>
#
# 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 ... | apache-2.0 | 4,155,654,131,376,370,000 | 26.152381 | 74 | 0.649947 | false | Copyright 2015 Ryan Brown <sb@ryansb.com> 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, sof... | 563 | en | 0.855351 |
cmars/pystdf | pystdf/TestSummarizer.py | 1 | 7154 | #
# PySTDF - The Pythonic STDF Parser
# Copyright (C) 2006 Casey Marshall
#
# 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 2
# of the License, or (at your option) any later versi... | gpl-2.0 | 1,444,826,504,898,870 | 35.131313 | 91 | 0.638803 | false | PySTDF - The Pythonic STDF Parser Copyright (C) 2006 Casey Marshall 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 2 of the License, or (at your option) any later version. This progra... | 1,416 | en | 0.756817 |
brkwon/arista_eapi | modules/arista_eapi_urllib2.py | 1 | 3060 | # EAPI call program using urllib2 and json
import urllib2
#import random
import json
# eAPI JSON template
enableCmd = {"input" : "test", "cmd" : "enable"}
jsonCmd = {"params" : {"format" : "json", "version" : 1, "cmds" : "command"}, "jsonrpc" : "2.0", "method" : "runCmds", "id" : 0}
# Create json based on enable_pa... | lgpl-3.0 | -2,830,876,098,484,342,300 | 32.26087 | 128 | 0.675817 | false | EAPI call program using urllib2 and jsonimport random eAPI JSON template Create json based on enable_password and eAPI command HTTP REST request function for eAPI call create an authenticate hander, opener and install opener create request call call switch via urillib2, and close ti Add VLAN to a switch Create JSON e... | 561 | en | 0.5837 |
chdecultot/frappe | frappe/model/base_document.py | 1 | 25095 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from six import iteritems, string_types
import datetime
import frappe, sys
from frappe import _
from frappe.utils import (cint, flt, now, cstr, strip_html, getdate, get_datetime, ... | mit | -9,026,169,210,520,244,000 | 29.905172 | 120 | 0.66308 | false | pass filters as:
{"key": "val", "key": ["!=", "val"],
"key": ["in", "val"], "key": ["not in", "val"], "key": "^val",
"key" : True (exists), "key": False (does not exist) }
Get mandatory fields that do not have any values
Sanitize HTML and Email in field values. Used to prevent XSS.
- Ignore if 'Ignore XSS Filter' is c... | 3,024 | en | 0.718926 |
Sult/evetool | evetool/settings.py | 1 | 4146 | """
Django settings for evetool project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths ... | mit | 8,719,298,617,498,412,000 | 23.975904 | 73 | 0.646406 | false | Django settings for evetool project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
Build paths inside th... | 1,224 | en | 0.57326 |
SEL-Columbia/commcare-hq | corehq/apps/users/bulkupload.py | 1 | 19528 | from StringIO import StringIO
import logging
from couchdbkit.exceptions import (
BulkSaveError,
MultipleResultsFound,
ResourceNotFound,
)
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
from corehq.apps.groups.models import Group
from corehq.apps.users.f... | bsd-3-clause | 4,689,480,229,207,205,000 | 35.500935 | 130 | 0.552284 | false | If you use this to get a group, do not set group.name directly;
use group_memoizer.rename_group(group, name) instead.
Calculate which locations need added or removed, then submit
one caseblock to handle this
todo this has the possibility of missing two rows one with id one with name that actually refer to the same gr... | 1,056 | en | 0.949768 |
Jarn/jarn.viewdoc | jarn/viewdoc/testing.py | 1 | 1874 | import sys
import os
import unittest
import tempfile
import shutil
import functools
if sys.version_info[0] >= 3:
from io import StringIO
else:
from StringIO import StringIO
from os.path import realpath, isdir
class ChdirStack(object):
"""Stack of current working directories."""
def __init__(self):
... | bsd-2-clause | -3,124,150,782,722,566,000 | 21.309524 | 53 | 0.570971 | false | Stack of current working directories.
Manage a temporary working directory.
Pop dir off stack and change to it.
Push cwd on stack and change to 'dir'.
Decorator swallowing stdout and stderr output. | 215 | en | 0.88801 |
halfakop/Teacup_Firmware | configtool/gui.py | 1 | 19693 |
import sys
import time
try:
import wx
except:
print("ImportError: No module named wx\n\n"
"wxPython is not installed. This program requires wxPython to run.\n"
"See your package manager and/or http://wxpython.org/download.php.")
time.sleep(10)
sys.exit(-1)
import os.path
from configtool.data ... | gpl-2.0 | 6,312,573,059,711,797,000 | 30.917342 | 80 | 0.607779 | false | Testing allowed URLs up to 32 kB in size. Longer URLs are simply chopped. This is a work around a bug in gvfs-open coming with (at least) Ubuntu 15.04. gvfs-open would open mailto:///user@example.com instead of the requested mailto:user@example.com. Broken gvfs-open exists, so it might be used. Try to open the URL dire... | 546 | en | 0.78508 |
ahwkuepper/stdme | app/constants.py | 1 | 8339 | import numpy as np
#labels for summary plots
d_label = np.array(["You", "Your gender", "Your age group", "Your race / ethnicity", "Your location"])
#US statistics
gender_number = {}
gender_number["Male"] = 155651602
gender_number["Female"] = 160477237
race_number = {}
race_number["Native"] = 1942876.0
race_number[... | mit | 658,293,424,676,495,500 | 37.428571 | 102 | 0.699844 | false | labels for summary plotsUS statisticsChlamydia statisticsGonorrhea statisticsSyphilis statistics | 96 | en | 0.343832 |
riolet/rioauth | provider/pages/register.py | 1 | 1949 | import web
import common
import base
class Register(base.Page):
def __init__(self):
base.Page.__init__(self, "Register")
def GET(self):
# show login page
return common.render.register()
@staticmethod
def send_conf_email(user_id, name, email):
duration = 1800 # 30 mi... | gpl-3.0 | 6,252,393,982,004,596,000 | 30.95082 | 104 | 0.636224 | false | show login page 30 minutes send the user an email to have the use confirm their email address send them back to the login page | 126 | en | 0.912207 |
geosoco/twitter_capture_client | multiprocess_client_test.py | 1 | 1546 | #!/usr/bin/env python
"""Base classes for clients."""
import argparse
import logging
import logging.config
from multiprocessing import freeze_support
from clients.multiprocess import MultiprocessClientBase
from configfile import ConfigFile
import exceptions
#
# global
#
log = None
#
# configure basic logger
#
de... | bsd-3-clause | -522,471,715,683,376,060 | 18.820513 | 66 | 0.631307 | false | !/usr/bin/env python global configure basic logger set up some default logging options handle arguments config file configure the logging create our log create and run client | 174 | en | 0.351627 |
dileep-kishore/microbial-ai | tests/conftest.py | 1 | 2031 | # @Author: dileep
# @Last Modified by: dileep
import json
import os
import random
import pytest
from microbial_ai.io import ModelTable
from microbial_ai.metabolism import Microbe
CURRPATH = os.path.dirname(__file__)
@pytest.fixture(scope="module")
def model_table():
return ModelTable(db_uri=f"sqlite:///{CURRP... | mit | -7,260,259,383,662,208,000 | 24.708861 | 83 | 0.688331 | false | @Author: dileep @Last Modified by: dileep 838 is actual database 857 in actual database 791 for ecoli 838, 791 is actual database 857 in actual database | 154 | es | 0.392317 |
O-T-L/PyOTL | Tests/nsga_ii.py | 1 | 5611 | """
Copyright (C) 2014, 申瑞珉 (Ruimin Shen)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed i... | lgpl-3.0 | 5,589,080,152,595,766,000 | 51.383178 | 142 | 0.688671 | false | Copyright (C) 2014, 申瑞珉 (Ruimin Shen)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in th... | 673 | en | 0.896069 |
siacs/HttpUploadComponent | httpupload/server.py | 2 | 13933 | #!/usr/bin/env python3
import argparse
import base64
import errno
import hashlib
import logging
import mimetypes
import os
import random
import shutil
import ssl
import string
import sys
import time
import urllib.parse
import yaml
from sleekxmpp.componentxmpp import ComponentXMPP
from threading import Event
from thre... | agpl-3.0 | 1,377,332,783,470,547,000 | 41.478659 | 165 | 0.55975 | false | Handle requests in a separate thread.
Expire all files over 'user_quota_soft' and older than 'expire_maxage'
- quotaonly - If true don't delete anything just calculate the
used space per user and return. Otherwise make an exiry run
every config['expire_interval'] seconds.
- kill_event - threading.E... | 968 | en | 0.744084 |
joaofanti/TrabRedesIIFinal | Modelos/Mapa/MapFactory.py | 1 | 2000 | import json
from Map import Map
from Door import Door
from Room import Room
from Item import Item
"""
Define um gerador de mapas.
"""
class MapFactory:
"""
Cria uma nova instancia de gerador de mapas.
"""
def __init__(self):
self.RoomsList = [] # Lista de salas geradas.
self.DoorsList = [] # Lista de portas... | mit | -4,662,907,654,454,719,000 | 25.328947 | 95 | 0.697 | false | Cria uma nova instancia de gerador de mapas.
Lista de salas geradas. Lista de portas geradas. Para cada sala no arquivo JSON, gera um novo objeto Sala e entao o salva na lista de salas. Se existe "State" nas configuracoes do objeto, adiciona! Se nao, usa None | 261 | pt | 0.522079 |
gdanezis/claimchain-core | claimchain/utils/wrappers.py | 1 | 6989 | import hippiehug
from hippiehug.Utils import binary_hash
from .encodings import ensure_binary
# TODO: Move to hippiehug 1.0
# TODO: Move the tests out of doctests
class Blob(bytes):
@property
def hid(self):
return binary_hash(self)
def _check_hash(key, value):
if value.hid != key:
rai... | mit | 3,593,495,631,763,739,600 | 27.880165 | 76 | 0.597653 | false | >>> store = ObjectStore()
>>> blob = Blob(b'test')
>>> store.add(blob)
>>> store[blob.hid]
b'test'
Wrapper to enable map interface on top of Hippiehug trees
>>> tree = Tree()
>>> b'label' in tree
False
>>> tree[b'label']
Traceback (most recent call last):
KeyError: b'label'
>>> tree[b'label'] = Blob(b'test')
>>> tree[... | 2,472 | en | 0.563807 |
onyg/aserializer | aserializer/django/fields.py | 1 | 2229 | # -*- coding: utf-8 -*-
from collections import Iterable
try:
from django.db.models.query import QuerySet
from django.db.models import Manager
except ImportError:
QuerySet = None
Manager = None
from aserializer.fields import ListSerializerField
from aserializer.django.utils import get_local_fields, get... | mit | -4,767,140,626,325,645,000 | 42.705882 | 120 | 0.61956 | false | -*- coding: utf-8 -*- if using prefetch_related, we can't use only as it will re-fetch the data .only() returns a QuerySet of RelatedDjangoModel_Deferred objects? | 162 | en | 0.832682 |
pedrobaeza/l10n-spain | l10n_es_partner/models/l10n_es_partner.py | 1 | 7222 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2008 Spanish Localization Team
# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com)
# Jordi Esteve <jesteve@zikzakm... | agpl-3.0 | 6,887,857,847,909,223,000 | 40.705202 | 81 | 0.461123 | false | Calculo el CRC de un número de 10 dígitos
ajustados con ceros por la izquierda
return iban_str in groups of four characters separated
by a single space
Cálculo del código de control bancario
-*- coding: utf-8 -*- OpenERP, Open Source Management Solution Copyright (c) 2008 Spanish Localization Team Copyright ... | 1,259 | en | 0.638243 |
151706061/SimpleITK | Examples/Segmentation/ConnectedThresholdImageFilter.py | 1 | 2202 | '''=========================================================================
'
' Copyright Insight Software Consortium
'
' 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
'
' ... | apache-2.0 | 7,621,793,930,765,058,000 | 26.525 | 136 | 0.645322 | false | =========================================================================
'
' Copyright Insight Software Consortium
'
' 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.... | 948 | en | 0.74409 |
dbrattli/RxPY | rx/linq/observable/sequenceequal.py | 1 | 3360 | import collections
from rx import AnonymousObservable, Observable
from rx.disposables import CompositeDisposable
from rx.internal import default_comparer
from rx.internal import extensionmethod
@extensionmethod(Observable)
def sequence_equal(self, second, comparer=None):
"""Determines whether two sequences are e... | apache-2.0 | 2,095,176,045,865,010,000 | 32.267327 | 110 | 0.545238 | false | Determines whether two sequences are equal by comparing the
elements pairwise using a specified equality comparer.
1 - res = source.sequence_equal([1,2,3])
2 - res = source.sequence_equal([{ "value": 42 }], lambda x, y: x.value == y.value)
3 - res = source.sequence_equal(Observable.return_value(42))
4 - res = source.s... | 754 | en | 0.632566 |
laborautonomo/django-newsletter | newsletter/migrations/0005_auto__del_emailtemplate__del_unique_emailtemplate_title_action__del_fi.py | 1 | 11955 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from ..utils import get_user_model
User = get_user_model()
user_orm_label = '%s.%s' % (User._meta.app_label, User._meta.object_name)
user_model_label = '%s.%s' % (User._meta.app_label, Us... | agpl-3.0 | -1,749,140,199,191,356,700 | 71.018072 | 187 | 0.582016 | false | -*- coding: utf-8 -*- Removing unique constraint on 'EmailTemplate', fields ['title', 'action'] Deleting model 'EmailTemplate' Deleting field 'Newsletter.update_template' Deleting field 'Newsletter.unsubscribe_template' Deleting field 'Newsletter.message_template' Deleting field 'Newsletter.subscribe_template' Adding m... | 753 | en | 0.600525 |
rakhimov/cppdep | setup.py | 1 | 1609 | #!/usr/bin/env python
"""The setup script to generate dist files for PyPi.
To upload the release to PyPi:
$ ./setup.py sdist bdist_wheel --universal
$ twine upload dist/*
"""
from setuptools import setup
from cppdep import cppdep
setup(
name="cppdep",
version=cppdep.VERSION,
maintainer="Olzhas R... | gpl-3.0 | 8,897,259,033,538,249,000 | 31.836735 | 85 | 0.607209 | false | The setup script to generate dist files for PyPi.
To upload the release to PyPi:
$ ./setup.py sdist bdist_wheel --universal
$ twine upload dist/*
!/usr/bin/env python | 176 | en | 0.733187 |
ScientificDataFormat/SDF-Python | sdf/hdf5.py | 1 | 5874 | # Copyright (c) 2019 Dassault Systemes. All rights reserved.
import h5py
import sdf
import numpy as np
import os
import sys
def _to_python_str(s):
""" Convert to Python string """
if isinstance(s, bytes):
return s.decode('utf-8')
else:
return s
def load(filename, obje... | bsd-3-clause | 7,269,598,341,535,490,000 | 26.240385 | 112 | 0.52843 | false | Create a dataset from an h5py dataset
Create an sdf.Group from an h5py group
Convert to byte string
Convert to Python string
Copyright (c) 2019 Dassault Systemes. All rights reserved. attach the scales TODO: fix this? convert the string to an fixed-length utf-8 byte string iterate over the child groups write the ... | 328 | en | 0.523881 |
XNBlank/sudoBot | modules/profile.py | 1 | 8013 | import discord
from discord.ext import commands
from PIL import Image
from PIL import ImageOps
from PIL import ImageDraw
from PIL import ImageFont
import asyncio, aiohttp, io, time, imghdr, os, json, textwrap, re
class Profile:
"""
Profile card setup and display
"""
def __init__(self, client, config):... | gpl-3.0 | 1,141,081,767,628,333,000 | 35.094595 | 212 | 0.560215 | false | Profile card setup and display
Info Box Top Avatar box Profile Information RolesInfo Box Bottom | 97 | en | 0.35154 |
chirpradio/chirpradio-machine | chirp/stream/statistics.py | 1 | 6045 | """
Compute statistics about a consumed sequence of messages.
"""
from chirp.common import http_console_server
from chirp.common import timestamp
from chirp.stream import message
class _ConnectionInfo(object):
MAX_NUM_ERRORS = 25
connection_id = None
start_timestamp_ms = None
last_timestamp_ms ... | apache-2.0 | -8,816,550,096,536,408,000 | 37.503185 | 79 | 0.561952 | false | Compute statistics about a consumed sequence of messages.
Initialized as {} in constructor Initialized as [] in constructor Note my use of nested tables. I suck at HTML. | 172 | en | 0.933552 |
unreal666/outwiker | src/outwiker/core/htmltemplate.py | 2 | 2477 | # -*- coding: utf-8 -*-
import re
from string import Template
from outwiker.gui.guiconfig import HtmlRenderConfig
from outwiker.core.application import Application
class MyTemplate (Template):
"""
Класс работы с шаблонами. Единственное, для чего сделан такой класс
- избавитсья от замены $$ на $
Реал... | gpl-3.0 | 1,693,166,516,128,128,300 | 34.290323 | 79 | 0.579525 | false | Класс для генерации HTML-страницы на основе шаблона
Класс работы с шаблонами. Единственное, для чего сделан такой класс
- избавитсья от замены $$ на $
Реализация регулярного выражения частично взята
из http://stackoverflow.com/a/12769116
template - текст шаблона
Шаблон должен иметь содержание которого оформлено в стил... | 546 | ru | 0.935257 |
DanLindeman/memegen | tests/test_api_aliases.py | 1 | 1225 | # pylint: disable=unused-variable,misplaced-comparison-constant,expression-not-assigned
from expecter import expect
from .utils import load
def describe_get():
def it_requires_a_name_to_return_aliases(client):
status, data = load(client.get("/api/aliases/"))
expect(status) == 200
expec... | mit | -1,296,583,061,009,426,400 | 27.488372 | 87 | 0.516735 | false | pylint: disable=unused-variable,misplaced-comparison-constant,expression-not-assigned | 85 | en | 0.564692 |
PoolC/pythonstudy | entity.py | 1 | 1669 | #coding:utf-8
import types
class Channel(object):
def __init__(self, owner):
self._owner = owner
def _process_message(self, sender, msg, msgargs):
return self._owner._handle(sender, msg, msgargs)
def sendto(self, receiver, msg, msgargs = None):
return receiver._process_mes... | gpl-3.0 | -5,939,575,256,779,529,000 | 24.287879 | 60 | 0.537448 | false | coding:utf-8 | 12 | en | 0.777938 |
keenondrums/sovrin-node | sovrin_client/agent/agent_issuer.py | 1 | 3182 | import json
from plenum.common.types import f
from anoncreds.protocol.issuer import Issuer
from anoncreds.protocol.types import ID
from anoncreds.protocol.types import ClaimRequest
from sovrin_client.agent.constants import EVENT_NOTIFY_MSG, CLAIMS_LIST_FIELD
from sovrin_client.agent.msg_constants import CLAIM, CLAIM_R... | apache-2.0 | 4,596,627,729,626,327,000 | 37.337349 | 95 | 0.641735 | false | 0 | en | 0.110449 | |
jbeezley/girder | girder/__init__.py | 1 | 11346 | # -*- coding: utf-8 -*-
from pkg_resources import DistributionNotFound, get_distribution
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
__version__ = None
__license__ = 'Apache 2.0'
import cherrypy
import functools
import logging
import loggi... | apache-2.0 | -6,225,005,307,584,097,000 | 37.591837 | 98 | 0.654328 | false | Custom formatter that adds useful information about the request to the logs
when an exception happens. Cherrypy access logs are passed through without
change.
Filter log records based on whether they are between a min and max level.
Redirect a file-like stream to a logger.
Sets up the Girder logger.
Setup caching base... | 3,015 | en | 0.896235 |
zhewang/lcvis | main.py | 1 | 3262 | import json
import numpy as np
import pca
import process_object as po
from flask import Flask, request, jsonify, render_template, url_for
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/supernova')
def supernova():
return render_template('supernova.html'... | gpl-2.0 | 1,719,386,529,822,531,600 | 26.411765 | 92 | 0.57572 | false | TODO: band as parameter some id may not have lc data Assume all phase for different surveys are the same some id may not have lc data | 133 | en | 0.864338 |
nicememory/pie | pyglet/examples/opengl_3.py | 1 | 1655 | #!/usr/bin/python
# $Id:$
'''In order to use the new features of OpenGL 3, you must explicitly create
an OpenGL 3 context. You can do this by supplying the `major_version` and
`minor_version` attributes for a GL Config.
This example creates an OpenGL 3 context, prints the version string to stdout,
and exits.... | apache-2.0 | 8,591,080,027,478,945,000 | 34.777778 | 78 | 0.712387 | false | In order to use the new features of OpenGL 3, you must explicitly create
an OpenGL 3 context. You can do this by supplying the `major_version` and
`minor_version` attributes for a GL Config.
This example creates an OpenGL 3 context, prints the version string to stdout,
and exits.
At time of writing, only the beta nv... | 1,320 | en | 0.740701 |
datascopeanalytics/sensor_fusion | main.py | 1 | 6487 | import copy
import datetime
import math
import random
from collections import defaultdict
import matplotlib as mpl
import matplotlib.animation
from matplotlib.ticker import FormatStrFormatter
import numpy as np
import scipy
import seaborn as sns
import traces
# local imports
from kalman import Estimate, Reading
from... | unlicense | -2,849,462,378,540,954,000 | 34.839779 | 112 | 0.617389 | false | updates frame i of the animation
local imports self.ax2.set_ylim(0, 150) create some crappy sensors sigma=500, round_level=500, proc_sigma=0) put the sensors on a train car run some experiments to model/calibrate the sensors generate some "real" occupancy data defaults to 5 stations and 30 minutes if the last point w... | 416 | en | 0.621194 |
minrk/sympy | sympy/tensor/indexed.py | 1 | 13604 | """Module that defines indexed objects
The classes IndexedBase, Indexed and Idx would represent a matrix element
M[i, j] as in the following graph::
1) The Indexed class represents the entire indexed object.
|
___|___
' '
M[i, j]
... | bsd-3-clause | -3,039,205,285,116,504,000 | 31.623501 | 99 | 0.60394 | false | Represents an index, either symbolic or integer.
There are a number of ways to create an Idx object. The constructor
takes two arguments:
``label``
An integer or a symbol that labels the index.
``range``
Optionally you can specify a range as either
- Symbol or integer: This is interpreted as dimensi... | 8,245 | en | 0.700339 |
1503051/webhookshipping | app.py | 1 | 1887 | #!/usr/bin/env python
import urllib
import json
import os
from flask import Flask
from flask import request
from flask import make_response
from pymongo import MongoClient
# Flask app should start in global layout
app = Flask(__name__)
client = MongoClient('mongodb://localhost:27017')
@app.route('/star', methods=['... | apache-2.0 | -2,935,963,759,269,244,400 | 24.849315 | 126 | 0.612083 | false | !/usr/bin/env python Flask app should start in global layout "data": data, "contextOut": [], | 92 | en | 0.517607 |
rajanandakumar/DIRAC | DataManagementSystem/Client/ReplicaManager.py | 1 | 113878 | """
:mod: ReplicaManager
.. module: ReplicaManager
:synopsis: ReplicaManager links the functionalities of StorageElement and FileCatalog.
This module consists ReplicaManager and related classes.
OBSOLETED !!! DO NOT USE THIS ANYMORE!!!! USE THE DataManager CLASS
"""
# # imports
from datetime import datetime, tim... | gpl-3.0 | -7,696,063,295,908,667,000 | 43.10457 | 157 | 0.646042 | false | .. class:: CatalogBase
This class stores the two wrapper functions for interacting with the FileCatalog.
.. class:: CatalogDirectory
Wrappers for various :FileCatalog: methods concering operations on folders.
.. class:: CatalogFile
Wrappers for various :FileCatalog: methods concering operations on files.
.. class:: ... | 28,902 | en | 0.742044 |
level12/blazeweb | blazeweb/pytest_plugin.py | 2 | 1203 | def pytest_addoption(parser):
parser.addoption("--blazeweb_package", action="store",
help="blazeweb-package: app module to run for tests")
parser.addoption("--blazeweb_profile", action="store", default="Test",
help="blazeweb-profile: app settings profile to use (default... | bsd-3-clause | 7,284,290,946,232,201,000 | 41.964286 | 92 | 0.671654 | false | make the app available to the tests an application can define functions to be called after the app is initialized but before any test inspection is done or tests are ran. We call those functions here: we also support events for pre-test setup | 243 | en | 0.945143 |
matrix-org/synapse | tests/storage/test_devices.py | 1 | 5336 | # Copyright 2016-2021 The Matrix.org Foundation C.I.C.
#
# 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 | 3,141,021,267,772,333,600 | 34.573333 | 88 | 0.587706 | false | Check that an specific device ids exist in a list of device update EDUs
Copyright 2016-2021 The Matrix.org Foundation C.I.C. 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.or... | 853 | en | 0.850761 |
JQIamo/artiq | artiq/coredevice/comm_moninj.py | 1 | 2537 | import asyncio
import logging
import struct
from enum import Enum
__all__ = ["TTLProbe", "TTLOverride", "CommMonInj"]
logger = logging.getLogger(__name__)
class TTLProbe(Enum):
level = 0
oe = 1
class TTLOverride(Enum):
en = 0
level = 1
oe = 2
class CommMonInj:
def __init__(self, monito... | lgpl-3.0 | 838,825,745,491,158,500 | 29.202381 | 78 | 0.546709 | false | 0 | en | 0.110449 | |
hzlf/openbroadcast.ch | app/media_embed/utils.py | 1 | 1679 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
from urlparse import urlparse, parse_qs
except ImportError:
from urllib.parse import urlparse, parse_qs
EMBED_SERVICE_PROVIDERS = [
# Video
'Youtube',
'Vimeo',
# Audio
]
def process_provider_url(url, exclude_providers=[]):... | gpl-3.0 | 296,941,797,632,779,200 | 23.691176 | 87 | 0.57832 | false | examples:
- https://vimeo.com/178240219
examples:
- http://youtu.be/SA2iWivDJiE
- http://www.youtube.com/watch?v=_oPAwA_Udwc&feature=feedu
- http://www.youtube.com/embed/SA2iWivDJiE
- http://www.youtube.com/v/SA2iWivDJiE?version=3&hl=en_US
-*- coding: utf-8 -*- Video Audio youtube vimeo | 293 | en | 0.317647 |
prats226/python-amazon-product-api-0.2.8 | tests/utils.py | 1 | 2424 |
from lxml import objectify
import re
try: # make it python2.4/2.5 compatible!
from urlparse import urlparse, parse_qs
except ImportError: # pragma: no cover
from urlparse import urlparse
from cgi import parse_qs
def convert_camel_case(operation):
"""
Converts ``CamelCaseOperationName`` into ``pyt... | bsd-3-clause | 8,023,360,274,834,195,000 | 35.727273 | 82 | 0.636964 | false | Extracts request arguments from cached response file. (Almost) any request
sent to the API will be answered with an XML response containing the
arguments originally used in XML elements ::
<OperationRequest>
<Arguments>
<Argument Name="Service" Value="AWSECommerceService"/>
<Argument Name="Si... | 1,036 | en | 0.450475 |
imiyoo2010/mitmproxy | doc-src/index.py | 1 | 2510 | import os, sys, datetime
import countershape
from countershape import Page, Directory, PythonModule, markup, model
import countershape.template
sys.path.insert(0, "..")
from libmproxy import filt, version
MITMPROXY_SRC = os.environ.get("MITMPROXY_SRC", os.path.abspath(".."))
ns.VERSION = version.VERSION
if ns.options... | mit | -5,763,400,009,474,492,000 | 27.202247 | 95 | 0.627888 | false | remove first line (contains build status) | 41 | en | 0.471448 |
e7dal/hexy | setup.py | 1 | 1766 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import imp
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('readme.txt').read()
history = open('history.txt').read().replace('.. :changelog:', '')
curr_path = os.path.dirname(os.path.realpa... | gpl-3.0 | -8,694,179,322,663,520,000 | 25.757576 | 66 | 0.637599 | false | !/usr/bin/env python -*- coding: utf-8 -*-orderdict needed for structlog | 72 | en | 0.45552 |
evernote/pootle | pootle/core/views.py | 1 | 13622 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Zuza Software Foundation
# Copyright 2013-2014 Evernote Corporation
#
# This file is part of Pootle.
#
# Pootle 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 Softw... | gpl-2.0 | -2,622,846,277,347,944,000 | 35.132626 | 79 | 0.624284 | false | View to implement internal RESTful APIs.
Based on djangbone https://github.com/af/djangbone
Mixin to add AJAX support to a form.
This needs to be used with a `FormView`.
Require a logged-in user.
Removes the `default` special user from views.
Require users to have the `is_superuser` bit set.
Require a field from the ... | 2,950 | en | 0.83371 |
projectatomic/atomic-reactor | tests/constants.py | 1 | 4756 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals, absolute_import
import os
from textwrap import dedent
HERE = os.path.dirna... | bsd-3-clause | 720,660,319,337,230,600 | 25.276243 | 98 | 0.719512 | false | Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
-*- coding: utf-8 -*- | 193 | en | 0.871469 |
simonbr73/nyc-subway-finder | interfaces.py | 1 | 4396 | import sys
class TextInterface:
"""Text-based interface that contains methods for getting input from the user and displaying search
results.
"""
def __init__(self, trains_list):
"""Initializes the TextInterface object with a list of all train objects in the simulation.
"""
... | mit | -7,588,274,881,581,400,000 | 48.954545 | 132 | 0.613285 | false | valid_input will remain False until either n or s is typed If you really don't like our program, you can quit by typing q Used to look up train object in the master list of trains | 179 | en | 0.939418 |
etianen/moody-templates | src/moody/loader.py | 1 | 5355 | """A caching template loader that allows disk-based templates to be used."""
import os, sys
from abc import ABCMeta, abstractmethod
class TemplateDoesNotExist(Exception):
"""A named template could not be found."""
class Source(metaclass=ABCMeta):
"""A source of template data."""
__slots... | bsd-3-clause | -6,064,786,215,887,489,000 | 30.692308 | 129 | 0.580579 | false | A template loader that doesn't cache compiled templates.
Terrible performance, but great for debugging.
A template loader that loads from a directory on disk.
A template loader.
Compiled templates are cached for performance.
A template loader that loads from memory.
A source of template data.
A named template could n... | 1,609 | en | 0.670839 |
ewjoachim/pyler | pyler/euler_test_base.py | 1 | 2100 | import signal
import unittest
import time
from . import website as w
class EulerProblem(unittest.TestCase):
problem_id = None
def solver(self, input_val):
raise NotImplementedError()
simple_input = None
simple_output = None
real_input = None
def solve_real(self):
"""
... | mit | 8,948,021,599,226,098,000 | 26.631579 | 78 | 0.57381 | false | Returns the solution of the Problem for the real input
Returns the solution of the Problem for the simple input
Checks the real problem against the website
Checks the simple example
Checks that the real problem runs under a minute
Windows has no Alarm signal. Sorry pal. pylint: disable=unused-argument | 304 | en | 0.7572 |
almeidapaulopt/frappe | frappe/model/db_query.py | 1 | 21364 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from six import iteritems, string_types
"""build query for doclistview and return results"""
import frappe, json, copy, re
import frappe.defaults
import frappe.share
import fra... | mit | -5,802,090,927,492,263,000 | 32.43349 | 120 | 0.66921 | false | build conditions from user filters
add match conditions if applicable
extract tables from fields
return the formattted date as per the given example
[u'2017-11-01', u'2017-11-03'] => '2017-11-01 00:00:00.000000' AND '2017-11-04 00:00:00.000000'
wrapper for DatabaseQuery
Convert fields and filters from strings to list, ... | 2,274 | en | 0.747422 |
rdkit/rdkit-orig | Code/ML/FeatureSelect/Wrap/testCMIM.py | 2 | 1730 | from rdkit.ML import FeatureSelect as FS
from rdkit import DataStructs as DS
from rdkit import RDConfig
import unittest
class TestCase(unittest.TestCase):
def setUp(self) :
pass
def test0FromList(self) :
examples = []
bv = DS.ExplicitBitVect(5)
bv.SetBitsFromList([0,2,4])
examples.app... | bsd-3-clause | -1,545,998,874,891,628,800 | 21.763158 | 40 | 0.610405 | false | 0 | en | 0.110449 | |
thalesians/tsa | src/test/python/thalesians/tsa/q/testq.py | 1 | 5227 | import datetime
import unittest
import thalesians.tsa.q as kdb
class TestDataTypes(unittest.TestCase):
def setUp(self):
self.conn = kdb.q('localhost', 41822)
def testInteger(self):
self.conn.k('{[x]test::x}', (15,))
self.assertEqual(self.conn.k('test'), 15)
self.conn.k('test:2... | apache-2.0 | -5,831,748,582,302,765,000 | 36.604317 | 97 | 0.548881 | false | 0 | en | 0.110449 | |
ratzeni/vcf-miner.client | setup.py | 1 | 1546 | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'VERSION')) as f:
__version__ = f.read().strip()
with open(os.path.join(here, 'requirements.txt')) as f:
required = f.read().splitlines()
with open(os.path.join(here, 'README.... | mit | -9,032,565,296,916,977,000 | 31.893617 | 63 | 0.575679 | false | 0 | en | 0.110449 | |
marcuschia/ShaniXBMCWork | script.video.F4mProxy/lib/f4mDownloader.py | 1 | 49882 | # -*- coding: utf-8 -*-
import xml.etree.ElementTree as etree
import base64
from struct import unpack, pack
import sys
import io
import os
import time
import itertools
import xbmcaddon
import xbmc
import urllib2,urllib
import traceback
import urlparse
import posixpath
import re
import hmac
import hashl... | gpl-2.0 | -2,045,013,516,949,013,200 | 42.145133 | 548 | 0.494427 | false | -*- coding: utf-8 -*-import youtube_dlfrom youtube_dl.utils import *selfAddon["profile"])from Crypto.Cipher import AES Utility functions for reading numbers and strings flagsprint 'segment_run_count',segment_run_countprint 'segments',segments flagsprint 'fragments_count',fragments_countprint 'fragments',fragments flags... | 9,770 | en | 0.379013 |
lluisball/godenerg | axpert/charger.py | 1 | 2546 | from time import sleep
from datetime import datetime, timedelta
from axpert.protocol import (
CMD_REL, parse_inverter_conf, empty_inverter_conf, CmdSpec
)
from axpert.settings import charger_conf
from axpert.datalogger import get_avg_last
FLOAT_VOL = charger_conf['float_voltage']
ABSORB_VOL = charger_conf['absorb... | gpl-3.0 | 5,399,676,398,103,707,000 | 34.361111 | 79 | 0.569521 | false | 0 | en | 0.110449 | |
wooster/framework_depviz | depviz.py | 1 | 10369 | #!/usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2013 Andrew Wooster
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
u... | mit | -6,358,658,463,639,979,000 | 43.311966 | 135 | 0.621564 | false | Escapes an argument to a command line utility.
Get a list of all the frameworks wich depend on framework_name, recursively.
Runs the command and returns the status and the output.
The MIT License (MIT)
Copyright (c) 2013 Andrew Wooster
Permission is hereby granted, free of charge, to any person obtaining a copy of
th... | 1,343 | en | 0.830045 |
jsubpy/jsub | jsub/exts/repo/file_system.py | 1 | 2428 | import os
import json
import logging
import fcntl
from jsub.util import safe_mkdir
from jsub.util import safe_rmdir
from jsub.error import RepoReadError
from jsub.error import TaskNotFoundError
ID_FILENAME = 'id'
class FileSystem(object):
def __init__(self, param):
self.__jsub_dir = os.path.expanduser(param.get... | mit | 5,301,751,721,617,016,000 | 27.564706 | 107 | 0.656919 | false | self.__id_file = os.path.join(self.__jsub_dir, ID_FILENAME) self.__create_repo_dir() def __create_repo_dir(self): safe_mkdir(self.__jsub_dir) | 144 | kk | 0.087146 |
sumihai-tekindo/account_sicepat | sicepat_erp/invoice_line_exp_cost/invoice_line_exp_cost.py | 1 | 7446 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Pambudi Satria (<https://github.com/pambudisatria>).
# @author Pambudi Satria <pambudi.satria@yahoo.com>
#
# This program is free software: you can redistribute it and/or modify
... | gpl-3.0 | -6,949,873,827,119,664,000 | 58.048387 | 165 | 0.592399 | false | -*- coding: utf-8 -*- Copyright (C) 2016 Pambudi Satria (<https://github.com/pambudisatria>). @author Pambudi Satria <pambudi.satria@yahoo.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 Free Softwar... | 1,165 | en | 0.904993 |
jzerbe/taskifier | taskifier/internal/__init__.py | 1 | 3830 | from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
import json
from taskifier import const
from taskifier.models import Task, TaskOwner
from taskifier.internal.TaskPayloadHelper import TaskPayloadHelper
def DELETE(task_owner, task_id):
task = _get_task_by_id(task_id)
if task... | bsd-3-clause | -939,080,448,045,002,200 | 35.132075 | 92 | 0.620627 | false | 0 | en | 0.110449 | |
nss350/magPy | core/windowSelector.py | 1 | 17249 | """
Created on Thu Mar 24 08:18:04 2016
@author: npop
The window selector calculates which global windows to use
Calculates overlapping windows between given sites
This removes the burden on the upcoming processor
Upcoming processor can then simply get the data for the windows
And process them
"""
import os
from datet... | apache-2.0 | -2,665,271,720,281,101,300 | 35.856838 | 222 | 0.681663 | false | Created on Thu Mar 24 08:18:04 2016
@author: npop
The window selector calculates which global windows to use
Calculates overlapping windows between given sites
This removes the burden on the upcoming processor
Upcoming processor can then simply get the data for the windows
And process them
my classes utils CONSTRUCT... | 2,837 | en | 0.820566 |
amahabal/PySeqsee | farg/core/util.py | 1 | 3569 | # Copyright (C) 2011, 2012 Abhijit Mahabal
#
# 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 version.
#
# This program is distribu... | gpl-3.0 | -742,354,667,693,318,000 | 32.046296 | 93 | 0.692351 | false | Choose in a way that the expected number of choices is n.
Args:
n: The expected number of responses.
choices: an iterable of 2-tuples, where the second value is the weight.
An example to show how it works: let choices contain 5 things with weights 10, 20, 30
40, and 50 (thus summing to 150), and let n=3. Then we ... | 1,921 | en | 0.905444 |
lbjay/cds-invenio | modules/bibformat/lib/bibformat_bfx_engine_config.py | 1 | 5843 | ## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio 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 2 of the
## License, or (... | gpl-2.0 | -8,086,134,669,331,546,000 | 49.808696 | 146 | 0.479719 | false | BibFormat BFX engine configuration.
This file is part of CDS Invenio. Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. CDS Invenio 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 2 of ... | 950 | en | 0.879133 |
jantman/cobbler | newtests/cli/imports/test_vmware/vmware_import_test.py | 1 | 1218 | import os
import sys
import unittest
from cobbler import utils
from newtests.cli.imports.import_base import CobblerImportTest
from newtests.cli.imports.import_base import create_import_func
class Test_VMWare_Imports(CobblerImportTest):
"""
Tests imports of various distros
"""
pass
distros = [
{"name":"v... | gpl-2.0 | 6,504,870,934,439,871,000 | 42.5 | 129 | 0.683087 | false | Tests imports of various distros | 32 | en | 0.847099 |
smurfix/gevent-socketio | socketio/transports.py | 1 | 11396 | import gevent
import urllib
try:
import urllib.parse as urlparse
except ImportError:
import urlparse
from geventwebsocket import WebSocketError
from gevent.queue import Empty
class BaseTransport(object):
"""Base class for all transports. Mostly wraps handler class functions."""
def __init__(self, han... | bsd-3-clause | 116,012,888,092,994,820 | 34.6125 | 114 | 0.550807 | false | Base class for all transports. Mostly wraps handler class functions.
Not tested at all!
Base transport class.
:param config: dict Should contain the config keys, like
``heartbeat_interval``, ``heartbeat_timeout`` and
``close_timeout``.
This function can extract multiple messages from one HTTP payload.
Some times, ... | 2,127 | en | 0.879737 |
bjornwallner/proq2-server | apps/modeller9v8/examples/commands/saxs.py | 1 | 1049 | # script to calculate SAXS spectrum of a model
from modeller import *
from modeller.scripts import complete_pdb
env=environ()
env.libs.topology.read(file='$(LIB)/top_heav.lib')
env.libs.parameters.read(file='$(LIB)/par.lib')
log.verbose()
### Calculate SAXS spectrum of correct structure
mdl = complete_pdb(env, '1cuk')... | gpl-3.0 | -4,310,941,405,752,410,000 | 36.464286 | 74 | 0.731173 | false | script to calculate SAXS spectrum of a model Calculate SAXS spectrum of correct structure append SAXS data to energy structure create some restraints | 149 | en | 0.878468 |
TurboTurtle/sos | sos/collector/__init__.py | 1 | 54982 | # Copyright Red Hat 2020, Jake Hunsaker <jhunsake@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Publi... | gpl-2.0 | -8,600,018,873,667,082,000 | 42.258851 | 79 | 0.524299 | false | Collector is the formerly standalone sos-collector project, brought into
sos natively in 4.0
It is meant to collect reports from an arbitrary number of remote nodes,
as well as the localhost, at the same time. These nodes may be either user
defined, defined by some clustering software, or both.
Checks to see if the lo... | 6,224 | en | 0.843359 |
0x1001/BabyMonitor | app/add_finger_print.py | 1 | 1251 | def add_finger_print(file_path):
import wave
import analyzer
import storage
import recording
import config
import os
a = analyzer.Analyzer()
s = storage.Storage(config.Config("../config.json"))
waveFile = wave.open(file_path)
waveData = waveFile.readframes(waveFile.getnframes()... | gpl-2.0 | -7,902,132,046,651,514,000 | 28.809524 | 119 | 0.643485 | false | 0 | en | 0.110449 | |
benschneider/sideprojects1 | density_matrix/fft_filter_test.py | 1 | 1683 | from scipy.signal.signaltools import _next_regular
from matplotlib import pyplot as plt
from numpy.fft import fft, rfftn, irfftn, fftshift # for real data can take advantage of symmetries
import numpy as np
import codecs, json
# from scipy.signal import remez, freqz, lfilter
# lpf = remez(21, [0, 0.2, 0.3, 0.5], [1.0, ... | gpl-2.0 | -3,275,720,611,350,555,000 | 32 | 118 | 0.623886 | false | for real data can take advantage of symmetries from scipy.signal import remez, freqz, lfilter lpf = remez(21, [0, 0.2, 0.3, 0.5], [1.0, 0.0]) w, h = freqz(lpf) t = np.arange(0, 1.0, 1.00/1000) s = np.sin(2*np.pi*100*t) + np.sin(2*np.pi*200*t) noise_amp = 5.0 s = np.sin(2*np.pi*100*t) + np.sin(2*np.pi*200*t) +noise_a... | 1,393 | en | 0.271313 |
KhronosGroup/COLLADA-CTS | Core/Gui/Dialog/FSettingsScrolledSizer.py | 1 | 3448 | # Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... | mit | 8,386,046,570,576,897,000 | 48.271429 | 466 | 0.639211 | false | Copyright (c) 2012 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, d... | 1,081 | en | 0.875527 |
YtvwlD/metecli | metecli/cmdline.py | 1 | 1638 | from . import setup, account, audits, drinks, config, show_version
from .utils import test_terminal_utf8
import argparse
import logging
log = logging.getLogger(__name__)
def setup_logging(log_level: str) -> None:
numeric_log_level = getattr(logging, log_level.upper(), None)
if not numeric_log_level:
... | gpl-3.0 | -4,544,778,988,285,004,300 | 29.333333 | 79 | 0.653846 | false | 0 | en | 0.110449 | |
dpgaspar/AutoAnt | autoant/console.py | 1 | 2092 | #!/usr/bin/env python
import argparse
import logging
import datetime
from autoant import AutoAnt
from .providers import providers
from .version import VERSION_STRING
log_level = {'INFO':logging.INFO,
'DEBUG':logging.DEBUG,
'CRITICAL':logging.CRITICAL,
'ERROR':logging.ERROR}
def... | bsd-3-clause | 133,878,767,866,146,460 | 33.866667 | 98 | 0.641969 | false | Entry-point function.
!/usr/bin/env python | 43 | en | 0.494448 |
3upperm2n/DIGITS | tools/create_db.py | 2 | 20860 | #!/usr/bin/env python
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import sys
import os.path
import time
import argparse
import logging
import re
import shutil
import math
import random
from collections import Counter
import threading
import Queue
try:
import digits
except ImportError:
... | bsd-3-clause | -4,733,648,372,469,106,000 | 31.492212 | 143 | 0.573058 | false | Input file is empty
Failed to load image[s]
Failed to parse a line in the input file
Failed to write image[s]
Create a caffe Datum from a numpy.ndarray
Calculates an appropriate batch size for creating this database
Calculates an appropriate number of threads for creating this database
Create an HDF5 file
Keyword argu... | 2,639 | en | 0.696257 |
bgaultier/laboitepro | boites/migrations/0009_pushbutton.py | 1 | 1086 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-09-06 07:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('boites', '0008_auto_20170801_1406'),
]
operations ... | agpl-3.0 | 1,413,793,480,327,889,000 | 40.769231 | 149 | 0.627993 | false | -*- coding: utf-8 -*- Generated by Django 1.11.2 on 2017-09-06 07:31 | 68 | en | 0.700204 |
jalabort/ijcv-2014-aam | aam/image/test/image_features_test.py | 1 | 12108 | import numpy as np
from numpy.testing import assert_allclose
import random
import math
from menpo.image import MaskedImage
import menpo.io as mio
def test_imagewindowiterator_hog_padding():
n_cases = 5
image_width = np.random.randint(50, 250, [n_cases, 1])
image_height = np.random.randint(50, 250, [n_cas... | bsd-2-clause | -4,259,554,534,044,738,600 | 47.432 | 79 | 0.553105 | false | 0 | en | 0.110449 | |
krother/maze_run | leftovers/part2_before_pylint.py | 1 | 11490 |
# TODO: fix and check all command-line arguments
from util import debug_print
from pygame import image, Rect, Surface
from pygame.locals import KEYDOWN, KEYUP, USEREVENT
import pygame
import sys
import random
import json
import os
from collections import namedtuple
from functools import partial
import argparse
import... | mit | -7,573,846,476,509,047,000 | 29.15748 | 95 | 0.573716 | false | Generates two-dimensional mazes consisting of walls and dots.
Iterate over all grid tiles
Returns a size.x * size.y maze as a string
Returns an image of a tile-based grid
Returns an image of a tile-based grid
Processes events and updates callbacks.
Returns a Position tuple for the given char on the level
Converts tile ... | 1,696 | en | 0.445055 |
neozerosv/ciberues | agente-servidor.py | 1 | 2142 | #!/usr/bin/env python
# ------------------------------
# importacion
# ------------------------------
import socket, sys, time, ConfigParser
def poner_mensaje( tipo , mensaje ):
# -----------------------------
# Colocar mensajes con formato
# y marca de tiempo
# -----------------------------
print time.strftime(... | gpl-2.0 | 6,846,871,219,183,194,000 | 31.953846 | 129 | 0.546218 | false | !/usr/bin/env python ------------------------------ importacion ------------------------------ ----------------------------- Colocar mensajes con formato y marca de tiempo ----------------------------- ------------------------------ Variables del servidor desde un archivo de configuracion ------------------------------... | 404 | es | 0.495335 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.