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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fkie-cad/FACT_core | src/storage/db_interface_compare.py | 1 | 4915 | import logging
from contextlib import suppress
from time import time
from typing import List, Optional
from pymongo.errors import PyMongoError
from helperFunctions.data_conversion import (
convert_compare_id_to_list, convert_uid_list_to_compare_id, normalize_compare_id
)
from storage.db_interface_common import Mo... | gpl-3.0 | 2,370,626,291,600,637,000 | 44.091743 | 212 | 0.647202 | false | pylint: disable=using-constant-test pylint: disable=unsubscriptable-object | 74 | en | 0.497575 |
GeoCat/QGIS | tests/src/python/test_qgsvectorfilewriter.py | 1 | 30961 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsVectorFileWriter.
.. note:: 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.
"... | gpl-2.0 | -844,033,346,833,076,500 | 40.614247 | 126 | 0.627467 | false | Check writing date and time fields to an ESRI shapefile.
Check writing date and time fields to an MapInfo tabfile.
Test retrieving default dataset options for a format
Test retrieving default layer options for a format
Check writing Integer64 fields to an MapInfo tabfile (which does not support that type).
Tests writ... | 2,492 | en | 0.766971 |
d2chau/git-demo-fizzbuzz | python-fizz-buzz/fizzbuzz.py | 1 | 1059 | def basicfizzbuzz(n):
if n % 3 == 0 and n % 5 == 0:
return 'FizzBuzz'
elif n % 3 == 0:
return 'Fizz'
elif n % 5 == 0:
return 'Buzz'
else:
return str(n)
print "\n".join(basicfizzbuzz(n) for n in xrange(1, 100))
print "\n"
print "*****************************************... | apache-2.0 | -1,047,292,258,414,213,900 | 28.416667 | 84 | 0.313503 | false | 0 | en | 0.110449 | |
kawashiro/dewyatochka2 | src/dewyatochka/plugins/cool_story/parser/_base.py | 1 | 4448 | # -*- coding: UTF-8
""" Common parsers logic
Classes
=======
AbstractParser -- Abstract parser
Functions
=========
parse_multiline_html -- Join html paragraphs collection into one multi line string
Attributes
==========
RawPost -- Raw post immutable structure
"""
import re
from collections import named... | gpl-3.0 | -971,577,892,149,413,400 | 26.288344 | 91 | 0.582284 | false | Parser implementation
Each parser is an iterable object that yields posts
beginning from the last and ending on the first post
Init parser object, define mandatory attributes
Yields all the posts found beginning from the page specified
:param str start_page: Page url (e.g. "/20131117") or empty to start from beginni... | 1,469 | en | 0.550071 |
Luxoft/SDLP2 | SDL_Core/tools/InterfaceGenerator/generator/parsers/RPCBase.py | 1 | 26596 | """RPC XML base parser.
Contains base parser for SDLRPC v1/v2 and JSON RPC XML format.
"""
import collections
import xml.etree.ElementTree
from generator import Model
class ParseError(Exception):
"""Parse error.
This exception is raised when XML contains errors and can't be parsed.
"""
pass
... | lgpl-2.1 | -8,461,146,256,486,704,000 | 34.795424 | 83 | 0.537487 | false | Parse error.
This exception is raised when XML contains errors and can't be parsed.
RPC XML Parser base.
This class must not be used directly. One of its subclasses must be used
instead.
Constructor.
Add new item in the items dictionary with given key.
Performs additional check for presence in the dictionary and thr... | 4,139 | en | 0.663159 |
valeros/platformio | platformio/builder/scripts/frameworks/energia.py | 1 | 2038 | # Copyright 2014-2016 Ivan Kravets <me@ikravets.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... | apache-2.0 | 4,873,976,666,905,393,000 | 26.540541 | 79 | 0.694799 | false | Energia
Energia Wiring-based framework enables pretty much anyone to start easily
creating microcontroller-based projects and applications. Its easy-to-use
libraries and functions provide developers of all experience levels to start
blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever
before.
htt... | 968 | en | 0.859625 |
mdaif/olympia | apps/compat/views.py | 1 | 7432 | import json
import re
from django import http
from django.db.models import Count
from django.shortcuts import redirect, render
from django.views.decorators.csrf import csrf_exempt
from tower import ugettext as _
import amo
import amo.utils
from addons.decorators import owner_or_unlisted_reviewer
from amo.decorators ... | bsd-3-clause | 887,170,371,341,290,900 | 37.507772 | 78 | 0.606432 | false | Pick up everything else for an Other count. Get the list of add-ons for usage stats. Turn camelCase into snake_case. Build up a new report. Not authorized? Let's pretend this addon simply doesn't exist. Apply filters only if we have a good app/version combination. 3.6 => 3 Ideally we'd have a `version_int` column to do... | 400 | en | 0.897859 |
jonnybazookatone/ADSDeploy_priv | ADSDeploy/config.py | 1 | 2953 | # Connection to the database where we save orcid-claims (this database
# serves as a running log of claims and storage of author-related
# information). It is not consumed by others (ie. we 'push' results)
# SQLALCHEMY_URL = 'postgres://docker:docker@localhost:6432/docker'
SQLALCHEMY_URL = 'sqlite:///'
SQLALCHEMY_ECHO... | gpl-3.0 | 3,990,024,058,038,431,000 | 30.425532 | 86 | 0.633932 | false | Connection to the database where we save orcid-claims (this database serves as a running log of claims and storage of author-related information). It is not consumed by others (ie. we 'push' results) SQLALCHEMY_URL = 'postgres://docker:docker@localhost:6432/docker' Configuration of the pipeline; if you start 'vagrant ... | 1,162 | en | 0.840112 |
ajhager/copycat | copycat/workspace/bond.py | 1 | 13667 | # Copyright (c) 2007-2017 Joseph Hager.
#
# Copycat is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License,
# as published by the Free Software Foundation.
#
# Copycat is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; with... | gpl-2.0 | -5,235,821,656,455,039,000 | 42.113565 | 88 | 0.615497 | false | Bond
Attributes:
bond_category:
direction_category:
from_object:
to_object:
bond_facet: Which facet is being related.
from_object_descriptor:
to_object_descriptor:
Return True if this and the given bond represent the same bond.
Initialize Bond.
Inner calculation.
Return the bond's external ... | 3,271 | en | 0.88961 |
bopen/mariobros | mariobros/mario.py | 1 | 11792 | # -*- coding: utf-8 -*-
# python 2 support via python-future
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import bytes, dict, int, str
import atexit
import collections
import distutils.spawn
import importlib
import logging
import re
import shlex
import subprocess
im... | apache-2.0 | -5,749,971,859,850,435,000 | 34.841945 | 99 | 0.6356 | false | Define Luigi External Task class for existing files requires.
Define Luigi task class through regular expression.
Create Luigi task class.
:param str name: Task name.
:param str target_pattern: Target pattern.
:param list sources_repls: List of source replacements.
:param str action_template: Action template.
:pa... | 2,967 | en | 0.490413 |
anbangleo/NlsdeWeb | Python-3.6.0/Lib/test/test_mailbox.py | 2 | 92803 | import os
import sys
import time
import stat
import socket
import email
import email.message
import re
import io
import tempfile
from test import support
import unittest
import textwrap
import mailbox
import glob
class TestBase:
all_mailbox_types = (mailbox.Message, mailbox.MaildirMessage,
... | mit | 4,246,049,689,262,483,500 | 39.546329 | 90 | 0.582829 | false | Common tests for single-file mailboxes
Test an empty maildir mailbox
Inspect a mailbox.Message representation of the sample message Delete a file or delete a directory recursively Overridden by subclasses to reuse tests Add copies of a sample message Remove messages using remove() Remove messages using __delitem__() ... | 8,075 | en | 0.76818 |
iulian787/spack | lib/spack/spack/test/cmd/versions.py | 1 | 1677 | # Copyright 2013-2020 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)
import pytest
from spack.main import SpackCommand
versions = SpackCommand('versions')
def test_safe_only_versions():
... | lgpl-2.1 | 8,678,284,814,418,964,000 | 21.662162 | 75 | 0.694097 | false | Test a package for which new versions should be available.
Test a package for which no unchecksummed versions are available.
Test a package for which no remote versions are available.
Test a package without versions or a ``url`` attribute.
Test a package for which remote versions should be available.
Test a package for... | 745 | en | 0.805378 |
michaelhidalgo/7WCSQ | Tools/SQLMap/sqlmap/extra/shutils/regressiontest.py | 1 | 5523 | #!/usr/bin/env python
# Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
# See the file 'doc/COPYING' for copying permission
import codecs
import inspect
import os
import re
import smtplib
import subprocess
import sys
import time
import traceback
from email.mime.multipart import MIMEMultipart
from emai... | apache-2.0 | -358,738,374,266,894,200 | 32.676829 | 221 | 0.611443 | false | !/usr/bin/env python Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permissionTO = "dev@sqlmap.org" Catch all for SMTP exceptions | 184 | en | 0.478129 |
bitcraze/crazyflie-lib-python | cflib/__init__.py | 1 | 2100 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | gpl-2.0 | -1,534,993,565,534,744,300 | 37.888889 | 78 | 0.661429 | false | The Crazyflie Micro Quadcopter library API used to communicate with the
Crazyflie Micro Quadcopter via a communication link.
The API takes care of scanning, opening and closing the communication link
as well as sending/receiving data from the Crazyflie.
A link is described using an URI of the following format:
<i... | 2,041 | en | 0.807503 |
fgaTactics/tecprog2017.1 | gameEngine/Mouse.py | 1 | 1363 | import pygame
# This class controls all mouse functionalities
class Mouse:
def __init__(self):
# Array with mouse x and y positions
self.position = pygame.mouse.get_pos()
assert (self.position is not None), "Invalid pygame mouse position return"
# Array that indicate if some mou... | gpl-3.0 | -432,616,678,001,625,500 | 33.075 | 82 | 0.605282 | false | This class controls all mouse functionalities Array with mouse x and y positions Array that indicate if some mouse button is pressed Verify if mouse cursor is over a certain object Compare object coordinates with mouse position Verify if the mouse cursor was over a certain object during a click event Verify coincidence... | 406 | en | 0.85605 |
PIVX-Project/PIVX | test/functional/sapling_wallet_nullifiers.py | 1 | 7387 | #!/usr/bin/env python3
# Copyright (c) 2016 The Zcash developers
# Copyright (c) 2020 The PIVX developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
from test_framework.test_framework import PivxTestFramework
from test_fram... | mit | 1,046,206,625,469,703,000 | 42.710059 | 111 | 0.662651 | false | !/usr/bin/env python3 Copyright (c) 2016 The Zcash developers Copyright (c) 2020 The PIVX developers Distributed under the MIT software license, see the accompanying file COPYING or https://www.opensource.org/licenses/mit-license.php . activate Sapling add shield addr to node 0 send node 0 taddr to shield addr to get o... | 1,901 | en | 0.897342 |
AmatanHead/collective-blog | s_markdown/widgets.py | 1 | 3381 | """Markdown widgets"""
from django import forms
from django.utils.safestring import mark_safe
from django.utils.deconstruct import deconstructible
from json import dumps
@deconstructible
class MarkdownTextarea(forms.Textarea):
"""Basic textarea widget for rendering Markdown objects"""
pass
@deconstructibl... | mit | 1,420,852,129,473,943,600 | 36.153846 | 101 | 0.599823 | false | Basic textarea widget for rendering Markdown objects
Widget that uses the `CodeMirror` editor
:param mode: Syntax mode name.
:param addons: List of addons (each element is a relative path
to the addon, without `.js` extension. Example: `mode/overlay`)
:param theme: Theme name.
:param theme_path: Path to the theme fi... | 913 | en | 0.664005 |
tmfoltz/worldengine | worldengine/generation.py | 1 | 7471 | from noise import snoise2
from worldengine.world import Step
from worldengine.simulations.basic import find_threshold_f
from worldengine.simulations.hydrology import WatermapSimulation
from worldengine.simulations.irrigation import IrrigationSimulation
from worldengine.simulations.humidity import HumiditySimulation
fro... | mit | 62,308,796,191,271,064 | 32.352679 | 89 | 0.584125 | false | Translate the map horizontally and vertically to put as much ocean as
possible at the borders. It operates on elevation and plates map
Calculate the ocean, the sea depth and the elevation thresholds
:param world: a world having elevation but not thresholds
:param ocean_level: the elevation representing the ocean level
... | 563 | en | 0.773121 |
jfterpstra/bluebottle | bluebottle/wallposts/models.py | 1 | 8042 | from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import fields
from django_extensions.db.fields import (ModificationDateTimeField,
CreationDateTimeField)
from django.utils.te... | bsd-3-clause | -1,037,258,378,431,632,900 | 37.295238 | 85 | 0.615145 | false | A user reaction or comment to a Wallpost. This model is based on
the Comments model from django.contrib.comments.
The Wallpost base class. This class will never be used directly because the
content of a Wallpost is always defined
in the child classes.
Implementation Note: Normally this would be an abstract class but i... | 1,360 | en | 0.882361 |
rootofevil/watercounter | watercounter/app/sqlmodel.py | 1 | 4586 | # -*- coding: utf-8 -*-
from app import db, mail
from sqlalchemy.orm import backref, relationship
from datetime import datetime
from sqlalchemy_utils import PasswordType
from sqlalchemy.sql.schema import ForeignKey
from flask_mail import Message
from config import HOSTNAME
class Waterhistory(db.Model):
i... | gpl-3.0 | -8,005,757,017,711,927,000 | 34.983871 | 104 | 0.589184 | false | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
jshaffstall/PyPhysicsSandbox | py2d/Math/Transform.py | 1 | 2380 | class Transform(object):
"""Class for representing affine transformations"""
def __init__(self, data):
self.data = data
@staticmethod
def unit():
"""Get a new unit tranformation"""
return Transform([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
@staticmethod
def move(dx, dy):
... | mit | -787,264,642,545,114,100 | 26.045455 | 82 | 0.542017 | false | Class for representing affine transformations
Get a transformation that mirrors along the x axis
Get a transformation that mirrors along the y axis
Get a transformation that moves by dx, dy
Get a transformation that rotates by phi
Get a transformation that rotates around (cx, cy) by phi
Get a transformation that scales... | 359 | en | 0.899645 |
President3D/Quality-SPC | src/Ui/InMainWindow.py | 1 | 108855 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'InMainWindow.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_myMainWindow(object):
def setupUi(self, myMainWindow):
my... | gpl-3.0 | 1,980,948,443,473,866,500 | 71.64753 | 497 | 0.762483 | false | -*- coding: utf-8 -*- Form implementation generated from reading ui file 'InMainWindow.ui' Created by: PyQt5 UI code generator 5.6 WARNING! All changes made in this file will be lost! | 183 | en | 0.854382 |
itdxer/neupy | examples/competitive/sofm_compare_weight_init.py | 1 | 1754 | from itertools import product
import matplotlib.pyplot as plt
from neupy import algorithms, utils, init
from utils import plot_2d_grid, make_circle, make_elipse, make_square
plt.style.use('ggplot')
utils.reproducible()
if __name__ == '__main__':
GRID_WIDTH = 4
GRID_HEIGHT = 4
datasets = [
mak... | mit | 8,403,345,659,887,349,000 | 22.702703 | 69 | 0.562144 | false | 0 | en | 0.110449 | |
alphagov/stagecraft | stagecraft/libs/mass_update/copy_dataset_with_new_mapping.py | 1 | 5218 | import reversion
from performanceplatform.client import DataSet as client
from stagecraft.apps.datasets.models import DataGroup, DataSet, DataType
from django.conf import settings
INTERNAL_KEY = [
"_day_start_at",
"_hour_start_at",
"_week_start_at",
"_month_start_at",
"_quarter_start_at",
"_upd... | mit | 718,580,277,900,791,000 | 36.271429 | 78 | 0.61422 | false | >>> existing_attributes = {'a': 1, 'b': 2, 'c': 3}
>>> changed_attributes = {'a': 6, 'c': 'x,y'}
>>> get_new_attributes(existing_attributes,changed_attributes) == {'b': 2, 'c': 'x,y', 'a': 6}
True
should pass in whole mapping? we need to convert counts to i - they are floats currently | 295 | en | 0.447733 |
64studio/pdk | pdk/xml_legacy/sax/writer.py | 1 | 18896 | """SAX document handlers that support output generation of XML, SGML,
and XHTML.
This module provides three different groups of objects: the actual SAX
document handlers that drive the output, DTD information containers,
and syntax descriptors (of limited public use in most cases).
Output Drivers
--------------
The... | gpl-2.0 | -2,206,020,784,340,318,500 | 33.418944 | 84 | 0.512701 | false | comment start or end character reference open reference close declaration subset open declaration subset close entity reference open literal start or end quoted literal literal start or end (alternative) markup declaration open markup declaration close marked section close processing instruciton open start tag open end... | 810 | en | 0.726163 |
vkroz/kafka | tests/kafkatest/services/performance/end_to_end_latency.py | 1 | 3028 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | apache-2.0 | 6,619,955,687,392,177,000 | 42.884058 | 126 | 0.637715 | false | Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file ... | 751 | en | 0.883564 |
benhoff/chrome-stream-chat | CHATIMUSMAXIMUS/youtube_scrapper.py | 1 | 3564 | import sys
import os
#import httplib2
from time import sleep
from threading import Thread
from selenium import webdriver
from apiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import argparser, run_flow
from PyQt5 i... | mit | -8,556,869,593,251,939,000 | 32 | 85 | 0.632155 | false | import httplib2 TODO: see if this is needed or not NOTE: need some time for comments to load NOTE: this number is intentionally NEGATIVE | 136 | en | 0.865797 |
ecolell/pfamserver | pfamserver/commands/unused_columns.py | 1 | 2440 | unused_columns = {
'pdb': [
'keywords'
],
'pdb_pfamA_reg': [
'auto_pdb_reg',
'pdb_start_icode',
'pdb_end_icode',
'seq_start',
'seq_end',
'hex_color'
],
'pfamA': [
'previous_id',
'author',
'deposited_by',
'seed_so... | agpl-3.0 | -2,147,323,191,928,900,400 | 20.403509 | 35 | 0.431557 | false | 0 | en | 0.110449 | |
monodokimes/pythonmon | core/scene.py | 1 | 3014 | import controller.component
from util import jsonmanager, debug, configuration
from view.entity import Entity
class Scene:
def __init__(self, name, entities_data):
self.name = name
self.entities = []
self.started_entities = []
self.event_input = None
self.cont_input = None
... | gpl-3.0 | 2,675,223,090,908,184,000 | 31.06383 | 97 | 0.562044 | false | 0 | en | 0.110449 | |
by46/coffee | code1.py | 1 | 2408 | # -*- coding: utf-8 -*-
ENCODINGS = ['utf8', 'gbk']
def decode_statement(statement, encodings):
# if isinstance(statement, unicode):
# return statement
for encoding in encodings:
try:
return statement.decode(encoding)
except UnicodeDecodeError:
pass... | mit | 5,043,973,506,449,608,000 | 25.563218 | 66 | 0.455379 | false | -*- coding: utf-8 -*- if isinstance(statement, unicode): return statement ignore exception | 94 | en | 0.45204 |
jonathanslenders/python-vterm | libpymux/utils.py | 1 | 1881 | import array
import asyncio
import fcntl
import signal
import termios
def get_size(stdout):
# Thanks to fabric (fabfile.org), and
# http://sqizit.bartletts.id.au/2011/02/14/pseudo-terminals-in-python/
"""
Get the size of this pseudo terminal.
:returns: A (rows, cols) tuple.
"""
#assert st... | bsd-2-clause | 58,246,880,209,152,530 | 27.074627 | 90 | 0.640085 | false | Set a function to be called when the SIGWINCH signal is received.
(Normally, on terminal resize.)
Get the size of this pseudo terminal.
:returns: A (rows, cols) tuple.
Set terminal size.
(This is also mainly for internal use. Setting the terminal size
automatically happens when the window resizes. However, sometimes ... | 920 | en | 0.788632 |
openstack/python-troveclient | troveclient/tests/osc/v1/test_database_configurations.py | 1 | 14807 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | apache-2.0 | -6,860,908,495,404,124,000 | 36.581218 | 79 | 0.61221 | false | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the Lic... | 538 | en | 0.872906 |
sunlightlabs/read_FEC | fecreader/api/serializers.py | 1 | 6024 |
from fec_alerts.models import new_filing
from summary_data.models import Committee_Overlay, Candidate_Overlay, DistrictWeekly, District
from formdata.models import SkedE
from rest_framework import serializers
class NFSerializer(serializers.HyperlinkedModelSerializer):
form_name = serializers.Field(source='get_fo... | bsd-3-clause | 2,079,631,095,254,151,700 | 59.24 | 733 | 0.708001 | false | depth = 1depth = 1 | 18 | en | 0.619348 |
VandroiyLabs/FaroresWind | faroreswind/server/handler_Metadata.py | 1 | 3875 | ## database
import psycopg2
## system libraries
import io, os
import datetime, time
import logging
## web libraries
import tornado
import tornado.auth
import tornado.escape
import tornado.gen
import tornado.httpserver
import urlparse
import threading
import functools
from tornado.ioloop import IOLoop
from tornado.web... | gpl-3.0 | -8,024,903,895,091,325,000 | 28.135338 | 202 | 0.571871 | false | database system libraries web libraries custom libraries Retrieving data from inductions If in this else, someone tried to access this If in this else, someone tried to access this If in this else, someone tried to access this | 226 | en | 0.875917 |
aurex-linux/virt-manager | tests/capabilities.py | 1 | 9927 | # Copyright (C) 2013, 2014 Red Hat, Inc.
#
# 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 program is distribut... | gpl-2.0 | 8,204,153,660,796,448,000 | 38.392857 | 133 | 0.556966 | false | Copyright (C) 2013, 2014 Red Hat, Inc. 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 program is distributed in the hope t... | 716 | en | 0.904846 |
pamapa/callblocker | usr/share/callblocker/onlinecheck_phonespamfilter_com.py | 1 | 2486 | #!/usr/bin/env python3
# callblocker - blocking unwanted calls from your home phone
# Copyright (C) 2015-2020 Patrick Ammann <pammann@gmx.net>
#
# 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; ... | gpl-2.0 | -8,970,024,645,685,095,000 | 35.558824 | 111 | 0.641593 | false | !/usr/bin/env python3 callblocker - blocking unwanted calls from your home phone Copyright (C) 2015-2020 Patrick Ammann <pammann@gmx.net> 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... | 898 | en | 0.868982 |
miguelgrinberg/python-socketio | src/socketio/kombu_manager.py | 1 | 5298 | import pickle
import uuid
try:
import kombu
except ImportError:
kombu = None
from .pubsub_manager import PubSubManager
class KombuManager(PubSubManager): # pragma: no cover
"""Client manager that uses kombu for inter-process messaging.
This class implements a client manager backend for event shari... | mit | 5,484,561,835,408,599,000 | 42.42623 | 78 | 0.58607 | false | Client manager that uses kombu for inter-process messaging.
This class implements a client manager backend for event sharing across
multiple processes, using RabbitMQ, Redis or any other messaging mechanism
supported by `kombu <http://kombu.readthedocs.org/en/latest/>`_.
To use a kombu backend, initialize the :class:... | 1,716 | en | 0.705524 |
piotroxp/scibibscan | scib/lib/python3.5/site-packages/astropy/visualization/transform.py | 1 | 1198 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import division, print_function
__all__ = ['BaseTransform', 'CompositeTransform']
class BaseTransform(object):
"""
A transformation object.
This is used to construct transformations such as scaling, stretching, and
so o... | mit | -9,155,531,039,135,937,000 | 27.52381 | 79 | 0.647746 | false | A transformation object.
This is used to construct transformations such as scaling, stretching, and
so on.
A combination of two transforms.
Parameters
----------
transform_1: :class:`astropy.visualization.BaseTransform`
The first transform to apply.
transform_2: :class:`astropy.visualization.BaseTransform`
Th... | 412 | en | 0.726944 |
vhaupert/mitmproxy | mitmproxy/proxy/protocol/tls.py | 1 | 20430 | from typing import Optional # noqa
from typing import Union
from mitmproxy import exceptions
from mitmproxy.net import tls as net_tls
from mitmproxy.proxy.protocol import base
# taken from https://testssl.sh/openssl-rfc.mapping.html
CIPHER_ID_NAME_MAP = {
0x00: 'NULL-MD5',
0x01: 'NULL-MD5',
0x02: 'NULL-S... | mit | -2,940,024,410,166,875,000 | 39.216535 | 118 | 0.603279 | false | The TLS layer implements transparent TLS connections.
It exposes the following API to child layers:
- :py:meth:`set_server_tls` to modify TLS settings for the server connection.
- :py:attr:`server_tls`, :py:attr:`server_sni` as read-only attributes describing the current TLS settings for
the server conn... | 4,513 | en | 0.88863 |
fragaria/BorIS | boris/services/migrations/0018_delete_pregnancytest.py | 1 | 1313 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.db import models, migrations
def reconvert_tests(apps, schema_editor):
pass
def convert_tests(apps, schema_editor):
# convert PregnancyTest to UrineTest.pregnancy_test
... | mit | 1,142,179,289,645,332,700 | 30.261905 | 87 | 0.657273 | false | -*- coding: utf-8 -*- convert PregnancyTest to UrineTest.pregnancy_test new installations don't have the ct | 107 | en | 0.830012 |
supriyantomaftuh/zget | zget/put.py | 1 | 7124 | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, \
unicode_literals
import os
import sys
import time
import socket
try:
import urllib.request as urllib
except ImportError:
import urllib
import hashlib
import argparse
import logging
from zeroconf import ServiceInfo, Ze... | mit | -6,137,828,054,823,278,000 | 25.681648 | 79 | 0.580011 | false | Custom HTTP upload handler that allows one single filename to be requested.
HTTP Server that knows a certain filename and can be set to remember if
that file has been transferred using :class:`FileHandler`
Commandline interface for sending files
Suppress log messages by overloading this function
Send a file using the z... | 1,030 | en | 0.759018 |
russellhadley/coreclr | src/scripts/genEventPipe.py | 1 | 17048 | from __future__ import print_function
from genXplatEventing import *
from genXplatLttng import *
import os
import xml.dom.minidom as DOM
stdprolog = """// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in th... | mit | -4,561,604,318,752,009,700 | 33.297787 | 130 | 0.622492 | false | EventPipeEvent declaration generate EventPipeEventEnabled function generate EventPipeWriteEvent function EventPipeProvider and EventPipeEvent initialization split keywords if there are multiple generate Cmake file generate helper file generate all keywords generate .cpp file for each provider parse the command line | 316 | en | 0.561417 |
wasserfeder/lomap | lomap/algorithms/dijkstra.py | 1 | 12332 | #! /usr/bin/python
# Copyright (C) 2012-2015, Alphan Ulusoy (alphan@bu.edu)
#
# 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 ve... | gpl-2.0 | 134,945,866,439,583,540 | 27.948357 | 81 | 0.665504 | false | Compute shortest paths and lengths in a weighted graph G.
Adapted from 'single_source_dijkstra_path' in NetworkX, available at
http://networkx.github.io.
Parameters
----------
G : NetworkX graph
source : Node label
Starting node for the path
weight_key: String, optional (default: 'weight')
Edge data ... | 5,974 | en | 0.759081 |
jness/MTG-Toolbox | WebMTG/models.py | 1 | 2426 | from django.db import models
from django.contrib.auth.models import User
class MTGSet(models.Model):
label = models.CharField(max_length=75, unique=True)
display_name = models.CharField(max_length=75)
magiccards_info = models.CharField(max_length=10, null=True)
created = models.DateTimeField(auto_now_a... | gpl-2.0 | -2,379,355,143,322,243,000 | 35.208955 | 64 | 0.694559 | false | 0 | en | 0.110449 | |
lucasdavid/grapher | grapher/repositories/graph.py | 1 | 6676 | import abc
import py2neo
from py2neo import Graph, Node, Relationship
from . import base
from .. import errors, settings
class GraphRepository(base.Repository, metaclass=abc.ABCMeta):
_g = None
connection_string = settings.effective.DATABASES['neo4j']
@property
def g(self):
self._g = self._g... | mit | -8,926,344,130,431,322,000 | 30.342723 | 100 | 0.587627 | false | Build entities or relationships based on their identities.
:param identities: :list of identities compatible with
self.schema[self.schema.Meta.identity]['type'].
:return: a list of :nodes or :relationships corresponding to
the identities passed, in order.
Match all relationships, as long as they share the same label
... | 931 | en | 0.792146 |
ktnyt/chainer | chainer/training/extensions/variable_statistics_plot.py | 1 | 13261 | from __future__ import division
import os
import warnings
import numpy
import six
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer.training import extension
from chainer.training import trigger as trigger_module
_available = None
def _try_import_matplotlib():
global ma... | mit | -7,535,819,348,694,704,000 | 35.938719 | 79 | 0.544529 | false | Reservoir sample with a fixed sized buffer.
Helper to compute basic NumPy-like statistics.
Trainer extension to plot statistics for :class:`Variable`\s.
This extension collects statistics for a single :class:`Variable`, a list
of :class:`Variable`\s or similarly a single or a list of
:class:`Link`\s containing one or ... | 3,017 | en | 0.802591 |
Taywee/texttables | texttables/fixed/_writer.py | 1 | 8641 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2017 Taylor C. Richberger <taywee@gmx.com>
# This code is released under the license described in the LICENSE file
from __future__ import division, absolute_import, print_function, unicode_literals
from six.moves import zip
from texttables.dialect import Dia... | mit | 2,384,864,735,107,385,000 | 33.422311 | 86 | 0.612731 | false | Fixed-table document writer, writing tables with predefined column-sizes
and names through dictionary rows passed in.
The :class:`texttables.Dialect` class is used to configure how this writes
tables. This is a simple convenience frontend to
:class:`texttables.fixed.writer`.
This works as a context manager, in which ... | 2,983 | en | 0.815413 |
p99tunnel/p99tunnel | setup_database/create_tables.py | 1 | 1180 | #!/usr/bin/env python3
import db
# The limits on character fields were determined by looking at a sample of logs
# and figuring out how big things could be.
CREATE_TABLE_STATEMENTS = [
"""CREATE TABLE characters (
id SERIAL PRIMARY KEY,
name varchar(16)
);""",
"""CREATE TABLE items (
id SERIAL PRI... | apache-2.0 | 2,982,044,504,163,306,500 | 22.6 | 79 | 0.658475 | false | !/usr/bin/env python3 The limits on character fields were determined by looking at a sample of logs and figuring out how big things could be. | 141 | en | 0.976812 |
thorfi/pass-words-py | pass-words.py | 1 | 6672 | #!/usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) 2014-2021 David Goh <david@goh.id.au>
#
# 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 withou... | mit | 7,877,558,534,059,127,000 | 31.546341 | 121 | 0.583633 | false | Exit with a potential error message.
!/usr/bin/env python The MIT License (MIT) Copyright (c) 2014-2021 David Goh <david@goh.id.au> 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 restrict... | 1,247 | en | 0.831184 |
kickstandproject/python-ripcordclient | ripcordclient/common/utils.py | 1 | 2525 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# Copyright (C) 2013 PolyBeacon, Inc.
#
# Author: Paul Belanger <paul.belanger@polybeacon.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 obt... | apache-2.0 | -3,201,683,492,522,797,600 | 29.421687 | 74 | 0.629703 | false | Search for the first defined of possibly many env vars
Returns the first environment variable defined in vars, or
returns the default defined in kwargs.
Return a tuple containing the item properties.
:param item: a single item resource (e.g. Server, Tenant, etc)
:param fields: tuple of strings with the desired field ... | 1,073 | en | 0.753356 |
carthagecollege/django-djtools | djtools/context_processors.py | 1 | 1233 | from django.conf import settings
def sitevars(request):
context = {}
try:
context['static_root'] = settings.MEDIA_ROOT
context['media_root'] = settings.MEDIA_ROOT
context['media_url'] = settings.MEDIA_URL
context['static_url'] = settings.STATIC_URL
context['se... | unlicense | 4,474,720,833,405,657,600 | 33.228571 | 126 | 0.534469 | false | UI helpers for email | 20 | en | 0.502723 |
anilpai/leetcode | Matrix/MatrixRotate90deg.py | 1 | 1767 | # An Inplace function to rotate a N x N matrix by 90 degrees
# In both clockwise and counter clockwise direction
class Solution(object):
def Rotate90Clock(self, mat):
N = len(mat)
for x in range(int(N/2)):
for y in range(x, N-x-1):
temp = mat[x][y]
'''... | mit | -1,409,958,039,993,768,700 | 26.625 | 60 | 0.449915 | false | An Inplace function to rotate a N x N matrix by 90 degrees In both clockwise and counter clockwise direction Utility Function | 125 | en | 0.828283 |
isra17/nrs | tests/test_nsisfile.py | 1 | 2037 | from nrs import nsisfile
import pytest
import utils
import os
import sys
EMPTY_PATH = os.path.join(utils.SAMPLES_DIR, 'empty')
EXAMPLE1_PATH = os.path.join(utils.SAMPLES_DIR, 'example1.exe')
EMPTY_PATH = os.path.join(utils.SAMPLES_DIR, 'vopackage.exe')
def test_non_nsis():
with pytest.raises(nsisfile.HeaderNotFou... | gpl-3.0 | 3,935,376,642,075,163,000 | 37.433962 | 80 | 0.644084 | false | 0 | en | 0.110449 | |
Guts/DicoGIS | dicogis/georeaders/Infos_Rasters.py | 1 | 14889 | #! python3 # noqa: E265
# ----------------------------------------------------------------------------
# Name: Infos Rasters
# Purpose: Use GDAL library to extract informations about
# geographic rasters data. It permits a more friendly use as
# submodule.
#
# Author:... | gpl-3.0 | -6,192,580,079,353,181,000 | 34.877108 | 110 | 0.525287 | false | Callable error handler.
see: http://trac.osgeo.org/gdal/wiki/PythonGotchas#Exceptionsraisedincustomerrorhandlersdonotgetcaught
and http://pcjericks.github.io/py-gdalogr-cookbook/gdal_general.html#install-gdal-ogr-error-handler
Use GDAL functions to extract basic informations about
geographic raster file (handles ECW, ... | 3,098 | en | 0.563548 |
leiferikb/bitpop | src/tools/telemetry/telemetry/core/webpagereplay.py | 1 | 9250 | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Start and stop Web Page Replay.
Of the public module names, the following one is key:
ReplayServer: a class to start/stop Web Page Replay.
"""
imp... | gpl-3.0 | -2,729,612,260,395,174,000 | 35.132813 | 80 | 0.645838 | false | Catch-all exception for the module.
Start and Stop Web Page Replay.
Web Page Replay is a proxy that can record and "replay" web pages with
simulated network characteristics -- without having to edit the pages
by hand. With WPR, tests can use "real" web content, and catch
performance issues that may result from introdu... | 2,736 | en | 0.834561 |
LibreGameArchive/silvertree | scons/gl.py | 1 | 1408 | # vi: syntax=python:et:ts=4
def CheckOpenGL(context, libs = ["gl"]):
context.Message("Checking for OpenGL... ")
env = context.env
backup = env.Clone().Dictionary()
if env["PLATFORM"] == "win32":
libnames = { "gl" : "opengl32", "glu" : "glu32" }
else:
libnames = { "gl" : "GL", "glu" ... | gpl-3.0 | -9,038,046,539,964,435,000 | 28.333333 | 67 | 0.551136 | false | vi: syntax=python:et:ts=4 | 25 | cs | 0.660387 |
brunogamacatao/portalsaladeaula | portal/models.py | 1 | 34418 | # -*- coding: utf-8 -*-
import logging
from operator import attrgetter
from django.db import models
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from djangotoolbox.fields import BlobField, SetField
from django.template impor... | bsd-3-clause | -775,253,353,824,724,200 | 40.678788 | 155 | 0.640686 | false | -*- coding: utf-8 -*-Here we automatically fill the width, height and format fields of a picture.If the acronym field is not filled, it will receive the value from name field.To speedup the system, these roles will be queried just onceTo speedup the system, these roles will be queried just onceTo speedup the system, th... | 355 | en | 0.794939 |
j-i-l/cryptsypy | cryptsypy/CryptsyAccount.py | 1 | 7173 | from pyapi import Request,RequestPrivate
#this is going to be it
#from pyapi import AccountStructure
from CryptsyInfo import Info
import time
# <codecell>
#pur account into pyapi and inherit the specific platform account
#from the general class.
class Account():
#class Account(AccountStructure):
#it does not make... | mit | -7,307,154,705,212,212,000 | 32.0553 | 88 | 0.538269 | false | this is going to be itfrom pyapi import AccountStructure <codecell>pur account into pyapi and inherit the specific platform accountfrom the general class.class Account(AccountStructure):it does not make much sense to have the info in a class...AccountStructure.__init__(self, PlatfromInfo = Plat... | 1,131 | en | 0.617781 |
akretion/odoo | odoo/addons/base/tests/test_mimetypes.py | 10 | 3575 | import base64
import unittest
from odoo.tests.common import BaseCase
from odoo.tools.mimetypes import guess_mimetype
PNG = b'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC'
GIF = b"R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs="
BMP = b"""Qk1+AAAAAAAAAHoAAABsAAAAAQAAAAE... | agpl-3.0 | -6,423,755,072,895,653,000 | 46.666667 | 101 | 0.726434 | false | odoo implementation returns application/octet-stream by default if available, python-magic returns application/x-empty if available, python-magic returns application/x-empty mimetype should match image/bmp, image/x-ms-bmp, ... Tests that whitespace padded SVG are not detected as SVG | 283 | en | 0.524321 |
gklyne/annalist | src/annalist_root/annalist_manager/tests/test_annalist_site.py | 1 | 3181 | """
Test module for annalist-manager site data management commands
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2018, G. Klyne"
__license__ = "MIT (http://opensource.org/licen... | mit | -5,898,015,406,387,909,000 | 34.741573 | 103 | 0.582207 | false | Test module for annalist-manager site data management commands
----------------------------------------------------------------------------- Tests ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Tests... | 405 | en | 0.198156 |
Geotab/mygeotab-python | tests/test_dates.py | 1 | 4844 | # -*- coding: utf-8 -*-
from datetime import datetime
import pytz
from mygeotab import dates
class TestGetUtcDate:
def test_naive_datetime_to_utc(self):
date = datetime(2015, 3, 12, 2, 45, 34)
utc_date = dates.localize_datetime(date, pytz.utc)
assert utc_date.tzinfo is not None
... | apache-2.0 | -4,481,764,768,974,608,000 | 38.704918 | 98 | 0.619942 | false | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
Micronaet/micronaet-migration | purchase_extra_field/purchase.py | 1 | 5464 | # -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebrush>)
# This pro... | agpl-3.0 | 2,421,605,581,973,595,600 | 34.947368 | 79 | 0.58071 | false | Add extra field in product (used in form and report)
Add here maybe not used
Add extra field in purchase order line
Field function, for every ids test if there's image and return
base64 format according to code value (images are jpg)
Get single image for the file
(default path is ~/photo/db_name/quotatio... | 1,480 | en | 0.811118 |
LinDA-tools/LindaWorkbench | linda/linda_app/urls.py | 1 | 10160 | from django.contrib import admin
from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
from django.views.generic import RedirectView
from linda_app.forms import AutocompleteModelSearchForm
from haystack.views import SearchView, search_view_factory
from linda_app.... | mit | 8,392,267,029,180,516,000 | 58.415205 | 127 | 0.504528 | false | Basic pages Endpoints Visualizations Analytics Transformation Engine Query Designer Endpoint Monitor Authentication Messaging Site search Vocabulary search Vocabularies Vocabulary updates Vocabulary repo proxy Datasources Query Builder Installer API calls | 255 | en | 0.534973 |
drewsonne/cfn-json-to-yaml | cfnjsontoyaml/mixins/__init__.py | 1 | 1048 | from cfnjsontoyaml.yamlobject.base64 import Base64
from cfnjsontoyaml.yamlobject.equals import Equals
from cfnjsontoyaml.yamlobject.findinmap import FindInMap
from cfnjsontoyaml.yamlobject.fnand import And
from cfnjsontoyaml.yamlobject.fnif import If
from cfnjsontoyaml.yamlobject.fnnot import Not
from cfnjsontoyaml.yam... | lgpl-3.0 | -9,176,360,153,192,987,000 | 32.806452 | 60 | 0.754771 | false | 0 | en | 0.110449 | |
DantestyleXD/MVM5B_BOT | plugins/mine.py | 1 | 2025 | # -*- coding: utf-8 -*-
from config import *
print(Color(
'{autored}[{/red}{autoyellow}+{/yellow}{autored}]{/red} {autocyan} mine.py importado.{/cyan}'))
@bot.message_handler(commands=['mine'])
def command_COMANDO(m):
cid = m.chat.id
uid = m.from_user.id
try:
send_udp('mine')
except Exc... | gpl-2.0 | 7,239,661,459,171,880,000 | 37.188679 | 106 | 0.473814 | false | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
fhqgfss/MoHa | moha/posthf/pt/mp.py | 1 | 2331 | import numpy as np
def spinfock(eorbitals):
"""
"""
if type(eorbitals) is np.ndarray:
dim = 2*len(eorbitals)
fs = np.zeros(dim)
for i in range(0,dim):
fs[i] = eorbitals[i//2]
fs = np.diag(fs) # put MO energies in diagonal array
elif type(eorbitals) is dict:
... | mit | -7,517,407,249,570,599,000 | 37.213115 | 167 | 0.531532 | false | put MO energies in diagonal array put MO energies in diagonal array | 67 | en | 0.726604 |
ppGodel/ADA2017 | Tareas/tarea5.py | 1 | 2081 | #flujos y arboles de expancion Ford-fulkerson y grafos densos,grandes y normales
#archivos necesarios dentro de la carpeta files
# graph.py, InstanciesGenerator.py
from files import graph
from files import InstanciesGenerator
import random
import time
# se genera un grafo con densidad alta y con una cantidad de vertice... | gpl-3.0 | 9,055,192,903,225,367,000 | 56.75 | 339 | 0.740741 | false | flujos y arboles de expancion Ford-fulkerson y grafos densos,grandes y normalesarchivos necesarios dentro de la carpeta files graph.py, InstanciesGenerator.py se genera un grafo con densidad alta y con una cantidad de vertices alta, para ver el desempeño del algoritmo con grafos diversos se probara con 105, 205 y 1005 ... | 891 | es | 0.9144 |
gschizas/praw | praw/models/reddit/comment.py | 1 | 12884 | """Provide the Comment class."""
from typing import Any, Dict, Optional, TypeVar, Union
from ...const import API_PATH
from ...exceptions import ClientException, InvalidURL
from ...util.cache import cachedproperty
from ..comment_forest import CommentForest
from .base import RedditBase
from .mixins import (
Fullname... | bsd-2-clause | 8,281,210,984,734,887,000 | 34.888579 | 79 | 0.574589 | false | A class that represents a reddit comments.
**Typical Attributes**
This table describes attributes that typically belong to objects of this
class. Since attributes are dynamically provided (see
:ref:`determine-available-attributes-of-an-object`), there is not a
guarantee that these attributes will always be present, n... | 5,819 | en | 0.755554 |
DIPlib/diplib | pydip/src/__main__.py | 1 | 1301 | # PyDIP 3.0, Python bindings for DIPlib 3.0
# This file contains functionality to download bioformats
#
# (c)2020, Wouter Caarls
#
# 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://... | apache-2.0 | 2,904,086,616,590,238,000 | 39.65625 | 111 | 0.69485 | false | PyDIP 3.0, Python bindings for DIPlib 3.0 This file contains functionality to download bioformats (c)2020, Wouter Caarls 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/licen... | 641 | en | 0.857805 |
FCP-INDI/C-PAC | CPAC/pipeline/cpac_runner.py | 1 | 27944 | import os
import glob
import warnings
import yaml
from multiprocessing import Process
from time import strftime
from voluptuous.error import Invalid
from CPAC.utils.configuration import Configuration
from CPAC.utils.ga import track_run
from CPAC.longitudinal_pipeline.longitudinal_workflow import (
anat_longitudina... | bsd-3-clause | -3,887,706,195,881,829,400 | 45.266556 | 279 | 0.482179 | false | Function to build a SLURM batch job submission script and
submit it to the scheduler via 'sbatch'
Run condor jobs Import packagescommands.getoutput('chmod +x %s' % subject_bash_file ) Create and run script for CPAC to run on cluster Import packages Load in pipeline config Load in the subject list Init variables For S... | 1,987 | en | 0.777514 |
Esri/executive-dashboard | ExecutiveReportingScript/executive_dashboard.py | 1 | 13149 | #-------------------------------------------------------------------------------
# Name: executive_dashboard.py
# Purpose:
#
# Author: Local Government
#
# Created: 05/06/2016 AM
# Version: Python 2.7
#-------------------------------------------------------------------------------
import json, ... | apache-2.0 | 8,910,792,757,372,526,000 | 39.962617 | 231 | 0.558369 | false | ------------------------------------------------------------------------------- Name: executive_dashboard.py Purpose: Author: Local Government Created: 05/06/2016 AM Version: Python 2.7------------------------------------------------------------------------------- Messages script name + line num... | 1,223 | en | 0.711647 |
m-ober/byceps | byceps/services/attendance/service.py | 1 | 3675 | """
byceps.services.attendance.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from collections import defaultdict
from typing import Dict, Iterable, List, Optional, Set, Tuple
from ...database import db, paginate, Pagination
... | bsd-3-clause | 7,584,223,255,903,972,000 | 28.4 | 80 | 0.647891 | false | Return the party's ticket users with tickets and seats.
byceps.services.attendance.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
Drop revoked tickets here already to avoid users without tickets being included in the list. List t... | 403 | en | 0.790271 |
adamhaney/pykell | tests.py | 1 | 3811 | from unittest import TestCase
from .types import expects_type, returns_type, T
@expects_type(a=T(int), b=T(str))
def example_kw_arg_function(a, b):
return a, b
class ExpectsTests(TestCase):
def test_correct_expectations_kw(self):
self.assertEqual(example_kw_arg_function(a=1, b="baz"), (1, "baz"))
... | mit | 7,787,685,935,964,463,000 | 29.246032 | 92 | 0.635791 | false | In some cases we may just care that a validator is true, not
what the underlying type is
make sure we can add two types to the class and that it then
says an object having one of those types is valid | 199 | en | 0.967028 |
psathyrella/partis | python/treeutils.py | 1 | 183169 | import __builtin__
import operator
import string
import itertools
import copy
import collections
import random
import csv
from cStringIO import StringIO
import subprocess
import tempfile
import os
import numpy
import sys
from distutils.version import StrictVersion
import dendropy
import time
import math
import json
imp... | gpl-3.0 | -1,847,442,446,347,377,700 | 71.570919 | 556 | 0.596853 | false | not sure on the exact version I need, but 3.12.0 is missing lots of vital tree fcns I really thought this was somewhere, but can't find it so adding it here ---------------------------------------------------------------------------------------- --------------------------------------------------------------------------... | 56,560 | en | 0.826809 |
DavidCain/mitoc-trips | ws/migrations/0020_typo_corrections.py | 1 | 1360 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [('ws', '0019_2020_ws_application')]
operations = [
migrations.AlterField(
model_name='climbingleaderapplication',
name='familiarity_spotting',
field=models.CharField(
... | gpl-3.0 | 5,556,380,076,097,705,000 | 37.857143 | 114 | 0.546324 | false | 0 | en | 0.110449 | |
tomfa/flashcard-json-maker | simplequiz_interpreter.py | 1 | 3968 | #coding: utf-8
'''
This script reads a Q-A txt-file and generates JSON output.
USAGE:
Save your Q-A file
FORMAT:
Chapter 1 - cakes. The whole line is a part of the chapter title.
Q: Question that we wonder about?
A: Answer telling us what we want to know?
Q: Empty ... | mit | 7,440,680,661,345,437,000 | 27.161765 | 75 | 0.554463 | false | coding: utf-8 String Are we currently reading a question? Are we currently reading an answer? omit 'Chapter ' line[3:] is to skip the 'q: '. Not pretty line[3:] is to skip the 'a: '. Not pretty If the line doesn't start with anything interesting, we append to | 259 | en | 0.94858 |
chudaol/edx-platform | cms/envs/common.py | 1 | 33521 | # -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change th... | agpl-3.0 | 239,010,632,844,921,660 | 31.200768 | 182 | 0.653113 | false | This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change the feature
configuration in a... | 11,783 | en | 0.834682 |
openstack/python-saharaclient | saharaclient/tests/unit/test_data_sources.py | 1 | 4609 | # Copyright (c) 2014 Mirantis Inc.
#
# 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 ... | apache-2.0 | 7,927,911,403,367,229,000 | 37.731092 | 78 | 0.611195 | false | Copyright (c) 2014 Mirantis Inc. 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 writi... | 768 | en | 0.810175 |
dana-i2cat/felix | modules/resource/utilities/rspecs/serm/request_parser.py | 1 | 4179 | from rspecs.parser_base import ParserBase
from rspecs.commons_se import SELink
from rspecs.commons_tn import Node, Interface
import core
logger = core.log.getLogger("utility-rspec")
class SERMv3RequestParser(ParserBase):
def __init__(self, from_file=None, from_string=None):
super(SERMv3RequestParser, sel... | apache-2.0 | 6,311,328,318,198,974,000 | 38.8 | 78 | 0.556832 | false | according to the proposed URNs structure, a SE-node MUST have "serm" as resource-name (client_id) and authority (component_manager_id) fields At least we verify the autority field here! according to the proposed URNs structure, a TN-link MUST have "serm" as resource-name (client_id) and authority (component_manager_nam... | 423 | en | 0.937811 |
katajakasa/utuputki2 | alembic/versions/4690204e5a62_initial.py | 1 | 5560 | """Initial
Revision ID: 4690204e5a62
Revises:
Create Date: 2015-10-28 18:43:54.656000
"""
# revision identifiers, used by Alembic.
revision = '4690204e5a62'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by... | mit | -8,873,998,268,785,954,000 | 40.185185 | 80 | 0.648741 | false | Initial
Revision ID: 4690204e5a62
Revises:
Create Date: 2015-10-28 18:43:54.656000
revision identifiers, used by Alembic. commands auto generated by Alembic - please adjust! end Alembic commands commands auto generated by Alembic - please adjust! end Alembic commands | 274 | en | 0.660342 |
optiflows/nyuki | nyuki/workflow/tasks/trigger_workflow.py | 1 | 7024 | import json
import asyncio
import logging
from enum import Enum
from aiohttp import ClientSession
from tukio.task import register
from tukio.task.holder import TaskHolder
from tukio.workflow import WorkflowExecState, Workflow
from .utils import runtime
from .utils.uri import URI
log = logging.getLogger(__name__)
c... | apache-2.0 | 5,176,207,135,158,172,000 | 33.431373 | 79 | 0.530325 | false | Called when this task is cancelled or timed out.
Reporting Send the HTTP request Setup headers (set requester and exec-track to avoid workflow loops) Handle blocking trigger_workflow using mqtt Compute data to send to sub-workflows Block until task completed | 260 | en | 0.923069 |
petroniocandido/pyFTS | pyFTS/models/seasonal/msfts.py | 1 | 1921 | import numpy as np
from pyFTS.common import FLR
from pyFTS.models.seasonal import sfts
class MultiSeasonalFTS(sfts.SeasonalFTS):
"""
Multi-Seasonal Fuzzy Time Series
"""
def __init__(self, name, indexer, **kwargs):
super(MultiSeasonalFTS, self).__init__("MSFTS")
self.name = "Multi Seas... | gpl-3.0 | -2,375,264,770,700,917,000 | 28.106061 | 96 | 0.580947 | false | Multi-Seasonal Fuzzy Time Series
ndata = self.indexer.set_data(data,self.doTransformations(self.indexer.get_data(data))) | 121 | en | 0.19336 |
bigswitch/neutron | neutron/tests/functional/pecan_wsgi/test_hooks.py | 1 | 22434 | # Copyright (c) 2015 Mirantis, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | apache-2.0 | 8,203,198,585,067,558,000 | 44.505071 | 79 | 0.578764 | false | Copyright (c) 2015 Mirantis, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law... | 2,404 | en | 0.909686 |
neep305/swordfish | text_analysis/fileutil.py | 1 | 1183 | from konlpy.tag import Hannanum
from collections import Counter
import pandas as pd
import csv
import json
def read_localcsv(path):
result = pd.read_csv(path, encoding='UTF-8')
print(result)
return result
def get_json_data(path):
#r = requests.get(URL)
#data = r.text
RESULTS = {"children": []}
with open(... | mit | -798,070,984,540,722,700 | 22.196078 | 45 | 0.667794 | false | r = requests.get(URL)data = r.text print(json.dumps(RESULTS)) for word,cnt in count.most_common(ntags): print(word,cnt) localcsv = read_localcsv(path) | 150 | en | 0.50476 |
dtrodrigues/nifi-minifi-cpp | libminifi/test/script-tests/test_scripts/stateful_processor.py | 2 | 1602 | #
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may... | apache-2.0 | 7,008,879,742,411,832,000 | 33.826087 | 93 | 0.714107 | false | Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this f... | 789 | en | 0.880515 |
prymitive/upaas-admin | upaas_admin/features/cron.py | 1 | 1583 | # -*- coding: utf-8 -*-
"""
:copyright: Copyright 2014 by Łukasz Mierzwa
:contact: l.mierzwa@gmail.com
"""
from __future__ import unicode_literals
import logging
from django.utils.translation import ugettext as _
from upaas.config.base import (Config, ConfigurationError, StringEntry,
... | gpl-3.0 | 2,626,893,547,294,586,400 | 28.296296 | 79 | 0.584071 | false | :copyright: Copyright 2014 by Łukasz Mierzwa
:contact: l.mierzwa@gmail.com
-*- coding: utf-8 -*- | 98 | en | 0.42151 |
Zerknechterer/pyload | module/plugins/hoster/GoogledriveCom.py | 1 | 1839 | # -*- coding: utf-8 -*
#
# Test links:
# https://drive.google.com/file/d/0B6RNTe4ygItBQm15RnJiTmMyckU/view?pli=1
import re
import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.utils import html_unescape
class GoogledriveCom(SimpleHoster):
__name__ = "Goo... | gpl-3.0 | -4,720,897,857,208,252,000 | 29.65 | 105 | 0.559543 | false | -*- coding: utf-8 -* Test links: https://drive.google.com/file/d/0B6RNTe4ygItBQm15RnJiTmMyckU/view?pli=1: Remove in 0.4.10 | 124 | en | 0.362878 |
abcdef123/stem | test/integ/descriptor/server_descriptor.py | 1 | 14214 | """
Integration tests for stem.descriptor.server_descriptor.
"""
from __future__ import with_statement
import datetime
import os
import unittest
import stem.control
import stem.descriptor.server_descriptor
import stem.exit_policy
import stem.version
import test.integ.descriptor
import test.runner
class TestServerDe... | lgpl-3.0 | -4,238,564,453,306,384,400 | 43.981013 | 128 | 0.728015 | false | Parses a bridge descriptor.
Parses the cached descriptor file in our data directory, checking that it
doesn't raise any validation issues and looking for unrecognized descriptor
additions.
Parses a descriptor with a huge contact line containing anomalous carriage
returns ('
' entries).
Parses and checks our results aga... | 1,440 | en | 0.849946 |
jgrundstad/viewer | admin.py | 1 | 1761 | from django.contrib import admin
from models import Project, Bnid, Sample, Study, Caller, Report, Variant, \
Genome, Contact, SharedData
class ProjectAdmin(admin.ModelAdmin):
model = Project
list_display = ('id', 'name', 'description', 'creation_date')
filter_horizontal = ('user', )
class BnidAdmin(... | apache-2.0 | -6,679,012,992,260,252,000 | 26.968254 | 85 | 0.693924 | false | 0 | en | 0.110449 | |
yongshengwang/builthue | apps/oozie/src/oozie/models.py | 1 | 80907 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apache-2.0 | 4,944,804,039,425,903,000 | 38.640862 | 183 | 0.636088 | false | !/usr/bin/env python Licensed to Cloudera, Inc. under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Cloudera, Inc. licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use thi... | 2,111 | en | 0.786375 |
d/hamster-applet | src/docky_control/2.1/hamster_control.py | 1 | 3518 | #!/usr/bin/env python
#
# Copyright (C) 2010 Toms Baugis
#
# Original code from Banshee control,
# Copyright (C) 2009-2010 Jason Smith, Rico Tzschichholz
#
# 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 Soft... | gpl-3.0 | 982,473,164,084,869,900 | 29.591304 | 143 | 0.666003 | false | !/usr/bin/env python Copyright (C) 2010 Toms Baugis Original code from Banshee control, Copyright (C) 2009-2010 Jason Smith, Rico Tzschichholz 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, eit... | 979 | en | 0.87316 |
JoshBorke/redline | accounts/urls.py | 1 | 2078 | from django.conf.urls.defaults import *
from redline import settings
urlpatterns = patterns('redline.accounts.views',
url(r'^$', 'accounts_list', name='account_list'),
url(r'^overview/(?P<year>\d+)/(?P<month>\d+)/$', 'accounts_detail', name='accounts_detail'),
url(r'^overview/(?P<year>\d+)/(?P<month>\d+)/(... | gpl-3.0 | -7,997,031,493,255,206,000 | 66.032258 | 161 | 0.60924 | false | for specific accounts for misc for account types, not used | 58 | en | 0.7827 |
iirob/python-opcua | opcua/common/structures.py | 1 | 11226 | """
Support for custom structures in client and server
We only support a subset of features but should be enough
for custom structures
"""
import os
import importlib
import re
import logging
# The next two imports are for generated code
from datetime import datetime
import uuid
from enum import Enum, IntEnum, EnumMeta... | lgpl-3.0 | -3,811,595,053,384,737,300 | 30.622535 | 152 | 0.576786 | false | Remove characters that might be present in OPC UA structures
but cannot be part of of Python class names
generate Python code and execute in a new environment
return a dict of structures {name: class}
Rmw: Since the code is generated on the fly, in case of error the stack trace is
not available and debugging is very ... | 1,799 | en | 0.865319 |
albertoriva/bioscripts | simplediff.py | 1 | 5294 | #!/usr/bin/env python
import sys
import csv
import math
def parseSlice(s):
if "-" in s:
parts = s.split("-")
return slice(int(parts[0]) - 1, int(parts[1]))
else:
p = int(s)
return slice(p-1, p)
class SimpleDiff():
filename = None
outfile = "/dev/stdout"
labels = No... | gpl-3.0 | 6,085,323,893,334,041,000 | 34.293333 | 107 | 0.525123 | false | !/usr/bin/env python A over B B over A | 38 | en | 0.310559 |
Erotemic/ibeis | dev/_scripts/_timeits/time_uuids.py | 1 | 4117 | # -*- coding: utf-8 -*-
"""
Script to help time determenistic uuid creation
"""
from __future__ import absolute_import, division, print_function
from six.moves import range, builtins
import os
import multiprocessing
import time
from PIL import Image
import hashlib
import numpy as np
import uuid
from utool._internal.met... | apache-2.0 | 6,607,357,199,787,421,000 | 26.817568 | 83 | 0.634685 | false | Script to help time determenistic uuid creation
-*- coding: utf-8 -*- My data getters hash the bytes using sha1 sha1 produces 20 bytes, but UUID requires 16 bytes NOQA Read PIL image data NOQA Read PIL image data NOQA Read PIL image data NOQA Read PIL image data NOQA Read PIL image data NOQA Read PIL image data NOQA ... | 356 | en | 0.652132 |
bjodah/chempy | benchmarks/benchmarks/equilibria.py | 1 | 1079 | import numpy as np
from chempy.tests.ammonical_cupric_solution import get_ammonical_cupric_eqsys
class TimeEqsys:
def setup(self):
self.eqsys, self.c0 = get_ammonical_cupric_eqsys()
def time_roots(self):
x, new_inits, success = self.eqsys.roots(self.c0, np.logspace(-3, 0, 50), "NH3")
... | bsd-2-clause | -5,027,225,692,750,565,000 | 23.522727 | 88 | 0.570899 | false | t1 = time.time() te.time_roots_symengine() print(time.time()-t1) | 64 | en | 0.311882 |
hgamboa/novainstrumentation | novainstrumentation/peakdelta.py | 1 | 2443 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 20 16:20:03 2013
@author: utilizador
"""
import sys
from numpy import NaN, Inf, arange, isscalar, array, asarray
##############################################################################
########################### Peaks Detection ###################... | mit | -1,012,318,517,677,826,700 | 27.792683 | 80 | 0.462137 | false | Returns two arrays
function [maxtab, mintab]=peakdelta(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = peakdelta(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and co... | 893 | en | 0.791807 |
google/report2bq | application/classes/report_type_test.py | 1 | 1637 | # Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | -4,314,635,563,280,956,400 | 33.829787 | 80 | 0.645082 | false | Copyright 2021 Google LLC 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 https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distribut... | 548 | en | 0.870506 |
702nADOS/sumo | tools/xml/xml2csv.py | 1 | 10954 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file xml2csv.py
@author Jakob Erdmann
@author Michael Behrisch
@author Laura Bieker
@date 2013-12-08
@version $Id: xml2csv.py 22608 2017-01-17 06:28:54Z behrisch $
Convert hierarchical xml files to csv. This only makes sense if the hierarchy has low depth.
S... | gpl-3.0 | -2,313,956,629,142,083,600 | 38.545126 | 122 | 0.576228 | false | A handler which knows the current nesting of tags
@file xml2csv.py
@author Jakob Erdmann
@author Michael Behrisch
@author Laura Bieker
@date 2013-12-08
@version $Id: xml2csv.py 22608 2017-01-17 06:28:54Z behrisch $
Convert hierarchical xml files to csv. This only makes sense if the hierarchy has low depth.
S... | 1,312 | en | 0.589888 |
joostvdg/jenkins-job-builder | jenkins_jobs/cli/subcommand/base.py | 1 | 2294 | #!/usr/bin/env python
# Copyright (C) 2015 Wayne Warren
#
# 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... | apache-2.0 | 1,903,094,280,295,874,600 | 33.238806 | 79 | 0.649085 | false | Base class for Jenkins Job Builder subcommands, intended to allow
subcommands to be loaded as stevedore extensions by third party users.
Execute subcommand behavior.
:param config
JJBConfig object containing final configuration from config files,
command line arguments, and environment variables.
Define subcommand... | 1,324 | en | 0.734708 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.