text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# PyMM - Python MP3 Manager
# Copyright (C) 2000 Pierre Hjalm <pierre.hjalm@dis.uu.se>
#
# Modified by Alexander Kanavin <ak@sensi.org>
# Removed ID tags support and added VBR support
# Used http://home.swipnet.se/grd/mp3info/ for information
#
# This program is free software; you can redistribute it and/or
# modify it... | JoeGermuska/worblehat | reference/pyarchive/pyarchive/mp3.py | Python | mit | 7,381 | 0.022897 |
from ..base import BaseShortener
from ..exceptions import ShorteningErrorException
class Shortener(BaseShortener):
"""
TinyURL.com shortener implementation
Example:
>>> import pyshorteners
>>> s = pyshorteners.Shortener()
>>> s.tinyurl.short('http://www.google.com')
'http... | ellisonleao/pyshorteners | pyshorteners/shorteners/tinyurl.py | Python | gpl-3.0 | 1,019 | 0 |
import autocomplete_light.shortcuts as autocomplete_light
from django import VERSION
from .models import *
try:
import genericm2m
except ImportError:
genericm2m = None
try:
import taggit
except ImportError:
taggit = None
class DjangoCompatMeta:
if VERSION >= (1, 6):
fields = '__all__'... | dsanders11/django-autocomplete-light | autocomplete_light/example_apps/basic/forms.py | Python | mit | 1,043 | 0.000959 |
import base64
def toBase64(s):
return base64.b64encode(str(s))
def fromBase64(s):
return base64.b64decode(str(s))
| HellTech/NAG_IoE_2016 | 30_HellTech_1602_1/08_Meteostanice_GUI_v2/Meteo2/base64function.py | Python | gpl-3.0 | 119 | 0.05042 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | vasconcelosfer/odoo-odisea | odisea/models/representative.py | Python | lgpl-3.0 | 4,870 | 0.015606 |
#!/usr/bin/env python
'''
Created on Jan 5, 2011
@author: mkiyer
chimerascan: chimeric transcript discovery using RNA-seq
Copyright (C) 2011 Matthew Iyer
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 Founda... | madhavsuresh/chimerascan | chimerascan/deprecated/chimerascan_index_v1.py | Python | gpl-3.0 | 5,779 | 0.003634 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-04-09 08:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('georegion', '0001_initial_squashed_0004_auto_20180307_2026'... | stefanw/froide | froide/georegion/migrations/0002_auto_20180409_1007.py | Python | mit | 617 | 0.001621 |
# Copyright (c) 2013 Alan McIntyre
import httplib
import json
import decimal
import re
decimal.getcontext().rounding = decimal.ROUND_DOWN
exps = [decimal.Decimal("1e-%d" % i) for i in range(16)]
btce_domain = "btc-e.com"
all_currencies = ("btc", "usd", "rur", "ltc", "nmc", "eur", "nvc",
"trc", "pp... | blorenz/btce-api | btceapi/common.py | Python | mit | 5,264 | 0.00057 |
class a(object):
pass
class b(a):
pass
print a.__subclasses__()
class c(a):
pass
print a.__subclasses__() | meatcomputer/opencog | opencog/python/examples/test.py | Python | agpl-3.0 | 121 | 0.041322 |
# Generated by Django 2.2.17 on 2021-01-31 06:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('conversation', '0032_twitterusertimeline'),
]
operations = [
migrations.AddField(
model_name='twitterusertimeline',
... | jeromecc/doctoctocbot | src/conversation/migrations/0033_twitterusertimeline_last_api_call.py | Python | mpl-2.0 | 423 | 0 |
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals, print_function, division
| dawncold/expenditure-application | expenditure_application/__init__.py | Python | apache-2.0 | 90 | 0 |
# GUI for pyfdtd using PySide
# Copyright (C) 2012 Patrik Gebhardt
# Contact: grosser.knuff@googlemail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
... | schansge/pyfdtd-gui | src/dialogs/__init__.py | Python | gpl-3.0 | 797 | 0 |
# Copyright 2015 The TensorFlow Authors. 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 applica... | neilhan/tensorflow | tensorflow/python/kernel_tests/rnn_test.py | Python | apache-2.0 | 95,137 | 0.00987 |
"""
HSA driver bridge implementation
"""
from collections.abc import Sequence
import sys
import atexit
import os
import ctypes
import struct
import traceback
import weakref
import logging
from contextlib import contextmanager
from collections import defaultdict, deque
from functools import total_ordering
from numba ... | stonebig/numba | numba/roc/hsadrv/driver.py | Python | bsd-2-clause | 51,876 | 0.001292 |
import os
import re
import sublime
import sublime_plugin
class ExpandTabsOnLoad(sublime_plugin.EventListener):
# Run ST's 'expand_tabs' command when opening a file,
# only if there are any tab characters in the file
def on_load(self, view):
expand_tabs = view.settings().get("expand_tabs_on_load", ... | markashleybell/ExpandTabsOnLoad | ExpandTabsOnLoad.py | Python | mit | 630 | 0 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import hmac
from cryptography.hazmat.bindings._constant_time import lib
... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/cryptography/hazmat/primitives/constant_time.py | Python | apache-2.0 | 798 | 0 |
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis Engemann <denis-alexander.engemann@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from scipy import linalg
from scipy import stats
from scipy.special import expit
im... | bnaul/scikit-learn | sklearn/utils/tests/test_extmath.py | Python | bsd-3-clause | 26,768 | 0 |
#!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... | cmtcoin/wallet | contrib/pyminer/pyminer.py | Python | mit | 6,434 | 0.034815 |
#!/usr/bin/env python
import sys
import os
import re
from lib2to3.pgen2.driver import Driver
from lib2to3 import pygram, pytree
from lib2to3.pytree import Node, Leaf, type_repr
from lib2to3.pygram import python_symbols
def sym_type(name):
return getattr(python_symbols, name)
def new_node(name):
return Node(... | anandology/pyjamas | pyjs/src/pyjs/translator_dict.py | Python | apache-2.0 | 117,085 | 0.001196 |
""" FileDialogDelegateQt.py: Delegate that pops up a file dialog when double clicked.
Sets the model data to the selected file name.
"""
import os.path
try:
from PyQt5.QtCore import Qt, QT_VERSION_STR
from PyQt5.QtWidgets import QStyledItemDelegate, QFileDialog
except ImportError:
try:
from PyQt4... | marcel-goldschen-ohm/ModelViewPyQt | FileDialogDelegateQt.py | Python | mit | 2,023 | 0.001483 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# This file has been created by ARSF Data Analysis Node and
# is licensed under the MIT Licence. A copy of this
# licence is available to download with this file.
#
# Author: Robin Wilson
# Created: 2015-11-16
import sys
import numpy as np
import pandas as pd
# Python 2... | pmlrsg/PySpectra | PySpectra/dart.py | Python | mit | 2,368 | 0.000845 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/aio/operations/_nat_gateways_operations.py | Python | mit | 26,918 | 0.004681 |
# -*- coding: utf-8 -*-
from ..internal.DeadCrypter import DeadCrypter
class Movie2KTo(DeadCrypter):
__name__ = "Movie2KTo"
__type__ = "crypter"
__version__ = "0.56"
__status__ = "stable"
__pattern__ = r'http://(?:www\.)?movie2k\.to/(.+)\.html'
__config__ = [("activated", "bool", "Activated"... | TheBraveWarrior/pyload | module/plugins/crypter/Movie2KTo.py | Python | gpl-3.0 | 472 | 0 |
config = {
"interfaces": {
"google.devtools.clouderrorreporting.v1beta1.ReportErrorsService": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": []
},
"retry_params": {
"default": {
... | jonparrott/google-cloud-python | error_reporting/google/cloud/errorreporting_v1beta1/gapic/report_errors_service_client_config.py | Python | apache-2.0 | 987 | 0 |
import random
rand = random.SystemRandom()
def rabinMiller(num):
if num % 2 == 0:
return False
s = num - 1
t = 0
while s % 2 == 0:
s = s // 2
t += 1
for trials in range(64):
a = rand.randrange(2, num - 1)
v = pow(a, s, num)
if v != 1:
i = 0... | Fitzgibbons/Cryptograpy | rabinmiller.py | Python | mit | 526 | 0.001901 |
'''
salt.targeting
~~~~~~~~~~~~~~
'''
import logging
log = logging.getLogger(__name__)
from .parser import *
from .query import *
from .rules import *
from .subjects import *
#: defines minion targeting
minion_targeting = Query(default_rule=GlobRule)
minion_targeting.register(GlobRule, None, 'glob')
minion_target... | johnnoone/salt-targeting | src/salt/targeting/__init__.py | Python | mit | 816 | 0.006127 |
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
# Copyright 2013 Red Hat, 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/licens... | citrix-openstack-build/oslo.messaging | oslo/messaging/notify/_impl_noop.py | Python | apache-2.0 | 811 | 0 |
# Eloipool - Python Bitcoin pool server
# Copyright (C) 2011-2012 Luke Dashjr <luke-jr+eloipool@utopios.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# L... | uingei/mm | merklemaker.py | Python | agpl-3.0 | 19,767 | 0.034704 |
#
# Copyright (c) 2014, Arista Networks, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of condit... | IntelligentVisibility/ztpserver | ztpserver/__init__.py | Python | bsd-3-clause | 1,638 | 0.000611 |
import urllib.request
import pickle
import sys
try:
import Variables as v
except:
class var():
def __init__(self):
self.screen = None
v = var()
import pygame as py
class textLabel(py.sprite.Sprite):
def __init__(self, text, pos, colour, font, size, variable = False, cen... | Lightning3105/Legend-Of-Aiopa-RPG | Updater.py | Python | gpl-2.0 | 9,598 | 0.007293 |
"""Predicted Electoral Vote Count"""
import re
from madcow.util.http import getsoup
from madcow.util.color import ColorLib
from madcow.util import Module, strip_html
class Main(Module):
pattern = re.compile(r'^\s*(election|ev)\s*$', re.I)
help = u'ev - current election 2008 vote prediction'
baseurl = u'h... | icucinema/madcow | madcow/modules/election.py | Python | gpl-3.0 | 1,577 | 0.001902 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 3 of the Lic... | simonwydooghe/ansible | lib/ansible/modules/network/fortios/fortios_firewall_ssl_server.py | Python | gpl-3.0 | 15,241 | 0.001706 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | akhilaananthram/nupic.fluent | fluent/encoders/language_encoder.py | Python | agpl-3.0 | 7,974 | 0.005769 |
# Copyright (c) 2015 Quobyte 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... | rahulunair/nova | nova/virt/libvirt/volume/quobyte.py | Python | apache-2.0 | 7,552 | 0 |
"""
WSGI config for astrology project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.prod")
from django.... | flp9001/clevenus | clevenus/config/wsgi.py | Python | gpl-3.0 | 395 | 0.002532 |
import os
import sys
import sqlite3
import logging
from tqdm import tqdm
from pathlib import Path
from whoosh.index import create_in, open_dir
from whoosh.fields import Schema, TEXT, NUMERIC
from whoosh.qparser import QueryParser
from whoosh.spelling import ListCorrector
from whoosh.highlight import UppercaseFormatter
... | DeastinY/srpdfcrawler | pdf_search.py | Python | gpl-3.0 | 2,775 | 0.000721 |
import avango
import avango.script
import avango.gua
from examples_common.GuaVE import GuaVE
class TimedRotate(avango.script.Script):
TimeIn = avango.SFFloat()
MatrixOut = avango.gua.SFMatrix4()
def evaluate(self):
self.MatrixOut.value = avango.gua.make_rot_mat(
self.TimeIn.value * 2.... | jakobharlan/avango | examples/simple_example/main.py | Python | lgpl-3.0 | 3,625 | 0.000552 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
The MIT license
Copyright (c) 2010 Jonas Nockert
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation th... | lemonad/molnetbot | molnetbot/xep0012.py | Python | mit | 2,344 | 0.000427 |
import numpy as np
import pytest
from nilabels.tools.image_colors_manipulations.relabeller import relabeller, permute_labels, erase_labels, \
assign_all_other_labels_the_same_value, keep_only_one_label, relabel_half_side_one_label
def test_relabeller_basic():
data = np.array(range(10)).reshape(2, 5)
rela... | SebastianoF/LabelsManager | tests/tools/test_image_colors_manip_relabeller.py | Python | mit | 6,757 | 0.00222 |
#!/usr/bin/env python
#
# Copyright 2014 Matthew Wall
# See the file LICENSE.txt for your rights.
"""Driver for ADS WS1 weather stations.
Thanks to Steve (sesykes71) for the testing that made this driver possible.
Thanks to Jay Nugent (WB8TKL) and KRK6 for weather-2.kr6k-V2.1
http://server1.nuge.com/~weather/
"""
... | RobCranfill/weewx | bin/weewx/drivers/ws1.py | Python | gpl-3.0 | 9,124 | 0.000986 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import MySQLdb as mdb
import uuid, pprint
def generate(data):
gdata = []
for grade in range(1,4):
for clazz in range(1,10):
if grade != data['grade_number'] and clazz != data['class_number']:
gdata.append("insert into classes(uuid, grade_number, class_number, sch... | aaronzhang1990/workshare | test/python/addClasses.py | Python | gpl-2.0 | 1,111 | 0.032403 |
#!/usr/bin/env python
# coding=utf-8
import errno
import os
import sys
import fileinput
import string
import logging
import traceback
import hashlib
import time
import re
from datetime import date, timedelta
import datetime
from subprocess import call
import redis
from datasource import DataSource
class Items(Dat... | junneyang/simplepbrpc | homedir/items.py | Python | mit | 8,104 | 0.006674 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/r-rngtools/package.py | Python | lgpl-2.1 | 2,067 | 0.000484 |
"""Test the roon config flow."""
from homeassistant import config_entries, setup
from homeassistant.components.roon.const import DOMAIN
from homeassistant.const import CONF_HOST
from tests.async_mock import patch
from tests.common import MockConfigEntry
class RoonApiMock:
"""Mock to handle returning tokens for t... | GenericStudent/home-assistant | tests/components/roon/test_config_flow.py | Python | apache-2.0 | 5,782 | 0.000346 |
"""engine.SCons.Tool.aixf77
Tool-specific initialization for IBM Visual Age f77 Fortran compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permiss... | engineer0x47/SCONS | engine/SCons/Tool/aixf77.py | Python | mit | 2,681 | 0.001865 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import autocomplete_light
from django.utils.encoding import force_text
from .settings import USER_MODEL
from .utils.module_loading import get_real_model_class
class UserAutocomplete(autocomplete_light.AutocompleteModelBase):
search_fields = [
... | luzfcb/django_documentos | django_documentos/autocomplete_light_registry.py | Python | bsd-3-clause | 1,391 | 0.000719 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Muduo
'''
FastSync
'''
from setuptools import setup, find_packages
setup(
name='FastSync',
version='0.2.0.3',
packages=find_packages(),
install_requires=[
'requests',
'watchdog',
'pycrypto',
'future',
... | iMuduo/FastSync | setup.py | Python | apache-2.0 | 690 | 0 |
# Author: Wei Xue <xuewei4d@gmail.com>
# Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import re
import sys
import copy
import warnings
import pytest
import numpy as np
from scipy import stats, linalg
from sklearn.covariance import EmpiricalCovariance
from sklearn.datasets impo... | glemaitre/scikit-learn | sklearn/mixture/tests/test_gaussian_mixture.py | Python | bsd-3-clause | 40,311 | 0 |
#
# A sample service to be 'compiled' into an exe-file with py2exe.
#
# See also
# setup.py - the distutils' setup script
# setup.cfg - the distutils' config file for this
# README.txt - detailed usage notes
#
# A minimal service, doing nothing else than
# - write 'start' and 'stop' entries into th... | pupboss/xndian | deploy/site-packages/py2exe/samples/advanced/MyService.py | Python | mit | 2,011 | 0.001989 |
#!/usr/bin/env python
import os
import argparse
import numpy as np
import pandas as pd
import pycondor
import comptools as comp
if __name__ == "__main__":
p = argparse.ArgumentParser(
description='Extracts and saves desired information from simulation/data .i3 files')
p.add_argument('-c', '--config... | jrbourbeau/cr-composition | processing/legacy/anisotropy/random_trials/process_kstest.py | Python | mit | 7,627 | 0.002098 |
#
# 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 us... | adobe-research/spark-cluster-deployment | initial-deployment-puppet/modules/spark/files/spark/python/pyspark/mllib/classification.py | Python | apache-2.0 | 7,307 | 0.001505 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_python_2d_ns
----------------------------------
Tests for `python_2d_ns` module.
"""
import sys
import unittest
from python_2d_ns.python_2d_ns import *
class TestPython_2d_ns(unittest.TestCase):
#test x, y coordinates generated by function IC_coor
... | xinbian/2dns | tests/test_python_2d_ns.py | Python | mit | 2,191 | 0.043359 |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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 a... | Drvanon/Game | venv/lib/python3.3/site-packages/tornado/iostream.py | Python | apache-2.0 | 41,823 | 0.000287 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyYtopt(PythonPackage):
"""Ytopt package implements search using Random Forest (SuRF), an ... | LLNL/spack | var/spack/repos/builtin/packages/py-ytopt/package.py | Python | lgpl-2.1 | 1,360 | 0.003676 |
import _plotly_utils.basevalidators
class TickvalssrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="tickvalssrc",
parent_name="scatter3d.marker.colorbar",
**kwargs
):
super(TickvalssrcValidator, self).__init__(
plotly_... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter3d/marker/colorbar/_tickvalssrc.py | Python | mit | 461 | 0 |
import sys
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
class Visualizer():
def __init__(self, *args):
pass
def show_performance(self, list_of_tuples, fig_size=(9,9), font_scale=1.1, file=''):
"""
Parameters: list_of_tuples:
... | magnusax/ml-meta-wrapper | gazer/visualize.py | Python | mit | 1,824 | 0.01261 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from .views import (AvailableMapListview, AvailableMapsDetailview,
index_view, MyArmiesListView, ArmyCreateView,
ArmyDetailView, RobotCreateView)
urlpatterns = patterns('',
url(r'maingame/maps$'... | mrjmad/robotswars | maingame/urls.py | Python | mit | 868 | 0.009217 |
#!/usr/bin/env python
########################################################################
# File : dirac-version
# Author : Ricardo Graciani
########################################################################
"""
Print version of current DIRAC installation
Usage:
dirac-version [option]
Example:
$ dira... | DIRACGrid/DIRAC | src/DIRAC/Core/scripts/dirac_version.py | Python | gpl-3.0 | 662 | 0 |
def is_palindrome(obj):
obj = str(obj)
obj_list = list(obj)
obj_list_reversed = obj_list[::-1]
return obj_list == obj_list_reversed
def generate_rotations(word):
letters = list(word)
string_rotations = []
counter = len(letters)
temp = letters
while counter != 0:
current_l... | pepincho/Python101-and-Algo1-Courses | Algo-1/Application/1-Palindromes.py | Python | mit | 937 | 0 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import sqlite3
from flask import Flask, render_template, g, current_app, request
from flask.ext.paginate import Pagination
app = Flask(__name__)
app.config.from_pyfile('app.cfg')
@app.before_request
def before_request():
g.conn... | wangjun/flask-paginate | example/app.py | Python | bsd-3-clause | 2,185 | 0.001373 |
from django.contrib.contenttypes.models import ContentType
import json
from django.http import Http404, HttpResponse
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.urlresolvers import... | gunnery/gunnery | gunnery/core/views.py | Python | apache-2.0 | 7,964 | 0.001758 |
"""Support for Acmeda Roller Blind Batteries."""
from __future__ import annotations
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import PERCENTAGE
from homeassistant.core import HomeAssistant, callback
from hom... | mezz64/home-assistant | homeassistant/components/acmeda/sensor.py | Python | apache-2.0 | 1,666 | 0 |
#!/usr/bin/env python
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# (1) Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# ... | ashcrow/etcdobj | setup.py | Python | bsd-3-clause | 2,107 | 0.000475 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 PLUMgrid, 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/lic... | subramani95/neutron | neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py | Python | apache-2.0 | 24,717 | 0 |
import copy
import logging
import os
import pytest
import salt.ext.tornado
import salt.ext.tornado.gen
import salt.ext.tornado.testing
import salt.minion
import salt.syspaths
import salt.utils.crypt
import salt.utils.event as event
import salt.utils.platform
import salt.utils.process
from salt._compat import ipaddress... | saltstack/salt | tests/pytests/unit/test_minion.py | Python | apache-2.0 | 35,098 | 0.001197 |
#!/usr/bin/env python
import sys
# sys.dont_write_bytecode = True
import glob
import os
import time
import logging
import os.path
from argparse import ArgumentParser
class RtmBot(object):
def __init__(self, token):
self.last_ping = 0
self.token = token
self.bot_plugins = []
self... | andela-kanyanwu/food-bot-review | rtmbot.py | Python | mit | 7,049 | 0.001844 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2... | CERNDocumentServer/invenio | modules/miscutil/lib/mailutils.py | Python | gpl-2.0 | 22,698 | 0.001983 |
import os
from torch.utils.ffi import create_extension
sources = ["src/lib_cffi.cpp"]
headers = ["src/lib_cffi.h"]
extra_objects = ["src/bn.o"]
with_cuda = True
this_file = os.path.dirname(os.path.realpath(__file__))
extra_objects = [os.path.join(this_file, fname) for fname in extra_objects]
ffi = create_extension(... | Diyago/Machine-Learning-scripts | DEEP LEARNING/segmentation/Kaggle TGS Salt Identification Challenge/v2/modules/build.py | Python | apache-2.0 | 544 | 0 |
#!/usr/bin/env python
import gtk, sys, string
class Socket:
def __init__(self):
window = gtk.Window()
window.set_default_size(200, 200)
socket = gtk.Socket()
window.add(socket)
print "Socket ID:", socket.get_id()
if len(sys.argv) == 2:
socket.add_id(lo... | Programmica/pygtk-tutorial | examples/socket.py | Python | cc0-1.0 | 572 | 0.005245 |
"""Ensure videos emit proper events"""
import datetime
import json
from nose.plugins.attrib import attr
import ddt
from common.test.acceptance.tests.helpers import EventsTestMixin
from common.test.acceptance.tests.video.test_video_module import VideoBaseTest
from common.test.acceptance.pages.lms.video.video import _p... | louyihua/edx-platform | common/test/acceptance/tests/video/test_video_events.py | Python | agpl-3.0 | 13,984 | 0.002932 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/QT/up-to-date.py | Python | mit | 4,303 | 0.002789 |
import stats_buffer
import util_cli as util
class BucketSummary:
def run(self, accessor):
return stats_buffer.bucket_info
class DGMRatio:
def run(self, accessor):
result = []
hdd_total = 0
ram_total = 0
for node, nodeinfo in stats_buffer.nodes.iteritems():
... | bcui6611/healthchecker | cluster_stats.py | Python | apache-2.0 | 19,273 | 0.01349 |
"""`main` is the top level module for your Flask application."""
# Import the Flask Framework
import os
import json
from flask import Flask, request, send_from_directory, render_template
app = Flask(__name__, static_url_path='')
# Note: We don't need to call run() since our application is embedded within
# the App E... | i5on9i/echoserver | main.py | Python | apache-2.0 | 1,161 | 0 |
"""This component provides select entities for UniFi Protect."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import timedelta
from enum import Enum
import logging
from typing import Any, Final
from pyunifiprotect.data import (
Camera,
DoorbellMessageType,
IRLEDMode,
... | mezz64/home-assistant | homeassistant/components/unifiprotect/select.py | Python | apache-2.0 | 13,007 | 0.001538 |
from django.db.backends.postgresql.creation import * # NOQA
| ringly/django-postgres-dbdefaults | postgresql_dbdefaults/creation.py | Python | mit | 61 | 0 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'My Project',
'author': 'Wouter Oosterveld',
'url': 'URL to get it at.',
'download_url': 'Where to download it.',
'author_email': 'wouter@fizzyflux.nl',
'version': '0.1',
... | wouteroostervld/snaps | setup.py | Python | mit | 465 | 0.004301 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | nop33/indico | indico/modules/events/agreements/base.py | Python | gpl-3.0 | 7,667 | 0.002739 |
# -*- coding: utf-8 -*-
import os
import time
import logging
import string
import requests
import unicodedata
import base64
try: import cPickle as pickle
except: import pickle
import datetime
from django.utils import timezone
import json
from pprint import pprint
from django.shortcuts import render_to_response
fr... | followyourheart/cloudly | vms/views.py | Python | mit | 39,971 | 0.014586 |
# Python - 3.6.0
century = lambda year: year // 100 + ((year % 100) > 0)
| RevansChen/online-judge | Codewars/8kyu/century-from-year/Python/solution1.py | Python | mit | 74 | 0.013514 |
from datetime import datetime
from django.http import HttpResponse, HttpResponseRedirect
from django.views.generic import View, ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView
from content.models import Sub, SubFollow, Post, Commit
from content.forms import SubForm, PostForm, CommitF... | ellipticaldoor/dfiid | project/content/views.py | Python | gpl-2.0 | 5,667 | 0.02541 |
# -*- coding: utf-8 -*-
import time
from openerp import api, models
import datetime
class ReportSampleReceivedvsReported(models.AbstractModel):
_name = 'report.olims.report_sample_received_vs_reported'
def _get_samples(self, samples):
datalines = {}
footlines = {}
total_received_coun... | sciCloud/OLiMS | report/olims_sample_received_vs_reported.py | Python | agpl-3.0 | 4,408 | 0.009301 |
# SnippetViewPlugin - Provides a templated/abbreviation expansion mechanism for
# the editor.
#
# Copyright (C) 2006-2010 Frank Hale <frankhale@gmail.com>
#
# ##sandbox - irc.freenode.net
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# a... | frankhale/nyana | nyana/plugins/SnippetViewPlugin.py | Python | gpl-3.0 | 18,007 | 0.038929 |
# pylint:disable=consider-using-with
from typing import List, Dict
import json
import subprocess
import argparse
import tempfile
import os
import itertools
from collections import defaultdict
import angr
UNIQUE_STRING_COUNT = 20
# strings longer than MAX_UNIQUE_STRING_LEN will be truncated
MAX_UNIQUE_STRING_LEN = 70... | angr/angr | angr/flirt/build_sig.py | Python | bsd-2-clause | 10,375 | 0.00241 |
"""Ttk wrapper.
This module provides classes to allow using Tk themed widget set.
Ttk is based on a revised and enhanced version of
TIP #48 (http://tip.tcl.tk/48) specified style engine.
Its basic idea is to separate, to the extent possible, the code
implementing a widget's behavior from the code implementing its
ap... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.3.0/Lib/tkinter/ttk.py | Python | mit | 56,245 | 0.002471 |
from pywb.rewrite.rewrite_live import LiveRewriter
from pywb.rewrite.url_rewriter import UrlRewriter
from pywb.rewrite.wburl import WbUrl
from pywb import get_test_dir
from io import BytesIO
# This module has some rewriting tests against the 'live web'
# As such, the content may change and the test may break
urlrew... | machawk1/pywb | pywb/rewrite/test/test_rewrite_live.py | Python | gpl-3.0 | 9,395 | 0.007025 |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Online Help Plugin"""
from spyderlib.qt.QtCore import Signal
import os.path as osp
# Local imports
from spyderlib.baseconfig import get_conf_path, ... | jromang/retina-old | distinclude/spyderlib/plugins/onlinehelp.py | Python | gpl-3.0 | 3,199 | 0.00813 |
"""Support for the Hive switches."""
from datetime import timedelta
from homeassistant.components.switch import SwitchEntity
from . import ATTR_AVAILABLE, ATTR_MODE, DATA_HIVE, DOMAIN, HiveEntity, refresh_system
PARALLEL_UPDATES = 0
SCAN_INTERVAL = timedelta(seconds=15)
async def async_setup_platform(hass, config,... | partofthething/home-assistant | homeassistant/components/hive/switch.py | Python | apache-2.0 | 2,449 | 0.000817 |
#
# Copyright (c) SAS Institute 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 w... | sassoftware/rmake3 | rmake/cmdline/monitor.py | Python | apache-2.0 | 26,810 | 0.001567 |
#!/usr/bin/env python
# encoding: utf-8
class MyRange(object):
def __init__(self, n):
self.idx = 0
self.n = n
def __iter__(self):
return self
def next(self):
if self.idx < self.n:
val = self.idx
self.idx += 1
return val
else:
... | feixiao5566/Py_Rabbic | IO/自定义迭代器.py | Python | bsd-2-clause | 402 | 0.00995 |
# -*- coding: utf-8 -*-
import os.path
import re
import warnings
try:
from setuptools import setup, find_packages
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
version = '0.2.1'
news = os.path.join(os.path.dirname(__file__... | hozn/keepassdb | setup.py | Python | gpl-3.0 | 2,399 | 0.013344 |
#!/Users/harvey/Projects/face-hack/venv/face/bin/python
#
# The Python Imaging Library
# $Id$
#
from __future__ import print_function
try:
from tkinter import *
except ImportError:
from Tkinter import *
from PIL import Image, ImageTk
import sys
# ------------------------------------------------------------... | harveybia/face-hack | venv/face/bin/player.py | Python | mit | 2,210 | 0 |
# Authors: Ashim Bhattarai <ashimb9@gmail.com>
# Thomas J Fan <thomasjpfan@gmail.com>
# License: BSD 3 clause
import numpy as np
from ._base import _BaseImputer
from ..utils.validation import FLOAT_DTYPES
from ..metrics import pairwise_distances_chunked
from ..metrics.pairwise import _NAN_METRICS
from ..neig... | kevin-intel/scikit-learn | sklearn/impute/_knn.py | Python | bsd-3-clause | 11,682 | 0 |
#!/usr/bin/python -Wall
# ================================================================
# Copyright (c) John Kerl 2007
# kerl.john.r@gmail.com
# ================================================================
from __future__ import division # 1/2 = 0.5, not 0.
from math import *
from sackmat_m import *
import cop... | johnkerl/scripts-math | pythonlib/bin/jac.py | Python | bsd-2-clause | 5,698 | 0.044577 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/_web_site_management_client.py | Python | mit | 8,647 | 0.004857 |
from FortyTwo.fortytwo import *
def Start():
"""No Clue what to add here"""
| 1m0r74l17y/FortyTwo | FortyTwo/__init__.py | Python | mit | 80 | 0.0125 |
import os
from django.conf import settings
import yaafelib as yf
import wave
import contextlib
from celery import task
from sepal.datasets.models import *
from sepal.datasets.utils import filter_by_key, find_dict_by_item
@task()
def handle_uploaded_file(f):
'''Saves an uploaded data source to MEDIA_ROOT/data_so... | sloria/sepal | sepal/datasets/tasks.py | Python | bsd-3-clause | 8,545 | 0.007373 |
import unittest
import hashlib
import httpsig.sign as sign
from httpsig.utils import parse_authorization_header
from requests.models import RequestEncodingMixin
class CrossPlatformTestCase(unittest.TestCase):
def test_content_md5(self):
data = {'signature': "HPMOHRgPSMKdXrU6AqQs/i9S7alOakkHsJiqLGmInt05Cxj... | blocktrail/blocktrail-sdk-python | tests/cross_platform_test.py | Python | mit | 1,454 | 0.003439 |
"""Resource manage module."""
import os
from .utils import RequestUtil
class ResourceAPI(object):
"""Resource wechat api."""
ADD_TEMP_URI = ('https://api.weixin.qq.com/cgi-bin/media/'
'upload?access_token={}&type={}')
@classmethod
def upload(cls, path, token, rtype, upload_type=... | istommao/wechatkit | wechatkit/resource.py | Python | mit | 1,185 | 0 |
# coding=utf-8
from __future__ import unicode_literals, print_function
from flask import request, jsonify, url_for
from flask_login import current_user
import bugsnag
from . import load
from webhookdb.tasks.pull_request_file import spawn_page_tasks_for_pull_request_files
@load.route('/repos/<owner>/<repo>/pulls/<int:... | singingwolfboy/webhookdb | webhookdb/load/pull_request_file.py | Python | agpl-3.0 | 1,058 | 0.002836 |
import math
import pkg_resources
import itertools
import pandas as pd
import networkx as nx
from postman_problems.viz import add_node_attributes
from postman_problems.graph import (
read_edgelist, create_networkx_graph_from_edgelist, get_odd_nodes, get_shortest_paths_distances
)
from postman_problems.solver import ... | brooksandrew/postman_problems | postman_problems/tests/test_example_sleeping_giant.py | Python | mit | 6,009 | 0.002663 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.