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 |
|---|---|---|---|---|---|---|
class WordDictionary(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.root = {}
def addWord(self, word):
"""
Adds a word into the data structure.
:type word: str
:rtype: void
"""
node = self.root
... | ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/211_Add_and_Search_Word_Data_structure_design.py | Python | mit | 1,004 | 0.000996 |
from fastapi.testclient import TestClient
from docs_src.metadata.tutorial001 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {
"title": "ChimichangApp",
"description": "\nChimichangApp API helps you do awesome stuff. 🚀\n\n## Items\n\nYou can **read items**.... | tiangolo/fastapi | tests/test_tutorial/test_metadata/test_tutorial001.py | Python | mit | 1,611 | 0.000622 |
import sys
from numpy import *
from scipy import signal
import scipy.io.wavfile
from matplotlib import pyplot
import sklearn.decomposition
def main():
# First load the audio data, the audio data on this example is obtained from http://www.ism.ac.jp/~shiro/research/blindsep.html
rate, source = scipy.io.wavfile.re... | nareshshah139/CocktailPartyAlgorithm1 | CocktailPartyAlgorithm.py | Python | mit | 2,277 | 0.039087 |
#!/usr/bin/env python
#coding=utf-8
from twisted.python import log
from toughradius.radiusd.settings import *
import logging
import datetime
def process(req=None,user=None,radiusd=None,**kwargs):
if not req.get_acct_status_type() == STATUS_TYPE_STOP:
return
runstat=radiusd.runstat
store = ra... | davislidaqing/Mcoderadius | toughradius/radiusd/plugins/acct_stop_process.py | Python | agpl-3.0 | 1,514 | 0.018494 |
#!/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/duplicate-sources.py | Python | mit | 2,021 | 0.000495 |
# candidate/controllers.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .models import CandidateCampaignListManager, CandidateCampaignManager
from ballot.models import CANDIDATE
from config.base import get_environment_variable
from django.contrib import messages
from django.http import HttpRespon... | wevote/WebAppPublic | candidate/controllers.py | Python | bsd-3-clause | 29,893 | 0.003646 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Approach:
# - Listen for image load event and check the XMP tag GPano:UsePanoramaViewer
# https://developers.google.com/streetview/spherical-metadata
# - GExiv2 (in default Ubuntu install, but may not be robust enough to inconsistent/duplicate XMP tags)
# - ExifT... | Aerilius/eog_panorama | eog_panorama/eog_panorama.py | Python | gpl-3.0 | 15,642 | 0.007672 |
import sublime
import sublime_plugin
from ..core import oa_syntax, decorate_pkg_name
from ..core import ReportGenerationThread
from ...lib.packages import PackageList
###----------------------------------------------------------------------------
class PackageReportThread(ReportGenerationThread):
"""
Genera... | OdatNurd/OverrideAudit | src/commands/package_report.py | Python | mit | 2,593 | 0.0027 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# Copyright 2014 Peerchemist
#
# This file is part of NuBerryPi project.
#
# 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 Li... | inuitwallet/nuberrypi | PKGBLD/nuberrypi-info/nuberrypi-info.py | Python | gpl-3.0 | 7,347 | 0.028039 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from reportlab.pdfbase import ttfonts
from odoo import api, fields, models
from odoo.report.render.rml2pdf import customfonts
"""This module allows the mapping of some system-available TTF fonts to
the r... | chienlieu2017/it_management | odoo/odoo/addons/base/res/res_font.py | Python | gpl-3.0 | 6,052 | 0.003305 |
import sys
import os
from distutils.core import setup
if sys.version_info.major >= 3:
print 'Sorry, currently only supports Python 2. Patches welcome!'
sys.exit(1)
setup(
name='browser-cookie',
version='0.6',
packages=['browser_cookie'],
package_dir={'browser_cookie' : '.'}, # look for packag... | JFDesigner/FBAlbumDownloader | browser_cookie/setup.py | Python | gpl-2.0 | 722 | 0.006925 |
import logging
from ask import alexa
import car_accidents
import expected_population
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def lambda_handler(request_obj, context=None):
return alexa.route_request(request_obj)
@alexa.default
def default_handler(request):
logger.info('default_handler')
... | geoaxis/ask-sweden | ask_sweden/lambda_function.py | Python | mit | 3,656 | 0.001094 |
"""Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_array_equal, assert_array_less
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raises, assert_rais... | Barmaley-exe/scikit-learn | sklearn/ensemble/tests/test_weight_boosting.py | Python | bsd-3-clause | 15,811 | 0 |
# -*- coding: utf-8 -*-
"""
Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
The MIT License (MIT)
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 res... | xunxunzgq/open-hackathon-bak_01 | open-hackathon-server/src/hackathon/storage/local_storage.py | Python | mit | 7,616 | 0.003808 |
from layer import *
class TanhLayer(Layer):
def __init__(self, *args, **kwargs):
super(TanhLayer, self).__init__(*args, **kwargs)
@classmethod
def IsLayerType(cls, proto):
return proto.hyperparams.activation == deepnet_pb2.Hyperparams.TANH
def ApplyActivation(self):
cm.tanh(self.state)
def Sam... | 7404N/deepnet | deepnet/tanh_layer.py | Python | bsd-3-clause | 1,606 | 0.010585 |
from mock import patch, call
import mock
from lxml import etree
from kiwi.solver.repository.rpm_md import SolverRepositoryRpmMd
from kiwi.solver.repository.base import SolverRepositoryBase
class TestSolverRepositoryRpmMd:
def setup(self):
self.xml_data = etree.parse('../data/repomd.xml')
self.u... | SUSE/kiwi | test/unit/solver/repository/rpm_md_test.py | Python | gpl-3.0 | 1,668 | 0 |
##############################################################################
# Copyright (c) 2013-2017, 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... | skosukhin/spack | var/spack/repos/builtin/packages/numdiff/package.py | Python | lgpl-2.1 | 2,791 | 0.000717 |
'''
Test the sslheaders plugin.
'''
# 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, Ver... | chitianhao/trafficserver | tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py | Python | apache-2.0 | 3,767 | 0.004247 |
## This file is part of Invenio.
## Copyright (C) 2012, 2013 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 of the
## License, or (at your option) any later version.
##
... | kaplun/ops | modules/bibdocfile/lib/bibdocfile_webinterface.py | Python | gpl-2.0 | 26,790 | 0.005524 |
import urlparse
import os, sys
tools_dir = os.environ.get('TOOLSDIR')
lib_path = os.path.abspath(tools_dir)
sys.path.append(lib_path)
from msc_utils_parsing import *
from blockchain_utils import *
from msc_apps import *
import random
def send_form_response(response_dict):
expected_fields=['from_address', 'to_addre... | Nevtep/omniwallet | api/send.py | Python | agpl-3.0 | 10,105 | 0.017912 |
from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal
from PyQt5.Qt import QSystemTrayIcon, QIcon
class TrayIcon(QSystemTrayIcon):
ActivationReason = ['Unknown', 'Context', 'DoubleClick', 'Trigger', 'MiddleClick']
onactivate = pyqtSignal(int, str)
onmessageclick = pyqtSignal()
def __init__(self, p... | xiruibing/hae | src/trayicon.py | Python | mit | 1,695 | 0.040583 |
"""
Extended docstrings for functions.py
"""
pi = r"""
`\pi`, roughly equal to 3.141592654, represents the area of the unit
circle, the half-period of trigonometric functions, and many other
things in mathematics.
Mpmath can evaluate `\pi` to arbitrary precision::
>>> from mpmath import *
>>> mp.dps = 50; m... | JensGrabner/mpmath | mpmath/function_docs.py | Python | bsd-3-clause | 280,518 | 0.000125 |
# -*- coding: utf-8 -*-
from gensim.models import word2vec
from gensim import models
import jieba
import codecs
import io
from collections import Counter
import operator
import numpy
f = codecs.open("target_article.txt",'r','utf8')
content = f.readlines()
article = []
jieba.set_dictionary('jieba_dict/dict.txt.big')... | chunchih/article-matching | experiment/find_key_relation.py | Python | bsd-3-clause | 2,408 | 0.023671 |
###############################################################################
#PPAM is a pulseaudio interface.
#Copyright (C) 2013 Denis Doria (Thuck)
#
#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 Found... | thuck/ppam | ui/tabs.py | Python | gpl-2.0 | 13,310 | 0.003681 |
# -*- coding: utf-8 -*-
#
# documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 27 13:23:22 2008-2009.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleab... | aperigault/ansible | docs/docsite/rst/conf.py | Python | gpl-3.0 | 8,952 | 0.00067 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Satpy developers
#
# This file is part of satpy.
#
# satpy 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... | pytroll/satpy | satpy/readers/li_l2.py | Python | gpl-3.0 | 5,368 | 0.000373 |
#!/usr/bin/env python3
import unittest
import tempfile
from lofar.common.dbcredentials import *
def setUpModule():
pass
def tearDownModule():
pass
class TestCredentials(unittest.TestCase):
def test_default_values(self):
c = Credentials()
self.assertEqual(c.type, "postgres")
self.assertEqual(c.hos... | kernsuite-debian/lofar | LCS/PyCommon/test/t_dbcredentials.py | Python | gpl-3.0 | 2,789 | 0.008964 |
exec(open("tmp<caret>.txt").read()) | asedunov/intellij-community | python/testData/refactoring/introduceConstant/py1840.py | Python | apache-2.0 | 35 | 0.028571 |
# Copyright 2016 Red Hat, 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... | openstack/cinder | cinder/common/constants.py | Python | apache-2.0 | 1,167 | 0 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
# Load extensions
(
sh % "cat"
<< r"""... | facebookexperimental/eden | eden/scm/tests/test-fb-hgext-diff-since-last-submit-t.py | Python | gpl-2.0 | 6,148 | 0.00244 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""Implement standard (and unused) TCP protocols.
These protocols are either provided by inetd, or are not provided at all.
"""
from __future__ import absolute_import, division
import time
import struct
from zope.interface import implementer
... | Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/protocols/wire.py | Python | gpl-3.0 | 2,659 | 0.003009 |
# Time: O(n) ~ O(n^2)
# Space: O(1)
from random import randint
class Solution:
# @param {integer[]} nums
# @param {integer} k
# @return {integer}
def findKthLargest(self, nums, k):
left, right = 0, len(nums) - 1
while left <= right:
pivot_idx = randint(left, right)
... | kamyu104/LeetCode | Python/kth-largest-element-in-an-array.py | Python | mit | 1,142 | 0.002627 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, traceback, Ice, threading, time, os
import IceStorm
# Ctrl+c handling
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
# Qt interface
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtSvg import *
# Check that RoboComp has been ... | robocomp/robocomp-ursus-rockin | components/comprehension/comprehension.py | Python | gpl-3.0 | 4,066 | 0.029759 |
# 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 t... | anand1712/cloudpulse | cloudpulse/openstack/api/cinder_api.py | Python | apache-2.0 | 1,489 | 0 |
'''
Created on 30-07-2014
@author: mateusz
'''
from threading import Thread
import gumtreeofferparser as Parser
from injectdependency import Inject, InjectDependency
@InjectDependency('urlfetcher')
class OfferFetcher(Thread):
urlfetcher = Inject
def __init__(self, inQueue, outQueue):
... | mateuszmidor/GumtreeOnMap | src/offerfetcher.py | Python | gpl-2.0 | 848 | 0.008255 |
from syslog import syslog
module_name = "Syslog"
config = {
"prefix": "Default Prefix"
}
def handle_alert(message):
syslog("{} - {}".format(config["prefix"], message))
| camerongray1515/Prophasis | application/prophasis_common/prophasis_common/alert_modules/syslog.py | Python | bsd-2-clause | 179 | 0.005587 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 20 20:42:20 2016
@author: haell
"""
def dicho(f, a, b, epsilon):
assert f(a) * f(b) <= 0 and epsilon > 0
g, d = a, b
fg, fd = f(g), f(d)
n = 0
while d - g > 2 * epsilon:
n += 1
m = (g + d) / 2.
fm = f(m)
if fg * fm <= 0... | Haellsigh/travaux-pratiques | TP/TP8-Exo2.py | Python | mit | 532 | 0.011278 |
# 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 u... | NonVolatileComputing/arrow | python/pyarrow/tests/test_types.py | Python | apache-2.0 | 4,240 | 0 |
import unittest
from word_treasure import *
class WordTreasureTestCase(unittest.TestCase):
"""Test for functions in word treasure.
The major aim is to check if there is any
unexpected crash.
Doesnot check the validity of the response"""
def test_definition_call(self):
word1 = "hello"
... | harsimrans/word-treasure | word_treasure/test_wordt.py | Python | gpl-3.0 | 1,648 | 0.005461 |
# Copyright 2014 OpenStack Foundation
#
# 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 ... | wolverineav/neutron | neutron/db/migration/alembic_migrations/brocade_init_ops.py | Python | apache-2.0 | 2,634 | 0 |
# -*- encoding: utf8 -*-
# A daemon to keep SSH forwarding connected
from __future__ import print_function, absolute_import
import os
import sys
import time
import socket
import logging
class Daemon(object):
def __init__(self):
self.heartbeat = 50
def run(self):
logging.basicConfig(filename=... | dlutxx/memo | python/daemon.py | Python | mit | 1,497 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Search through the subfolders of the current folder. For each subfolder found,
chdir() to it, then run all executable scripts ending in .SH in that folder.
Does not exhaustively search for subfolders of subfolders, or subfolders of
subfolders of subfolders, etc.; it onl... | patrick-brian-mooney/python-personal-library | run_subfolder_scripts.py | Python | gpl-3.0 | 1,560 | 0.005128 |
#!/usr/bin/python
##############################################
###Python template
###Author: Elizabeth Lee
###Date: 4/26/14
###Function: Incidence per 100,000 vs. week number for flu weeks (wks 40-20). Incidence is per 100,000 for the US population in the second calendar year of the flu season.
###Import data: SQL_... | eclee25/flu-SDI-exploratory-age | scripts/create_fluseverity_figs/F2_incid_time.py | Python | mit | 2,579 | 0.01551 |
from functools import wraps
from threading import RLock
import traceback
def Synchronized(lock=None):
"""
:param lock: if None - global lock will used, unique for each function
:return:
"""
if not lock:
lock=RLock()
def decorator(fn):
@wraps(fn)
def wrapped(*args, **kw... | shaddyx/simpleDecorators | simpledecorators/Synchronized.py | Python | mit | 511 | 0.005871 |
import json
from django import template
register = template.Library()
@register.filter
def jsonify(value):
return json.dumps(value)
| Code4SA/municipal-data | municipal_finance/templatetags/jsonify.py | Python | mit | 140 | 0 |
from PIL import Image
from math import ceil, floor
def load_img(src):
return Image.open(src)
def create_master(width, height):
return Image.new("RGBA", (width, height))
def closest_power_two(num):
result = 2
while result < num:
result = result * 2
return result
def create_matrix(cols, ro... | zaibacu/DamnedQuest | sprite_creator.py | Python | mit | 1,532 | 0.00718 |
#
# 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... | apache/incubator-airflow | airflow/operators/redshift_to_s3_operator.py | Python | apache-2.0 | 1,680 | 0.002381 |
from django.db import models
from .bleachfield import BleachField
class BleachCharField(BleachField, models.CharField):
def pre_save(self, model_instance, add):
new_value = getattr(model_instance, self.attname)
clean_value = self.clean_text(new_value)
setattr(model_instance, self.attname... | BetterWorks/django-bleachfields | bleachfields/bleachchar.py | Python | mit | 409 | 0 |
# Copyright 2012 OpenStack, LLC
# 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 b... | tylertian/Openstack | openstack F/glance/glance/api/v2/image_tags.py | Python | apache-2.0 | 1,791 | 0 |
# Copyright 2014-2017 by Akira Yoshiyama <akirayoshiyama@gmail.com>.
# 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... | yosshy/osclient2 | osclient2/nova/v2/server.py | Python | apache-2.0 | 21,602 | 0 |
from django.db import models
from jsonfield import JSONField
class Sensor(models.Model):
name = models.CharField(max_length=25)
activated = models.BooleanField(default=False)
type = models.CharField(max_length=10)
meta = JSONField()
| skitoo/chac | chac/sensors/models.py | Python | gpl-3.0 | 251 | 0 |
import functools
from . import (
constants,
utils,
)
class Card():
def __init__(self, kind=None, strength=None, value=None, verbose=None, **kwargs):
if kind is None:
raise(TypeError("Missing required 'kind' argument."))
self.kind = kind
self.strength = strength
... | julka2010/games | games/tichu/cards.py | Python | mpl-2.0 | 2,702 | 0.002591 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/falken | service/learner/brains/specs.py | Python | apache-2.0 | 58,084 | 0.005113 |
# coding=utf-8
"""
The NetworkCollector class collects metrics on network interface usage
using /proc/net/dev.
#### Dependencies
* /proc/net/dev
"""
import diamond.collector
from diamond.collector import str_to_bool
import diamond.convertor
import os
import re
try:
import psutil
except ImportError:
psuti... | dcsquared13/Diamond | src/collectors/network/network.py | Python | mit | 4,536 | 0.007496 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe import _
from frappe.utils import flt, get_datetime, getdate, date_diff, cint, nowdate
from frappe.model.document ... | brownharryb/erpnext | erpnext/manufacturing/doctype/work_order/work_order.py | Python | gpl-3.0 | 25,289 | 0.025031 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM14/CPSM/Equipment/Core/GeographicalRegion.py | Python | mit | 2,316 | 0.000864 |
import argparse
from pdnssync.database import Database
from pdnssync.parse import Parser
from pdnssync.error import get_warn, get_err
parser = Parser()
def validate():
domains = parser.get_domains()
for d in sorted(domains):
domains[d].validate(domains)
def sync(db):
all_db_domains = db.get_dom... | Quiphius/pdns-sync | pdnssync/main.py | Python | mit | 2,853 | 0.001052 |
from __future__ import absolute_import
from .base import *
from bundle_config import config
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': config['postgres']['database'],
'USER': config['postgres']['username'],
'PASSWORD': config['postgres']['... | almet/whiskerboard | settings/epio.py | Python | mit | 751 | 0.001332 |
import numpy as np
import canal as canal
from .util import NumpyTestCase
class FromJSONTestCase(NumpyTestCase):
class Measurement(canal.Measurement):
int_field = canal.IntegerField()
alternate_db_name = canal.IntegerField(db_name="something_else")
float_field = canal.FloatField()
... | dan-stone/canal | canal/tests/test_from_json.py | Python | mit | 3,665 | 0 |
import os
import sys
def main(args):
if len(args) != 2:
print("Usage: python project-diff.py [path-to-project-1] [path-to-project-2]")
return
dir1 = args[0]
dir2 = args[1]
project1 = collect_text_files(dir1)
project2 = collect_text_files(dir2)
files_only_in_1 = []
files_only_in_2 = []
files_... | blakeohare/crayon | Scripts/project-diff.py | Python | mit | 5,511 | 0.020323 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | zstars/weblabdeusto | server/src/experiments/ud_demo_xilinx/server.py | Python | bsd-2-clause | 2,623 | 0.006484 |
__author__ = 'roman'
from django.utils.functional import SimpleLazyObject
from . import get_card as _get_card
def get_card(request):
if not hasattr(request, '_cached_card'):
request._cached_card = _get_card(request)
return request._cached_card
class CardAuthMiddleware(object):
def process_requ... | suprotkin/atm | atm/card/middleware.py | Python | gpl-2.0 | 751 | 0.001332 |
# Step 1: Make all the "turtle" commands available to us.
import turtle
# Step 2: create a new turtle, we'll call him simon
simon = turtle.Turtle()
# Lets draw a square!
for loop in range(4):
simon.forward(200)
simon.left(90)
| SimonDevon/simple-python-shapes | square1.py | Python | mit | 236 | 0 |
#!/usr/bin/env python3
import os
import shutil
import subprocess
import gettext
version = '4.4.0'
builds = [
{ 'language': 'de', 'paper': 'a4paper', 'babel': 'ngerman' },
{ 'language': 'en', 'paper': 'letterpaper', 'babel': 'USenglish' },
{ 'language': 'es', 'paper': 'a4paper', 'babel': 'spanish' },
{ 'language'... | iTALC/documentation | build-manuals.py | Python | gpl-3.0 | 1,538 | 0.046164 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', 'flag=ceph'],
[TestAction.create_volume, 'volume1', 'flag=ceph,scsi'],
[TestAction.attach_volume, 'vm1... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/xc_path8.py | Python | apache-2.0 | 1,642 | 0.017052 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014 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 of the
## License, or (at your option) a... | MSusik/invenio | invenio/testsuite/test_apps/first/views.py | Python | gpl-2.0 | 951 | 0.01367 |
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class STARInstaller(ClusterSetup):
def run(self, nodes, master, user, user_shell, volumes):
for node in nodes:
log.info("Installing STAR 2.4.0g1 on %s" % (node.alias))
node.ssh.execute('wget -c -P /opt/software/star https://g... | meissnert/StarCluster-Plugins | STAR_2_4_0g1.py | Python | mit | 1,005 | 0.018905 |
#! /bin/python2
import numpy
import cv2
import os
import struct
BLACK = (0,)
WHITE = (255,)
DIR_OUT = "./img/"
SIZE_CANVAS = 50
SIZE_FEATURE = 28
SIZE_BLOCK = 32
DIGITS = tuple([chr(ord("0") + i) for i in range(10)] + [""])
FONTS = (cv2.FONT_HERSHEY_SIMPLEX, cv2.FONT_HERSHEY_PLAIN,
cv2.FONT_HERSHEY_DUPLEX, c... | t-lou/JSudokuSolver | digit_generator/digit_gen.py | Python | apache-2.0 | 4,207 | 0.013311 |
from django.conf.urls import url, include
from django.contrib import admin
from rest_framework import routers, serializers, viewsets
from .views import HomePageView
urlpatterns = [
url(r'^$', HomePageView.as_view(), name='home'),
url(r'^admin/', admin.site.urls),
url(r'^', include('slackdata.urls')),
]
| jbarciauskas/slack-stats | openedxstats/urls.py | Python | bsd-3-clause | 319 | 0 |
from django.apps import AppConfig
class BugReportsConfig(AppConfig):
name = "bug_reports"
| DemocracyClub/UK-Polling-Stations | polling_stations/apps/bug_reports/apps.py | Python | bsd-3-clause | 96 | 0 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/oehealth | oehealth_prescription/oehealth_patient_medication.py | Python | agpl-3.0 | 2,721 | 0.009555 |
import argparse
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from perf.errsim import *
def plot_x_vs_pmf(params, show=True, fpath=None):
def plot(ax, x, param, **plotargs):
if param['pb'] is None:
param['pb'] = param['pe']
label = 'BSC pe={pe} m={m} n={n}... | r-rathi/error-control-coding | perf/perf_plots.py | Python | mit | 11,256 | 0.002221 |
from __future__ import print_function
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
class ImageMenu(Gtk.EventBox):
def __init__ (self, image, child):
GObject.GObject.__init__(self)
self.add(image)
self.subwindow = Gtk.Window()... | rajrakeshdr/pychess | lib/pychess/widgets/ImageMenu.py | Python | gpl-3.0 | 4,643 | 0.0112 |
# -*- coding: utf-8 -*-
"""
test_sphinx
~~~~~~~~~~~
General Sphinx test and check output.
"""
import sys
import pytest
import sphinx
from ipypublish.sphinx.tests import get_test_source_dir
from ipypublish.tests.utils import HTML2JSONParser
@pytest.mark.sphinx(buildername="html", srcdir=get_test_source_... | chrisjsewell/ipypublish | ipypublish/sphinx/tests/test_bibgloss.py | Python | bsd-3-clause | 3,453 | 0.002317 |
#! /usr/bin/env python
# -*- coding: UTF8 -*-
# Este arquivo é parte do programa Carinhas
# Copyright 2013-2014 Carlo Oliveira <carlo@nce.ufrj.br>,
# `Labase <http://labase.selfip.org/>`__; `GPL <http://is.gd/3Udt>`__.
#
# Carinhas é um software livre; você pode redistribuí-lo e/ou
# modificá-lo dentro dos termos da Li... | labase/eica | tests/testwebfunctionaldb.py | Python | gpl-2.0 | 5,489 | 0.00293 |
from time import time
from pychess.Utils.lutils.lmovegen import genAllMoves
from pychess.Utils.lutils.lmove import toLAN
def do_perft(board, depth, root):
nodes = 0
if depth == 0:
return 1
for move in genAllMoves(board):
board.applyMove(move)
if board.opIsChecked():
... | leogregianin/pychess | lib/pychess/Utils/lutils/perft.py | Python | gpl-3.0 | 857 | 0 |
#!/usr/bin/python
from __future__ import print_function
import weather, time
a = time.time(); weather.hourly.load("ottawa"); print time.time() - a
raw_input()
| endlisnis/weather-records | testHourly.py | Python | gpl-3.0 | 159 | 0.018868 |
from unittest import mock
from django.conf import settings
from django.db import connection, models
from django.db.models.functions import Lower, Upper
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.test.utils import isolate_apps
from .models import Book, ChildModel1, ChildModel2
... | wkschwartz/django | tests/model_indexes/tests.py | Python | bsd-3-clause | 13,530 | 0.0017 |
# -*- coding: utf-8 -*-
#
# pynest_api_template.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 Lic... | stinebuu/nest-simulator | doc/userdoc/contribute/templates_styleguides/pynest_api_template.py | Python | gpl-2.0 | 4,742 | 0.001266 |
# Copyright 2019 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | openstack/vitrage | vitrage/evaluator/template_validation/content/v2/get_param_validator.py | Python | apache-2.0 | 1,505 | 0 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/lldp/lldpparam.py | Python | apache-2.0 | 5,812 | 0.031142 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from flask_script import Manager, Shell, Server
from flask_migrate import MigrateCommand
from gakkgakk.app import create_app
from gakkgakk.models import User
from gakkgakk.settings import DevConfig, ProdConfig
from gakkgakk.database import db
reload(... | jkaberg/GakkGakk | manage.py | Python | mit | 1,062 | 0 |
from fnmatch import fnmatchcase
from trac.config import Option
from trac.core import *
from trac.perm import IPermissionPolicy
revision = "$Rev: 11490 $"
url = "$URL: https://svn.edgewall.org/repos/trac/tags/trac-1.0.1/sample-plugins/permissions/public_wiki_policy.py $"
class PublicWikiPolicy(Component):
"""Allo... | cghr/cghr-chef-repository | cookbooks/trac/files/default/plugins-stock/public_wiki_policy.py | Python | apache-2.0 | 2,244 | 0.004902 |
#!/usr/bin/env python
from settings import Settings
from scan import Scanner
from logger import Logger
def main():
try:
#Read config file
settings=Settings()
#Set up logger
logger=Logger(settings)
#Create scanner
scanner=Scanner(settings,logger)
#Begin scanning
scanner.StartScanning()
except ... | SteveAbb/Vestigo | Vestigo/vestigo.py | Python | mit | 405 | 0.081481 |
"""
An estimator for modelling data from a mixture of Gaussians,
using an objective function based on minimum message length.
"""
__all__ = [
"GaussianMixture",
"kullback_leibler_for_multivariate_normals",
"responsibility_matrix",
"split_component", "merge_component", "delete_component",
]
import ... | andycasey/snob | snob/nips_search.py | Python | mit | 67,954 | 0.004709 |
from constants import constants, callback_name_list
from controller import plan_controller, navigable_list_controller, navigable_inline_keyboard_controller, settings_controller
from telepot.namedtuple import ReplyKeyboardRemove
from bot import bot
from decorators.callback import callback_dict as callback_list
"""
call... | AntoDev96/GuidaSky | handlers/callback.py | Python | gpl-3.0 | 1,351 | 0.005181 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provides class BaseCodeEditor; base class for
CodeEditor class in Coder
and CodeBox class in dlgCode (code component)
"""
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2020 Open Science Tools Ltd.
# Distributed under the term... | psychopy/versions | psychopy/app/coder/codeEditorBase.py | Python | gpl-3.0 | 19,323 | 0.001139 |
"""
Created on 05/12/13
@author: zw606
simple example
assumes images and labels files are named the same but in different folders
(one folder for images, one folder for labels)
"""
import glob
from os.path import join, basename
from spatch.image import spatialcontext
from spatch.image.mask import get_boundary_mask
f... | iZehan/spatial-pbs | examples/simplerun.py | Python | bsd-3-clause | 7,287 | 0.004117 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from random import random
from math import floor
from .common import InfoExtractor
from ..utils import (
ExtractorError,
remove_end,
sanitized_Request,
)
class IPrimaIE(InfoExtractor):
_WORKING = False
_VALID_URL = r'https... | dyn888/youtube-dl | youtube_dl/extractor/iprima.py | Python | unlicense | 3,713 | 0.00216 |
# -*- coding: utf-8 -*-
#
# This file is covered by the GNU Public Licence v3 licence. See http://www.gnu.org/licenses/gpl.txt
#
'''
List of controllers, with indirections to object loaded by Spring
'''
import springpython.context
from django.http import HttpResponse
from django.template import loader, Context
from o... | smorand/dtol | src/core/controllers.py | Python | gpl-3.0 | 4,697 | 0.031935 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
# from django.conf import settings
urlpatterns = patterns('www.sight.views',
url(r'^$', 'sight_map'),
url(r'^(?P<sight_id>\d+)$', 'sight_detail'),
)
| lantianlz/qiexing | www/sight/urls.py | Python | gpl-2.0 | 287 | 0 |
# -*- coding: UTF-8 -*-
# Copyright 2016-2017 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
from lino_xl.lib.tickets.models import *
from lino.api import _
Ticket.hide_elements('closed')
# class Ticket(Ticket):
# class Meta(Ticket.Meta):
# app_label = 'tickets'
# verbose_name = _(... | lino-framework/book | lino_book/projects/anna/lib/tickets/models.py | Python | bsd-2-clause | 1,862 | 0.001611 |
#Key, dictionary[key, int], int --> dictionary[key, int]
#Given a key, dictionary and increment, set the dictionary value at
#key to dictionary[key] + inc. If there is no old value, set to inc
def incrementDict(dictKey, dictionary, inc=1):
if(dictKey in dictionary):
dictionary[dictKey] += inc
else:
dictionary[dic... | Yagniksuchak/CodeParser | src/logChunk/dictUtil.py | Python | bsd-3-clause | 602 | 0.031561 |
"""
Tests for uu module.
Nick Mathewson
"""
import unittest
from test.support import os_helper
import os
import stat
import sys
import uu
import io
plaintext = b"The symbols on top of your keyboard are !@#$%^&*()_+|~\n"
encodedtext = b"""\
M5&AE('-Y;6)O;',@;VX@=&]P(&]F('EO=7(@:V5Y8F]A<F0@87)E("% (R0E
*7B8J*"E?*WQ^"... | brython-dev/brython | www/src/Lib/test/test_uu.py | Python | bsd-3-clause | 8,294 | 0.000844 |
""" Attention Factory
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
from functools import partial
from .bottleneck_attn import BottleneckAttn
from .cbam import CbamModule, LightCbamModule
from .eca import EcaModule, CecaModule
from .gather_excite import GatherExcite
from .global_context import Gl... | rwightman/pytorch-image-models | timm/models/layers/create_attn.py | Python | apache-2.0 | 3,526 | 0.002269 |
from django.conf.urls import patterns, include, url
from cover.views import CoverView
urlpatterns = patterns('cover.views',
url(r'^$', CoverView.as_view(), name='cover'),
)
| denever/discipline_terra | cover/urls.py | Python | gpl-2.0 | 198 | 0.005051 |
"""Implementations of commenting abstract base class searches."""
# pylint: disable=invalid-name
# Method names comply with OSID specification.
# pylint: disable=no-init
# Abstract classes do not define __init__.
# pylint: disable=too-few-public-methods
# Some interfaces are specified as 'markers' and inclu... | mitsei/dlkit | dlkit/abstract_osid/commenting/searches.py | Python | mit | 8,401 | 0.001309 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Github to Elastic class helper
#
# Copyright (C) 2015 Bitergia
#
# 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, o... | sanacl/GrimoireELK | grimoire/elk/github.py | Python | gpl-3.0 | 12,563 | 0.002468 |
from django.core.management.base import BaseCommand
from candidates.models import OrganizationExtra
class Command(BaseCommand):
def handle(self, *args, **options):
for party_extra in OrganizationExtra.objects \
.filter(base__classification='Party') \
.select_related('bas... | datamade/yournextmp-popit | candidates/management/commands/candidates_parties_with_multiple_emblems.py | Python | agpl-3.0 | 834 | 0 |
'''
Created on Dec 23, 2013
@author: Chris
'''
import sys
import wx
from gooey.gui.lang import i18n
from gooey.gui.message_event import EVT_MSG
class MessagePump(object):
def __init__(self):
# self.queue = queue
self.stdout = sys.stdout
# Overrides stdout's write method
def write(self, text):
... | lrq3000/pyFileFixity | pyFileFixity/lib/gooey/gui/windows/runtime_display_panel.py | Python | mit | 1,831 | 0.009285 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.