repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
openrazer/openrazer | daemon/openrazer_daemon/dbus_services/dbus_methods/mamba.py | 2 | 9378 | # SPDX-License-Identifier: GPL-2.0-or-later
import math
import struct
from openrazer_daemon.dbus_services import endpoint
@endpoint('razer.device.power', 'getBattery', out_sig='d')
def get_battery(self):
"""
Get mouse's battery level
"""
self.logger.debug("DBus call get_battery")
driver_path = s... | gpl-2.0 | c6e22e031fc8882da0f94f308cf1e2b0 | 25.642045 | 138 | 0.622734 | 3.307937 | false | false | false | false |
openrazer/openrazer | examples/advanced_effect.py | 5 | 2803 | import colorsys
import random
from openrazer.client import DeviceManager
from openrazer.client import constants as razer_constants
# Create a DeviceManager. This is used to get specific devices
device_manager = DeviceManager()
print("Found {} Razer devices".format(len(device_manager.devices)))
print()
# Disable da... | gpl-2.0 | 8639250490b1cc0586af875cd05e52db | 31.218391 | 82 | 0.635391 | 3.673657 | false | false | false | false |
openrazer/openrazer | scripts/razer_mouse/driver/reactive_effect.py | 5 | 1865 | #!/usr/bin/python3
import argparse
import glob
import os
import struct
import sys
def clamp_to_min_max(value, min, max):
if value > max:
value = max
elif value < min:
value = min
return value
def clamp_to_u8(value):
return clamp_to_min_max(value, 0, 255)
def parse_args():
parse... | gpl-2.0 | c188f71095af809cdda91be5a4b24f6b | 28.140625 | 125 | 0.62681 | 3.2662 | false | false | false | false |
openrazer/openrazer | scripts/daemon/chroma_keyboard/custom_effect.py | 5 | 1552 | import sys
import time
import openrazer.client
device_manager = openrazer.client.DeviceManager()
keyboard = None
for device in device_manager.devices:
if device.type == 'keyboard':
keyboard = device
break
else:
print("Could not find suitable keyboard", file=sys.stderr)
sys.exit(1)
if not... | gpl-2.0 | df6c66364c3bc33dd0ba5b037cd0bcbf | 26.714286 | 130 | 0.523196 | 3.448889 | false | false | false | false |
transifex/transifex-client | txclib/wizard.py | 1 | 5998 | import os
from slugify import slugify
from txclib import messages
from txclib import utils
from txclib.api import Api
from txclib.project import Project
from txclib.log import logger
from six.moves import input
COLOR = "CYAN"
try:
import readline
readline.set_completer_delims(' \t\n;')
readline.parse_an... | gpl-2.0 | 4e737a7db30a1691fe2a7e26c43fda73 | 29.758974 | 78 | 0.571024 | 4.074728 | false | false | false | false |
python-bugzilla/python-bugzilla | examples/getbug_restapi.py | 1 | 1048 | #!/usr/bin/env python
#
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
# getbug_restapi.py:
# Simple demonstration of connecting to bugzilla over the REST
# API and printing some bug details.
import bugzilla
# public test instance of bug... | gpl-2.0 | 9e9c01dc21c0668ba84454b3365fcca6 | 35.137931 | 76 | 0.708015 | 3.254658 | false | false | false | false |
python-bugzilla/python-bugzilla | examples/getbug.py | 1 | 1358 | #!/usr/bin/env python
#
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
# getbug.py: Simple demonstration of connecting to bugzilla, fetching
# a bug, and printing some details.
import pprint
import bugzilla
# public test instance of bugzilla.redha... | gpl-2.0 | e8c249918a089aa356e381fb8f1610be | 32.95 | 74 | 0.720913 | 3.264423 | false | false | false | false |
python-bugzilla/python-bugzilla | tests/test_api_products.py | 2 | 3764 | # This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
import pytest
import bugzilla
import tests
import tests.mockbackend
def test_api_component_edit():
fakebz = tests.mockbackend.make_bz(
component_create_args="data/mockargs/test_api_component_create1... | gpl-2.0 | 01a93d20c19db36ba56b15aaaf1149d8 | 31.448276 | 77 | 0.646387 | 3.564394 | false | true | false | false |
wikimedia/integration-config | dockerfiles/quibble-buster-php74-coverage/clover-edit.py | 1 | 1919 | #!/usr/bin/env python3
"""
Edit clover.xml files
Copyright (C) 2017 Kunal Mehta <legoktm@member.fsf.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your o... | gpl-2.0 | aff2040e60058dc46ab224646874b3b9 | 35.903846 | 76 | 0.662324 | 4.118026 | false | false | false | false |
python-security/pyt | pyt/core/module_definitions.py | 1 | 4715 | """This module handles module definitions
which basically is a list of module definition."""
import ast
# Contains all project definitions for a program run
# Only used in framework_adaptor.py, but modified here
project_definitions = dict()
class ModuleDefinition():
"""Handling of a definition."""
module_... | gpl-2.0 | c455f8be25ef8bf3a2eb8e3c748d008b | 32.204225 | 98 | 0.549523 | 4.361702 | false | false | false | false |
python-security/pyt | pyt/usage.py | 1 | 4565 | import argparse
import os
import sys
from .formatters import json, screen, text
default_blackbox_mapping_file = os.path.join(
os.path.dirname(__file__),
'vulnerability_definitions',
'blackbox_mapping.json'
)
default_trigger_word_file = os.path.join(
os.path.dirname(__file__),
'vulnerability_def... | gpl-2.0 | 6eba72cb5ae20411d4dae554fb5ee7c1 | 28.262821 | 94 | 0.595619 | 3.9869 | false | false | false | false |
python-security/pyt | setup.py | 1 | 1321 | from setuptools import find_packages
from setuptools import setup
VERSION = '0.42'
setup(
name='python-taint',
packages=find_packages(exclude=(['tests*'])),
version=VERSION,
include_package_data=True,
description='Find security vulnerabilities in Python web applications'
' using static analy... | gpl-2.0 | 17601b40418c69f7caf83b01330270ca | 32.871795 | 108 | 0.629069 | 3.978916 | false | false | true | false |
s4w3d0ff/python-poloniex | examples/loanbot/loanbot.py | 2 | 6495 | #!/usr/bin/python
import logging
from time import time, sleep, strptime
from calendar import timegm
from multiprocessing.dummy import Process
from poloniex import Poloniex
logger = logging.getLogger(__name__)
WT = '\033[0m' # white (normal)
RD = lambda text: '\033[31m' + text + WT # red
GR = lambda text: '\033[32m'... | gpl-2.0 | 09703051c22f70bf501075e8ff073120 | 34.298913 | 79 | 0.485296 | 3.931598 | false | false | false | false |
rpm-software-management/yum | yum/pgpmsg.py | 1 | 54784 | #! /usr/bin/python -tt
##Copyright (C) 2003,2005,2009 Jens B. Jorgensen <jbj1@ultraemail.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 2
##of the License, or (at your o... | gpl-2.0 | 8629bfbcd8da9ab5471840cf2ec69684 | 41.239013 | 184 | 0.561879 | 3.279105 | false | false | false | false |
gofed/gofed | hack/gen_bash_completion.py | 3 | 3188 | from modules.Plugin import Plugins
from modules.Utils import runCommand
import sys
if len(sys.argv) != 5:
sys.stderr.write("Synopsis: gen_bash_completion.py PKG_NAME PLUGIN_DIR BASH_COMPLETION_DIR GENERATED_BASH_COMPLETION_PLUGINS_DIRECTORY\n")
exit(1)
pkg_name=sys.argv[1]
plugin_dir=sys.argv[2]
bash_completion_dir... | gpl-2.0 | ef0ec7014a5ba99dc0992d7fbd3b384a | 29.653846 | 139 | 0.584065 | 2.843889 | false | false | false | false |
pulp/pulp_python | .github/workflows/scripts/release.py | 2 | 7100 | # WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by it. Please use
# './plugin-template --github pulp_python' to update this file.
#
# For more info visit https://github.com/pulp/plugin_template
import argparse
import asyncio
import re
import os
import shutil
import textwrap
from... | gpl-2.0 | ff86647da899a281b671af0359e8e6f3 | 32.809524 | 99 | 0.649718 | 3.669251 | false | true | false | false |
pulp/pulp_python | pulp_python/app/migrations/0004_DATA_swap_distribution_model.py | 3 | 3299 | # Generated by Django 2.2.19 on 2021-03-19 17:42
from django.db import migrations, models, transaction
import django.db.models.deletion
def migrate_data_from_old_model_to_new_model_up(apps, schema_editor):
""" Move objects from PythonDistribution to NewPythonDistribution."""
PythonDistribution = apps.get_mod... | gpl-2.0 | 2ec5358c1720846aea1348cbcd779ef3 | 41.844156 | 242 | 0.635344 | 4.410428 | false | false | false | false |
rpm-software-management/mock | mock/py/mockbuild/file_downloader.py | 1 | 2656 | # -*- coding: utf-8 -*-
# vim: noai:ts=4:sw=4:expandtab
import cgi
import shutil
import tempfile
from urllib.parse import urlsplit
import requests
from .trace_decorator import getLog
class FileDownloader:
tmpdir = None
backmap = None
@classmethod
def _initialize(cls):
if cls.tmpdir:
... | gpl-2.0 | 2eecb728014e80d7b8b4a4a117c06c67 | 30.619048 | 83 | 0.564759 | 4.124224 | false | false | false | false |
rpm-software-management/mock | mock/py/mockbuild/uid.py | 1 | 6784 | # -*- coding: utf-8 -*-
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
# License: GPL2 or later see COPYING
# Written by Michael Brown
# Copyright (C) 2007 Michael E Brown <mebrown@michaels-house.net>
import atexit
import ctypes
import errno
import grp
import os
import pwd
from concurre... | gpl-2.0 | cde862096a2e5f97bad7bb23fba43609 | 31 | 87 | 0.602005 | 3.350123 | false | false | false | false |
rpm-software-management/mock | mock/py/mockbuild/plugins/selinux.py | 1 | 3543 | # -*- coding: utf-8 -*-
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
# License: GPL2 or later see COPYING
# Written by Jan Vcelak
# Copyright (C) 2010 Jan Vcelak <jvcelak@redhat.com>
# python library imports
import atexit
import os
import stat
import tempfile
# our imports
from mockb... | gpl-2.0 | 35609a5a893180093c464dc0795e0ee9 | 32.424528 | 108 | 0.641829 | 3.813778 | false | false | false | false |
rpm-software-management/mock | mock/py/mockbuild/util.py | 1 | 33917 | # -*- coding: utf-8 -*-
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
# License: GPL2 or later see COPYING
# Written by Michael Brown
# Sections by Seth Vidal
# Sections taken from Mach by Thomas Vander Stichele
# Copyright (C) 2007 Michael E Brown <mebrown@michaels-house.net>
from __fu... | gpl-2.0 | 959bfb57c7f6f7dc027d361ca715a5d3 | 31.86531 | 114 | 0.589468 | 3.563833 | false | false | false | false |
getpatchwork/patchwork | patchwork/tests/api/test_person.py | 1 | 4908 | # Patchwork - automated patch tracking system
# Copyright (C) 2016 Linaro Corporation
#
# SPDX-License-Identifier: GPL-2.0-or-later
import unittest
from django.conf import settings
from django.urls import NoReverseMatch
from django.urls import reverse
from patchwork.tests.api import utils
from patchwork.tests.utils ... | gpl-2.0 | 01c7ec5ca376c603137df165b3793141 | 37.34375 | 79 | 0.662184 | 3.732319 | false | true | false | false |
getpatchwork/patchwork | patchwork/api/project.py | 1 | 3229 | # Patchwork - automated patch tracking system
# Copyright (C) 2016 Linaro Corporation
#
# SPDX-License-Identifier: GPL-2.0-or-later
from django.shortcuts import get_object_or_404
from rest_framework.generics import ListAPIView
from rest_framework.generics import RetrieveUpdateAPIView
from rest_framework.serializers im... | gpl-2.0 | c1cf78598db86d92062214307388d1a4 | 25.467213 | 78 | 0.581914 | 3.996287 | false | false | false | false |
getpatchwork/patchwork | patchwork/migrations/0023_timezone_unify.py | 1 | 1391 | import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('patchwork', '0022_add_subject_match_to_project'),
]
operations = [
migrations.AlterField(
model_name='check',
name='date',
field=models.... | gpl-2.0 | 611110aef1fa21c84868150623600b43 | 29.23913 | 73 | 0.567937 | 4.950178 | false | false | false | false |
getpatchwork/patchwork | patchwork/management/commands/replacerelations.py | 1 | 2195 | # Patchwork - automated patch tracking system
# Copyright (C) 2020 Rohit Sarkar <rohitsarkar5398@gmail.com>
#
# SPDX-License-Identifier: GPL-2.0-or-later
import logging
import os
import sys
from django.db import transaction
from django.core.management.base import BaseCommand
from patchwork.models import Patch
from p... | gpl-2.0 | f09e82375806388d7db6d04e9ab6751c | 29.068493 | 76 | 0.578588 | 4.295499 | false | false | false | false |
getpatchwork/patchwork | patchwork/migrations/0025_add_regex_validators.py | 1 | 1430 | from django.db import migrations, models
import patchwork.models
class Migration(migrations.Migration):
dependencies = [
('patchwork', '0024_patch_patch_project'),
]
operations = [
migrations.AlterField(
model_name='project',
name='subject_match',
fie... | gpl-2.0 | 02621f0001049ee5cd3a4b0e353c8cbe | 33.878049 | 79 | 0.537762 | 4.719472 | false | false | false | false |
getpatchwork/patchwork | patchwork/migrations/0041_python3.py | 1 | 14597 | # commit 3a979ed8bfc6 ("migrations: don't go to the db for 0041_python3 migration")
# made a bunch of strings go past 79 characters, breaking flake8 checks.
#
# We're not really expecting future changes to this file so just don't run
# flake8 against it.
#
# flake8: noqa
import datetime
from django.conf import settin... | gpl-2.0 | 0020bb79942e8a2be00c735ab454f919 | 40.825215 | 87 | 0.394944 | 6.21678 | false | false | false | false |
getpatchwork/patchwork | patchwork/tests/api/test_bundle.py | 1 | 14682 | # Patchwork - automated patch tracking system
# Copyright (C) 2016 Linaro Corporation
#
# SPDX-License-Identifier: GPL-2.0-or-later
import unittest
from django.conf import settings
from django.urls import NoReverseMatch
from django.urls import reverse
from patchwork.models import Bundle
from patchwork.tests.api impo... | gpl-2.0 | 737a9d72d4ff4f56fbe9b07c1c7b481f | 37.036269 | 79 | 0.621441 | 3.787926 | false | true | false | false |
getpatchwork/patchwork | patchwork/api/filters.py | 1 | 8599 | # Patchwork - automated patch tracking system
# Copyright (C) 2017 Stephen Finucane <stephen@that.guru>
#
# SPDX-License-Identifier: GPL-2.0-or-later
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db.models import Q
from django_filters import rest_framework
f... | gpl-2.0 | f70df67c9bdabdf0dd46d27a0ef43433 | 28.248299 | 79 | 0.6581 | 4.396217 | false | false | false | false |
getpatchwork/patchwork | patchwork/api/base.py | 1 | 5315 | # Patchwork - automated patch tracking system
# Copyright (C) 2016 Linaro Corporation
#
# SPDX-License-Identifier: GPL-2.0-or-later
import rest_framework
from django.conf import settings
from django.shortcuts import get_object_or_404
from rest_framework import permissions
from rest_framework.pagination import PageNum... | gpl-2.0 | 7dcba79ec0c2962d75d7702c53ed618b | 30.826347 | 79 | 0.644026 | 4.079048 | false | false | false | false |
getpatchwork/patchwork | patchwork/migrations/0022_add_subject_match_to_project.py | 1 | 1179 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('patchwork', '0021_django_1_10_fixes'),
]
operations = [
migrations.AddField(
model_name='project',
name='subject_match',
field=models.CharField(
... | gpl-2.0 | 5e01219c5b14974a38b6303bd7218689 | 31.75 | 77 | 0.527566 | 4.73494 | false | false | false | false |
getpatchwork/patchwork | patchwork/templatetags/listurl.py | 1 | 2605 | # Patchwork - automated patch tracking system
# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
from django.conf import settings
from django import template
from django.urls import NoReverseMatch
from django.urls import reverse
from django.utils.encoding import smart_str
fr... | gpl-2.0 | 67481a3c3564b4b1bc269bab884dcb59 | 28.602273 | 78 | 0.54856 | 4.102362 | false | false | false | false |
getpatchwork/patchwork | patchwork/views/mail.py | 1 | 3522 | # Patchwork - automated patch tracking system
# Copyright (C) 2010 Jeremy Kerr <jk@ozlabs.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
import smtplib
from django.conf import settings as conf_settings
from django.core.mail import send_mail
from django.http import HttpResponseRedirect
from django.shortcuts import... | gpl-2.0 | ebafe98f89bc24d4d5ca56d56345a492 | 27.176 | 78 | 0.641965 | 3.758805 | false | false | false | false |
graalvm/mx | mx_javamodules.py | 1 | 62466 | #
# ----------------------------------------------------------------------------------------------------
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# u... | gpl-2.0 | 07e39785df9c6a3c98e1d748f971dfb9 | 51.892464 | 207 | 0.572583 | 4.412376 | false | false | false | false |
graalvm/mx | mx_subst.py | 1 | 4050 | #
# ----------------------------------------------------------------------------------------------------
#
# Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify ... | gpl-2.0 | 5b9c26a5348c8c49619b84b611ef47ed | 37.207547 | 126 | 0.593827 | 4.175258 | false | false | false | false |
fplll/fpylll | src/fpylll/tools/bkz_plot.py | 2 | 4628 | # -*- coding: utf-8 -*-
"""
Plot `\\log_2` of square Gram-Schmidt norms during a BKZ run.
EXAMPLE::
>>> from fpylll import IntegerMatrix, BKZ, FPLLL
>>> from fpylll.algorithms.bkz2 import BKZReduction as BKZ2
>>> from fpylll.tools.bkz_plot import KeepGSOBKZFactory
>>> FPLLL.set_random_seed(1337)
>... | gpl-2.0 | e7111639b06ad581ca1ef64233e5b026 | 33.029412 | 106 | 0.573898 | 3.089453 | false | false | false | false |
openstenoproject/plover | plover/oslayer/linux/keyboardcontrol_x11.py | 1 | 77670 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2010 Joshua Harlan Lifton.
# See LICENSE.txt for details.
#
# keyboardcontrol.py - capturing and injecting X keyboard events
#
# This code requires the X Window System with the 'XInput2' and 'XTest'
# extensions and python-xlib with support for said extensions.
"""Keyboard cap... | gpl-2.0 | 67bd43dbfe26325a18938e644165c85d | 56.506767 | 101 | 0.579285 | 2.919794 | false | false | false | false |
jdf76/plugin.video.youtube | resources/lib/youtube_plugin/kodion/impl/abstract_context_ui.py | 2 | 1440 | # -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
Copyright (C) 2016-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
class AbstractContextUI(object):
def __init__(self):
pass
def crea... | gpl-2.0 | e2056b58acc49de375c2d2f8b0e07ee5 | 26.169811 | 90 | 0.648611 | 4.3769 | false | false | false | false |
jdf76/plugin.video.youtube | resources/lib/youtube_plugin/kodion/utils/watch_later_list.py | 2 | 1168 | # -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
Copyright (C) 2016-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
import datetime
from .storage import Storage
from .. import items
class WatchLate... | gpl-2.0 | 4295aa6a3235cff0c2a82daab0e7187b | 23.333333 | 90 | 0.59589 | 3.47619 | false | false | false | false |
jdf76/plugin.video.youtube | resources/lib/youtube_plugin/youtube/helper/signature/json_script_engine.py | 2 | 1715 | # -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
Copyright (C) 2016-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
from six.moves import range
class JsonScriptEngine(object):
def __init__(self,... | gpl-2.0 | b1b55ee49f45bdad033053257662287c | 23.15493 | 61 | 0.538192 | 4.386189 | false | false | false | false |
jdf76/plugin.video.youtube | resources/lib/youtube_plugin/kodion/items/utils.py | 2 | 2044 | # -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
Copyright (C) 2016-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
from six import string_types
import json
from .video_item import VideoItem
from .d... | gpl-2.0 | 0eb4165cc9256fed498509a9b00c568d | 23.926829 | 68 | 0.55773 | 3.799257 | false | false | false | false |
jdf76/plugin.video.youtube | resources/lib/youtube_plugin/youtube/client/__config__.py | 2 | 11291 | # -*- coding: utf-8 -*-
"""
Copyright (C) 2017-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
from base64 import b64decode
from hashlib import md5
from ...kodion.json_store import APIKeyStore, LoginTokenStore
from ...kodion import Conte... | gpl-2.0 | bef0bcd7eef630a8290d8db783049e65 | 46.84322 | 142 | 0.579931 | 3.66353 | false | false | false | false |
jdf76/plugin.video.youtube | resources/lib/youtube_plugin/kodion/utils/storage.py | 1 | 8407 | # -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
Copyright (C) 2016-2019 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
from six import PY2
from six.moves import range
# noinspection PyPep8Naming
from six... | gpl-2.0 | 1ab8b363d142367b52862169a35e5876 | 31.968627 | 121 | 0.540859 | 3.997622 | false | false | false | false |
akkana/scripts | mouseevent.py | 1 | 2847 | #!/usr/bin/env python
# Read mouse events if X isn't running -- for instance, on a Raspberry Pi.
# Needs root, or at least read access to /dev/input/*
import evdev
import select
import time
import sys
class MouseReader:
def __init__(self):
self.mousedevice = None
devices = map(evdev.InputDevice, ... | gpl-2.0 | d0f84511653d0e1dfa7a1d234777cb2d | 31.724138 | 80 | 0.508606 | 3.981818 | false | false | false | false |
akkana/scripts | weather/wunderwx.py | 1 | 3375 | #!/usr/bin/env python
from __future__ import print_function
# Weather from wunderground.
# Needs an API key, which is a pain in the butt to get even for the free one.
# Put your API key in ~/.config/wunderwx or set it in WUNDERKEY
import requests
import json
from pprint import pprint
import os, sys
# The global key... | gpl-2.0 | c6a8ad676322b68e7f08fb5412158638 | 32.75 | 108 | 0.584 | 3.648649 | false | false | false | false |
akkana/scripts | unidecode.py | 1 | 1788 | #!/usr/bin/env python3
# Decode unicode characters, given as arguments;
# or search for unicode characters matching given patterns.
import unicodedata
import sys
import re
import argparse
# maximum valid code point
MAXUNI = 0x10FFFF
def decode_char(c):
# c is a character. Try to get the UTF equivalent.
tr... | gpl-2.0 | 33ff25d25df02aa16423354d966d46cd | 25.686567 | 80 | 0.529642 | 3.964523 | false | false | false | false |
akkana/scripts | decodemail.py | 1 | 7143 | #!/usr/bin/env python3
# Decode From and Subject lines spammers encode in other charsets
# to try to hide them from spam filters. (RFC 2047 encoding.)
# Use in conjunction with programs like procmail or spamassassin,
# instead of something like formail.
from __future__ import print_function
import sys, os
import ema... | gpl-2.0 | cd7d811617652336c1c421e28148ad79 | 34.537313 | 80 | 0.592188 | 4.179637 | false | false | false | false |
akkana/scripts | mapping/greatcircle.py | 1 | 1769 | #!/usr/bin/env python3
# Given start lat/lon and end lat/lon, calculate the initial heading
# needed to fly from the start to the end point on a great circle course,
# and the final heading on which you'll arrive.
# Based on spreadsheet equations by Galen Gisler, from the Wikipedia
# page on great circle navigation,
#... | gpl-2.0 | 8334ae11e2be7c459d1cee806fa75bb3 | 33.019231 | 76 | 0.647824 | 2.605302 | false | false | false | false |
akkana/scripts | weather/cwop.py | 2 | 3940 | #!/usr/bin/env python
# Parse data from Citizen Weather Observation Program stations.
# More details on the program: http://wxqa.com/
# To get data, find the "CWOP QC" from the table, then, e.g. for the QC=AS857,
# get a CSV for the last 7 days at
# http://weather.gladstonefamily.net/cgi-bin/wxobservations.pl?site=AS... | gpl-2.0 | 0f91d6837743d116cef45beedb49f118 | 35.82243 | 120 | 0.626396 | 3.483643 | false | false | false | false |
linuxmint/cinnamon-screensaver | src/dbusdepot/nameBlocker.py | 1 | 1862 | #!/usr/bin/python3
from gi.repository import Gio, GObject, GLib
import status
from util.utils import DEBUG
class NameBlocker(GObject.GObject):
"""
Terminates other screensavers. Ideally we'd just take ownership of their
dbus names, but due to how DE detection works in xdg-screensaver, that script
in... | gpl-2.0 | 399b6ce3c2a6a506ff1571ebf46340ad | 30.033333 | 81 | 0.52739 | 4.101322 | false | false | false | false |
linuxmint/cinnamon-screensaver | src/util/keybindings.py | 1 | 4292 | #!/usr/bin/python3
import gi
gi.require_version('CDesktopEnums', '3.0')
from gi.repository import Gtk, GObject, Gdk, Gio, CinnamonDesktop
from gi.repository.CDesktopEnums import MediaKeyType as MK
import status
import singletons
from util import settings
ALLOWED_ACTIONS = [MK.MUTE,
MK.VOLUME_UP,
... | gpl-2.0 | 5585c8b90b0ff73ed6e94b3aa30ea2e3 | 31.515152 | 115 | 0.549161 | 4.00747 | false | false | false | false |
linuxmint/cinnamon-screensaver | src/widgets/framedImage.py | 1 | 4235 | #!/usr/bin/python3
# coding: utf-8
import gi
gi.require_version('CinnamonDesktop', '3.0')
from gi.repository import Gtk, GdkPixbuf, Gio, GLib, GObject, Gdk
from util import utils, trackers
MAX_IMAGE_SIZE = 320
MAX_IMAGE_SIZE_LOW_RES = 200
class FramedImage(Gtk.Image):
"""
Widget to hold the user face image... | gpl-2.0 | 4a1ef302a9145d880475a54b139be74a | 33.430894 | 123 | 0.540968 | 3.839529 | false | false | false | false |
linuxmint/cinnamon-screensaver | src/dbusdepot/accountsServiceClient.py | 1 | 1670 | #!/usr/bin/python3
import gi
gi.require_version('AccountsService', '1.0')
from gi.repository import GObject, AccountsService
import os
from util import utils, trackers
class AccountsServiceClient(GObject.Object):
"""
Singleton for working with the AccountsService, which we use
to retrieve the user's face... | gpl-2.0 | bea3721d0940a897d787ccb76cf4027c | 31.115385 | 96 | 0.561078 | 4.1133 | false | false | false | false |
xmendez/wfuzz | src/wfuzz/externals/reqresp/TextParser.py | 1 | 4204 | # Covered by GPL V2.0
# Coded by Carlos del Ojo Elias (deepbit@gmail.com)
import sys
import re
# python 2 and 3: iterator
from builtins import object
class TextParser(object):
def __init__(self):
self.string = ""
self.oldindex = 0
self.newindex = 0
self.type = ""
self.las... | gpl-2.0 | 746262c364b3047831046d1a3bc0cb6c | 27.026667 | 126 | 0.514986 | 3.82878 | false | false | false | false |
xmendez/wfuzz | src/wfuzz/fuzzrequest.py | 1 | 11147 | import pycurl
# Python 2 and 3
import sys
if sys.version_info >= (3, 0):
from urllib.parse import urlparse
else:
from urlparse import urlparse
from collections import namedtuple
from .externals.reqresp import Request, Response
from .exception import FuzzExceptBadAPI, FuzzExceptBadOptions
from .facade import... | gpl-2.0 | 0a366a2fb583faed89ca5f4939f4dd24 | 27.220253 | 123 | 0.582219 | 3.969729 | false | false | false | false |
xmendez/wfuzz | src/wfuzz/plugins/payloads/bing.py | 1 | 1287 | from wfuzz.externals.moduleman.plugin import moduleman_plugin
from wfuzz.plugin_api.payloadtools import BingIter
from wfuzz.plugin_api.base import BasePayload
from wfuzz.fuzzobjects import FuzzWordType
@moduleman_plugin
class bing(BasePayload):
name = "bing"
author = ("Xavi Mendez (@xmendez)",)
version = ... | gpl-2.0 | 79d94128c40776d8bf30244b0b175e17 | 27.6 | 84 | 0.624709 | 3.497283 | false | false | false | false |
xmendez/wfuzz | src/wfuzz/plugins/payloads/file.py | 1 | 1900 | from wfuzz.externals.moduleman.plugin import moduleman_plugin
from wfuzz.exception import FuzzExceptBadFile
from wfuzz.plugin_api.base import BasePayload
from wfuzz.helpers.file_func import FileDetOpener
from wfuzz.fuzzobjects import FuzzWordType
@moduleman_plugin
class file(BasePayload):
name = "file"
author... | gpl-2.0 | 0fce053f4387389b5449b2ff785a39d4 | 26.941176 | 79 | 0.565789 | 4.008439 | false | false | false | false |
xmendez/wfuzz | src/wfuzz/fuzzqueues.py | 1 | 14220 | import time
import pickle as pickle
import gzip
from threading import Thread, Event
from queue import Queue
from collections import defaultdict
from .factories.fuzzresfactory import resfactory
from .factories.plugin_factory import plugin_factory
from .factories.payman import payman_factory
from .fuzzobjects import Fuz... | gpl-2.0 | 221d479b6e0c563c99fb4e0559926f6f | 28.199179 | 88 | 0.555696 | 3.911967 | false | false | false | false |
xmendez/wfuzz | src/wfuzz/plugins/scripts/cookies.py | 1 | 1132 | from wfuzz.plugin_api.base import BasePlugin
from wfuzz.externals.moduleman.plugin import moduleman_plugin
KBASE_NEW_COOKIE = "cookies.cookie"
@moduleman_plugin
class cookies(BasePlugin):
name = "cookies"
author = ("Xavi Mendez (@xmendez)",)
version = "0.1"
summary = "Looks for new cookies"
desc... | gpl-2.0 | db2415163fdd9c1602a6bf35cbbc9072 | 27.3 | 77 | 0.547703 | 3.916955 | false | false | false | false |
xmendez/wfuzz | src/wfuzz/ui/console/clparser.py | 1 | 20210 | import re
import sys
import getopt
import warnings
from collections import defaultdict
from wfuzz.helpers.file_func import get_filter_help_file
from wfuzz.helpers.obj_dyn import allowed_fields
from wfuzz.filters.ppfilter import PYPARSING
from wfuzz.facade import Facade
from wfuzz.options import FuzzSession
from wfuzz.... | gpl-2.0 | 34bcc501aed19c9400da45f41a9a5d82 | 31.028526 | 145 | 0.477981 | 3.925034 | false | false | false | false |
xmendez/wfuzz | docs/conf.py | 1 | 5032 | # -*- coding: utf-8 -*-
#
# Wfuzz documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 2 13:44:00 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | gpl-2.0 | f7fa7e9e4b75baffcdeb9625403e7d3a | 28.952381 | 79 | 0.664944 | 3.841221 | false | true | false | false |
xmendez/wfuzz | src/wfuzz/mixins.py | 1 | 1481 | from .plugin_api.urlutils import parse_url
from .exception import FuzzExceptBadInstall
# python 2 and 3
import sys
if sys.version_info >= (3, 0):
from urllib.parse import urljoin, urlparse
else:
from urlparse import urljoin, urlparse
class FuzzRequestSoupMixing(object):
def get_soup(self):
try:
... | gpl-2.0 | 933334d84d37243fa09421e4d53484c5 | 24.982456 | 88 | 0.634706 | 3.981183 | false | false | false | false |
xmendez/wfuzz | src/wfuzz/wfuzz.py | 1 | 6755 | #!/usr/bin/env python
import sys
import warnings
from .core import Fuzzer
from .facade import Facade
from .exception import FuzzException, FuzzExceptBadInstall
from .ui.console.mvc import Controller, KeyPress
from .ui.console.common import (
help_banner2,
wfpayload_usage,
)
from .ui.console.clparser import CLP... | gpl-2.0 | 3fcb02aebbb3b3c661ef190062757afa | 26.571429 | 88 | 0.50792 | 4.001777 | false | false | false | false |
rebase-helper/rebase-helper | rebasehelper/plugins/checkers/__init__.py | 1 | 5170 | # -*- coding: utf-8 -*-
#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 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... | gpl-2.0 | 0ab024db6cf578181605bf9e5c1055f5 | 32.967105 | 102 | 0.663374 | 4.225041 | false | false | false | false |
rebase-helper/rebase-helper | rebasehelper/plugins/spec_hooks/pypi_url_fix.py | 1 | 2800 | # -*- coding: utf-8 -*-
#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 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... | gpl-2.0 | f6b994a5c031fff72c1d7053e8c0dd55 | 37.791667 | 95 | 0.67705 | 3.539924 | false | false | false | false |
rebase-helper/rebase-helper | rebasehelper/plugins/build_tools/rpm/__init__.py | 1 | 3810 | # -*- coding: utf-8 -*-
#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 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... | gpl-2.0 | 7bd196681721c60923a330294efaea2a | 30.691667 | 96 | 0.649224 | 4.239688 | false | false | false | false |
rebase-helper/rebase-helper | rebasehelper/tests/test_temporary_environment.py | 1 | 3287 | # -*- coding: utf-8 -*-
#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 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... | gpl-2.0 | 798353a561916c2f4ae04da524f42d75 | 31.8 | 73 | 0.622561 | 4.039409 | false | true | false | false |
rebase-helper/rebase-helper | rebasehelper/plugins/output_tools/text.py | 1 | 8455 | # -*- coding: utf-8 -*-
#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 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... | gpl-2.0 | 0b0bd3be11363e3d6c82ceb4ead6d2f1 | 37.752294 | 109 | 0.607599 | 4.051799 | false | false | false | false |
rebase-helper/rebase-helper | rebasehelper/helpers/path_helper.py | 1 | 4555 | # -*- coding: utf-8 -*-
#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 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... | gpl-2.0 | bca740c13867a78142c2de5307ab0642 | 31.719424 | 104 | 0.610598 | 4.335558 | false | false | false | false |
gentoo/layman | layman/overlays/modules/squashfs/squashfs.py | 1 | 3877 | #!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
# LAYMAN SQUASHFS OVERLAY HANDLER
################################################################################
# File: squashfs.py
#
# Handles squashfs overlays
#
# Copyright:... | gpl-2.0 | 66085cca3ad8b74d3b381998042a2dba | 28.371212 | 80 | 0.467888 | 4.626492 | false | false | false | false |
gentoo/layman | layman/db_modules/sqlite_db/sqlite_db.py | 1 | 13669 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#################################################################################
# LAYMAN SQLite DB
#################################################################################
# File: sqlite_db.py
#
# Access SQLite overlay database(s).
#
# Copyright:
# ... | gpl-2.0 | 94aa20df8b4916d75d2c9cd63986e938 | 36.144022 | 81 | 0.515619 | 4.469915 | false | false | false | false |
gentoo/layman | pm_plugins/portage/sync/modules/laymansync/subproc.py | 1 | 4120 | # Copyright 2014-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
'''Layman module for portage using a subprocess call'''
import logging
import portage
from portage import os
from portage.util import writemsg_level
from portage.output import create_color_func
good = create_col... | gpl-2.0 | d4fcb4c18757c6b7193a415d613001b0 | 29.294118 | 78 | 0.55 | 3.765996 | false | false | false | false |
gentoo/layman | layman/mounter.py | 1 | 9727 | #!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# LAYMAN MOUNTING OVERLAY HANDLER
###############################################################################
# File: mounter.py
#
# Controls all mountable overlay types
#
# Co... | gpl-2.0 | 450da1abbd29e45c0ae0b093ac67840a | 30.076677 | 79 | 0.483191 | 4.4763 | false | false | false | false |
gentoo/layman | layman/module.py | 1 | 7471 | # Copyright 2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
import os
from layman.output import Message
class InvalidModuleName(Exception):
'''An invalid or unknown module name.'''
class Module(object):
'''
Class to define ... | gpl-2.0 | 812450ea47c07fa24b9ee29edaf217a4 | 32.959091 | 87 | 0.550663 | 4.503315 | false | false | false | false |
interlegis/sigi | sigi/apps/casas/forms.py | 1 | 1793 | from django import forms
from django.utils.translation import gettext as _
from localflavor.br.forms import BRZipCodeField
from material.admin.widgets import MaterialAdminTextareaWidget
from sigi.apps.casas.models import Funcionario, Orgao
from sigi.apps.servidores.models import Servidor
class AtualizaCasaForm(forms.... | gpl-2.0 | a5ae0839b23508472194dae446fa9411 | 26.953125 | 79 | 0.583566 | 3.55666 | false | false | false | false |
interlegis/sigi | sigi/apps/contatos/migrations/0006_alter_unidadefederativa_regiao.py | 1 | 1287 | # Generated by Django 4.1.1 on 2022-09-27 16:12
from django.db import migrations, models
from sigi.apps.contatos.models import UnidadeFederativa
def acerta_sudeste_fw(apps, schema_editor):
UnidadeFederativa = apps.get_model("contatos", "UnidadeFederativa")
UnidadeFederativa.objects.filter(regiao="SD").updat... | gpl-2.0 | 4613f58025d672362913d7ceae8dc023 | 28.227273 | 81 | 0.560653 | 3.314433 | false | false | false | false |
interlegis/sigi | sigi/apps/parlamentares/migrations/0012_senador.py | 1 | 2600 | # Generated by Django 4.1 on 2022-08-19 02:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
(
"contatos",
"0005_alter_mesorregiao_options_alter_microrregiao_options_and_more",
),
(... | gpl-2.0 | e13f66939b9314558d434a24a169dc83 | 32.753247 | 88 | 0.395152 | 4.978927 | false | false | false | false |
interlegis/sigi | sigi/apps/servicos/urls.py | 1 | 1044 | # coding: utf-8
from django.conf.urls import patterns, url
from django.views.generic.base import TemplateView
from .views import MapaView
urlpatterns = patterns(
"sigi.apps.servicos.views",
url(r"^manifesta/$", "casa_manifesta_view", name="casa-manifesta-view"),
url(
r"^servico/carrinho/$",
... | gpl-2.0 | d6c758141633d47cd9bc3be9bea61268 | 29.705882 | 90 | 0.60728 | 2.683805 | false | false | true | false |
interlegis/sigi | sigi/apps/servicos/migrations/0010_delete_casaatendida_alter_tiposervico_options_and_more.py | 1 | 2034 | # Generated by Django 4.0.4 on 2022-05-16 15:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('servicos', '0009_alter_casamanifesta_email_alter_casamanifesta_id_and_more'),
]
operations = [
migrations.D... | gpl-2.0 | eb7fc185fc389cf91c918526f535230f | 48.170732 | 320 | 0.590774 | 3.555556 | false | false | false | false |
interlegis/sigi | sigi/apps/ocorrencias/migrations/0001_initial.py | 1 | 10810 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0001_initial"),
("servidores", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="... | gpl-2.0 | cc2bbebe308fbfd3a7ba0cb62e345e97 | 32.159509 | 80 | 0.329047 | 5.421264 | false | false | false | false |
interlegis/sigi | sigi/apps/home/templatetags/smart_pagination.py | 1 | 1071 | from django import template
register = template.Library()
@register.inclusion_tag("pagination/paginator.html")
def smart_paginator(page_obj, querystring=None):
if querystring:
querystring = "?" + querystring + "&"
else:
querystring = "?"
page_range = page_obj.paginator.page_range
mid... | gpl-2.0 | b8396b8e7b5c9e09f240ae48539a7b72 | 23.906977 | 73 | 0.571429 | 3.378549 | false | false | false | false |
interlegis/sigi | sigi/apps/servicos/migrations/0019_ajusta_dominios.py | 1 | 1436 | # Generated by Django 4.1.2 on 2022-11-02 13:59
from django.db import migrations
from sigi.apps.servicos import generate_instance_name
def dominios_fw(apps, schema_editor):
Servico = apps.get_model("servicos", "Servico")
for s in Servico.objects.filter(tipo_servico__modo="R"):
if s.url == "":
... | gpl-2.0 | 5b038645ea74dc7c447b8ce8ee4ec1ff | 28.75 | 74 | 0.521008 | 3.408115 | false | false | false | false |
pulp/pulp_deb | pulp_deb/tests/functional/api/test_sync_missing_architecture.py | 1 | 6914 | # coding=utf-8
"""Tests that sync deb plugin repositories."""
import unittest
import os
from pulp_smash import config
from pulp_smash.pulp3.bindings import monitor_task, delete_orphans
from pulp_smash.pulp3.utils import (
gen_repo,
get_content,
get_versions,
gen_distribution,
download_content_unit,... | gpl-2.0 | 594d6bcc276046422ef374d3234404ab | 40.154762 | 98 | 0.65418 | 3.897407 | false | true | false | false |
pulp/pulp_deb | pulp_deb/app/migrations/0011_rename_models_to_apt.py | 2 | 3078 | # Generated by Django 2.2.13 on 2020-06-10 16:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('deb', '0010_debpublication_signing_service'),
]
operations = [
migrations.RenameModel('DebDistribution', '... | gpl-2.0 | 654e07336bd0204dff7b684137684792 | 33.2 | 69 | 0.523717 | 4.809375 | false | false | false | false |
pulp/pulp_deb | pulp_deb/app/modelresource.py | 1 | 2953 | from pulpcore.plugin.importexport import BaseContentResource
from pulp_deb.app.models import (
GenericContent,
InstallerFileIndex,
Package,
PackageIndex,
InstallerPackage,
PackageReleaseComponent,
Release,
ReleaseArchitecture,
ReleaseComponent,
ReleaseFile,
)
class InstallerFil... | gpl-2.0 | 3844b92e9113eedf0b30de142a986e5e | 22.251969 | 71 | 0.69658 | 4.467474 | false | false | false | false |
sanger-pathogens/gubbins | python/gubbins/tests/test_converging_recombinations.py | 1 | 1705 | #! /usr/bin/env python3
# encoding: utf-8
"""
Tests if the same recombinations are seen in multiple iterations
"""
import unittest
import os
from gubbins import common
modules_dir = os.path.dirname(os.path.abspath(common.__file__))
data_dir = os.path.join(modules_dir, 'tests', 'data')
class TestConvergingRecombina... | gpl-2.0 | 429caf85a04566896c9289f9d8d358c4 | 40.585366 | 114 | 0.637537 | 3.223062 | false | true | false | false |
sanger-pathogens/gubbins | python/scripts/extract_gubbins_clade_statistics.py | 1 | 10506 | #! python
# encoding: utf-8
# Wellcome Trust Sanger Institute and Imperial College London
# Copyright (C) 2020 Wellcome Trust Sanger Institute and Imperial College London
#
# 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 t... | gpl-2.0 | 2ca154bef236d739355003ff510f3181 | 43.142857 | 112 | 0.504283 | 4.23629 | false | false | false | false |
sanger-pathogens/gubbins | python/gubbins/utils.py | 1 | 6724 | # encoding: utf-8
# Wellcome Trust Sanger Institute
# Copyright (C) 2013 Wellcome Trust Sanger Institute
#
# 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 ... | gpl-2.0 | 556b755eb42d5bb83a251e28a2acd15b | 34.957219 | 104 | 0.638459 | 4.1 | false | false | false | false |
mitodl/edx2bigquery | edx2bigquery/transfer_logs_to_gs.py | 1 | 2321 | #!/usr/bin/python
#
# File: transfer_logs_to_gs.py
# Date: 13-Oct-14
# Author: I. Chuang <ichuang@mit.edu>
#
# transfer log files to google storage, following conventions.
#
# gsutil cp TRACKING_LOGS/X__8.01x__2013_SOND/tracklog-201* gs://x-data-test/X__8.01x__2013_SOND/DAILY/
#
# usage:
#
# python transfer_logs_... | gpl-2.0 | 677ffd71192e0d8b657e073339d66c71 | 30.364865 | 119 | 0.623869 | 3.166439 | false | false | false | false |
mitodl/edx2bigquery | edx2bigquery/auth.py | 1 | 5149 | #!/usr/bin/python2.7
# All rights to this package are hereby disclaimed and its contents
# released into the public domain by the authors.
'''Handles credentials and authorization.
This module is used by the sample scripts to handle credentials and
generating authorized clients. The module can also be run directly
to... | gpl-2.0 | c657c64dabf004ee7356c4932d23cbc0 | 33.557047 | 157 | 0.705962 | 3.819733 | false | false | false | false |
tualatrix/ubuntu-tweak | ubuntutweak/settings/gsettings.py | 4 | 2352 | import os
import logging
from gi.repository import Gio
from ubuntutweak.settings.common import Schema
log = logging.getLogger('GSetting')
class GSetting(object):
def __init__(self, key=None, default=None, type=None):
parts = key.split('.')
self.schema_id, self.key = '.'.join(parts[:-1]), parts... | gpl-2.0 | d2d7ce850f80297318e94d1f7710dc1b | 30.36 | 91 | 0.550595 | 3.855738 | false | false | false | false |
mitodl/edx2bigquery | edx2bigquery/build_tracking_log_schema.py | 3 | 4654 | #!/usr/bin/python
#
# build schema for tracking logs based on reading a bunch of tracking logs
# keep examples along the way.
#
import sys
import gzip
import json
efn = 'tracking_log_schema_examples.json'
sfn = 'schema_tracking_log.json'
def add_example(line):
open(efn, 'a').write(line)
schema = json.loads(open... | gpl-2.0 | 42ba2290f8fd487ff7a45f72266af6e6 | 35.077519 | 111 | 0.442845 | 4.21558 | false | false | false | false |
mitodl/edx2bigquery | edx2bigquery/addmoduleid.py | 2 | 18322 | #!/usr/bin/python
#
# add module_id to the log JSON string, one at a time
# also parses event string and sets event_js
# event_js = True if event is proper js; else it is False.
import os, sys
import re
import json
import traceback
#-----------------------------------------------------------------------------
# patte... | gpl-2.0 | 5e63cc821230a1469e641e43aa8b569f | 40.546485 | 192 | 0.548848 | 2.900887 | false | false | false | false |
tualatrix/ubuntu-tweak | ubuntutweak/preferences.py | 4 | 12417 | # Ubuntu Tweak - Ubuntu Configuration Tool
#
# Copyright (C) 2007-2011 Tualatrix Chou <tualatrix@gmail.com>
#
# Ubuntu Tweak 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 | 191787880c29be19eae00d9da99bdf76 | 40.115894 | 115 | 0.520899 | 4.400071 | false | false | false | false |
tualatrix/ubuntu-tweak | ubuntutweak/modules/__init__.py | 4 | 15705 | import os
import sys
import glob
import logging
import inspect
import traceback
from new import classobj
from gi.repository import GObject, Gtk, Gdk, GdkPixbuf
from ubuntutweak import system
from ubuntutweak.utils import icon
from ubuntutweak.common.consts import DATA_DIR, CONFIG_ROOT, IS_INSTALLED
from ubuntutweak.... | gpl-2.0 | 84ce4a8f09fcfc7817fc54c6a587fed2 | 33.9 | 125 | 0.55823 | 3.770708 | false | false | false | false |
mitodl/edx2bigquery | edx2bigquery/load_user_part.py | 1 | 2455 |
import os
import sys
import gsutil
import bqutil
import gzip
import json
from path import Path as path
import unicodecsv as csv
from load_course_sql import find_course_sql_dir
def do_user_part_csv(course_id, basedir=None, datedir=None,
use_dataset_latest=False,
verbose=False,
... | gpl-2.0 | e5771066d607c0ca87ce1b7f0dd7e544 | 34.071429 | 106 | 0.626477 | 3.335598 | false | true | false | false |
mitodl/edx2bigquery | edx2bigquery/make_user_info_combo.py | 1 | 14369 | #!/usr/bin/python
#
# File: make_user_info_combo.py
# Date: 13-Oct-14
# Author: I. Chuang <ichuang@mit.edu>
#
# make single JSON file containing edX SQL information from:
#
# users.csv (auth_user)
# profiles.csv (auth_userprofile)
# enrollment.csv
# certificates.csv
# user_id_map.csv
#
# one line is... | gpl-2.0 | d325b314ffb611e712c7fca0b8548bed | 41.261765 | 160 | 0.576728 | 3.711002 | false | false | false | false |
mitodl/edx2bigquery | edx2bigquery/process_tracking_logs.py | 2 | 17761 | #!/usr/bin/python
#
# common procedures to process all tracking logs, and update table based on new tracking logs
import sys
import datetime
import bqutil
import math
def run_query_on_tracking_logs(SQL, table, course_id, force_recompute=False, use_dataset_latest=False,
start_date=None,... | gpl-2.0 | e61ff1c2e6780d4744bcca5bcae1f800 | 51.547337 | 182 | 0.502168 | 4.147828 | false | false | false | false |
mitodl/edx2bigquery | edx2bigquery/make_enrollment_day.py | 1 | 11513 | #!/usr/bin/python
#
# File: make_enrollment_day.py
# Date: 14-Oct-14
# Author: I. Chuang <ichuang@mit.edu>
#
# Make enrollment-day tables on BigQuery. Each daily dataset has the following fields:
#
# course_id
# time
# username
# diff_enrollment (+1 for activate, -1 for deactivate)
#
# These are computed by doing ... | gpl-2.0 | 8e4b1c06aa67f666331a6dd0821b948f | 42.11985 | 144 | 0.523669 | 4.336347 | false | false | false | false |
rpm-software-management/rpmlint | rpmlint/spellcheck.py | 1 | 4513 | import re
from rpmlint.helpers import print_warning
try:
from enchant import Broker
from enchant.checker import SpellChecker
from enchant.tokenize import EmailFilter, URLFilter, WikiWordFilter
ENCHANT = True
except ImportError:
# if the enchant is not present we simply continue but without
# s... | gpl-2.0 | df8b0c105191b597d2fb2892e88a8462 | 35.691057 | 92 | 0.567029 | 4.522044 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.