code
stringlengths
3
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
3
1.05M
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('log', '0001_initial'), ] operations = [ migrations.AlterField( model_name='entry', name='avg_speed',...
L1NT/django-training-log
log/migrations/0002_auto_20151129_1307.py
Python
gpl-2.0
4,784
from api.service import ApiService from api.soap.message import WebServiceDocument from api.errors import ValidationError from api.utils import dict_search from lxml import etree from lxml.builder import ElementMaker from django.http import HttpResponse from namespaces import DEFAULT_NAMESPACES, SOAP_ENV, XSI from co...
allanlei/django-apipy
api/soap/service.py
Python
bsd-3-clause
3,873
#!/usr/bin/python3 """ Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and the length of both strings s and p will not be larger than 20,100. The order of output does not matter. """ from collections import Counter class ...
algorhythms/LeetCode
438 Find All Anagrams in a String.py
Python
mit
1,329
import asyncio import filecmp import logging import os import pickle import tempfile import warnings import re from asyncio import AbstractEventLoop from pathlib import Path from typing import ( Text, Any, Union, List, Type, Callable, TYPE_CHECKING, Pattern, ) from typing_extensions impo...
RasaHQ/rasa_nlu
rasa/utils/io.py
Python
apache-2.0
7,868
#!/usr/bin/env python # This file is part of MSMBuilder. # # Copyright 2011 Stanford University # # MSMBuilder 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 opt...
mpharrigan/msmbuilder
scripts/BuildMSM.py
Python
gpl-2.0
5,662
from PyQt4 import QtGui from PyQt4.QtGui import QInputDialog def askForConfirmation(parent, message): confirmationBox = QtGui.QMessageBox(parent=parent, text=message) confirmationBox.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) confirmationBox.setWindowTitle("File transfer") return...
nidzo732/FileTransfer
Python/dialogboxes.py
Python
gpl-2.0
734
from test import support from test.support import bigmemtest, _1G, _2G, _4G, precisionbigmemtest import unittest import operator import sys import functools # Bigmem testing houserules: # # - Try not to allocate too many large objects. It's okay to rely on # refcounting semantics, but don't forget that 's = creat...
mancoast/CPythonPyc_test
fail/312_test_bigmem.py
Python
gpl-3.0
41,777
import pygame from . import * class TutorialScene(BaseScene): def __init__(self, context): # Create scene and make transparent box over the 'x' BaseScene.__init__(self, context) self.btn = pygame.Surface((50,50), pygame.SRCALPHA, 32) self.btn.convert_alpha() context.screen.b...
theheckle/rapid-pie-movement
game/scenes/tutorial_scene.py
Python
mit
1,005
#!/usr/bin/env python import sys, getopt, argparse from kazoo.client import KazooClient import json def loadZookeeperOptions(opts,zk): node = "/all_clients/"+opts['client']+"/offline/semvec" if zk.exists(node): data, stat = zk.get(node) jStr = data.decode("utf-8") print "Found zookeeper...
Snazz2001/seldon-server
scripts/zookeeper/set-client-config.py
Python
apache-2.0
1,898
#! /usr/bin/python from __future__ import division from pytronica import * #adj = 0.1 #def osc(p): #def osc1(p): #return Saw(p2f(p)) #os = [osc1(p+x) for x in [0, 12.03, 7-.03]] #return Layer(os) a = .5 saw = lambda p: Saw(p2f(p)) osc = lambda p: Pan(saw(p), -a) + Pan(saw(p+.1), a) def synth(p): ...
chriswatrous/pytronica
songs/2.py
Python
gpl-2.0
390
# -*- coding: utf-8 -*- from setuptools import setup, find_packages import os import glob import sys #VERSION="2.1dev4" VERSION="2.6dev5" # Taken from kennethreitz/requests/setup.py package_directory = os.path.realpath(os.path.dirname(__file__)) def get_file_contents(file_path): """Get the context of the file u...
woddx/privacyidea
setup.py
Python
agpl-3.0
5,648
# -*- coding: iso-8859-15 -*- from xml.etree.ElementTree import * from descriptionparserxml import * from descriptionparserflatfile import * class DescriptionParserFactory: @classmethod def getParser(self, descParseInstruction): fp = open(descParseInstruction, 'r') tree = fromstring(fp.read()) fp.close(...
azumimuo/family-xbmc-addon
script.games.rom.collection.browser/resources/lib/pyscraper/descriptionparserfactory.py
Python
gpl-2.0
793
# The absolute import feature is required so that we get the root celery # module rather than `amo.celery`. from __future__ import absolute_import from collections import namedtuple from inspect import isclass from django.utils.translation import ugettext_lazy as _ __all__ = ('LOG', 'LOG_BY_ID', 'LOG_KEEP',) clas...
psiinon/addons-server
src/olympia/constants/activity.py
Python
bsd-3-clause
16,067
#!/usr/bin/env python # Unix SMB/CIFS implementation. # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008 # # 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 Lice...
wimberosa/samba
source4/scripting/python/samba/tests/core.py
Python
gpl-3.0
2,175
import array import struct import socket from odict import OrderedDict as OD class NLRI: def __init__(self, afi, safi, val): self.afi = afi self.safi = safi self.val = val def encode(self): return self.val class vpnv4(NLRI): def __init__(self, labels, rd, prefix): ...
plajjan/pybgp
pybgp/nlri.py
Python
mit
5,029
# -*- coding: utf-8 -*- # Copyright 2020 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...
googleads/google-ads-python
google/ads/googleads/v9/enums/types/device.py
Python
apache-2.0
1,200
# dialog.py -- Tkinter interface to the tk_dialog script. from tkinter import * from tkinter import _cnfmerge if TkVersion <= 3.6: DIALOG_ICON = 'warning' else: DIALOG_ICON = 'questhead' class Dialog(Widget): def __init__(self, master=None, cnf={}, **kw): cnf = _cnfmerge((cnf, kw)) self....
Microvellum/Fluid-Designer
win64-vc/2.78/python/lib/tkinter/dialog.py
Python
gpl-3.0
1,568
from model.contact import Contact from model.group import Group from fixture.orm import ORMFixture import random def test_del_contact_from_group(app): orm = ORMFixture(host="127.0.0.1", name="addressbook", user="root", password="") # check for existing any group if len(orm.get_group_list()) == 0: a...
Lana-Pa/Python-training
test/test_delete_contact_from_group.py
Python
apache-2.0
1,311
# Copyright (c) 2010-2012 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 or agree...
hbhdytf/mac
test/unit/common/ring/test_builder.py
Python
apache-2.0
100,538
import unittest, os from explainshell import manager, config, store, errors class test_manager(unittest.TestCase): def setUp(self): store.store('explainshell_tests').drop(True) def _getmanager(self, names, **kwargs): l = [] for n in names: l.append(os.path.join(config.MANP...
idank/explainshell
tests/test-manager.py
Python
gpl-3.0
4,940
from django.shortcuts import render from django.http import HttpResponse from django.views.generic.list import ListView from solrinspector import api as solr_api from getenv import env SOLR_URL = env("SOLR_URL", "http://localhost:8983/solr/") # Create your views here. def home(request): """docstring for home"""...
Brown-University-Library/django-inspectsolr
views.py
Python
mit
799
""" Embedded tweet plugin for Pelican ================================= This plugin allows you to embed Twitter tweets into your articles. And also provides a link for Twitter username. i.e. @username will be replaced by a link to Twitter username page. @username/status/tweetid ...
flurischt/pelican-embed-tweet
embed_tweet.py
Python
mit
1,037
"""Constants used in the test suite. """ SORTED_COUNTRIES = [ ("AF", "Afghanistan"), ("AX", "\xc5land Islands"), ("AL", "Albania"), ("DZ", "Algeria"), ("AS", "American Samoa"), ("AD", "Andorra"), ("AO", "Angola"), ("AI", "Anguilla"), ("AQ", "Antarctica"), ("AG", "Antigua and Barb...
edx/edx-platform
openedx/core/djangoapps/user_api/tests/test_constants.py
Python
agpl-3.0
6,648
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import projects.models class Migration(migrations.Migration): dependencies = [ ('robocrm', '0004_auto_20140912_1719'), ] operations = [ migrations.CreateModel( name='Proj...
sreidy/roboticsclub.org
projects/migrations/0001_initial.py
Python
mit
1,003
import os from os import path from getpass import getpass from .environment import env from .exceptions import InvalidPasswordError # make sure WindowsError is available import __builtin__ if not hasattr(__builtin__, 'WindowsError'): class WindowsError(OSError): pass try: # For testing replacement ro...
qris/mailer-dye
dye/tasklib/util.py
Python
gpl-3.0
4,469
""" OpenGapps Copy Files This takes the sources directory, folder and platform level as input, and produces to the standard output a FILE:system/FILE structure that will be used by the AOSP build system PRODUCT_COPY_FILES. """ import os import re import subprocess import sys def main(): """ Main """ ...
opengapps/aosp_build
core/copy_files.py
Python
gpl-3.0
1,852
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Балистический калькулятор import argparse import csv UtilName = 'Ballistic tool: Add bullet to bulletDB' __author__ = 'DarkHaisam' __version__ = '1.2 Beta' parser = argparse.ArgumentParser(description=UtilName + __version__) parser.add_argument('-m', '--metric', acti...
darkhaisam/ballistic
experemental/badd.py
Python
gpl-2.0
1,160
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import gn_flavor """Utils for running under Valgrind.""" class ValgrindFlavorUtils(gn_flavor.GNFlavorUtils): def __init__(self, m): super(Valgrind...
geminy/aidear
oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/third_party/skia/infra/bots/recipe_modules/flavor/valgrind_flavor.py
Python
gpl-3.0
895
# Copyright (C) 2017-2021 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information from django_js_reverse.views import urls_js from django.con...
SoftwareHeritage/swh-web-ui
swh/web/urls.py
Python
agpl-3.0
2,484
#!/usr/bin/env python from __future__ import print_function import sys import numpy import pni.io.nx.h5 as nexus f = nexus.create_file("test_string2.nxs",True); d = f.root().create_group("scan_1","NXentry").\ create_group("detector","NXdetector") sa= d.create_field("ListofStrings","string",shap...
pni-libraries/python-pni
doc/examples/old_examples/test_string2.py
Python
gpl-2.0
494
# -*- encoding: utf-8 -*- # # 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 ...
DataReplyUK/datareplyuk
GenesAssociation/spark-2.0.0-bin-hadoop2.7/python/pyspark/sql/tests.py
Python
apache-2.0
78,990
# This file is part of Archivematica. # # Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com> # # Archivematica 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 ...
michal-ruzicka/archivematica
src/dashboard/src/components/rights/ingest_urls.py
Python
agpl-3.0
1,151
# -*- coding:Utf-8 -*- ##################################################################### #This file is part of Network and RGPA. #PyLayers 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...
pylayers/pylayers
pylayers/network/model.py
Python
mit
7,416
class aMSNConfig: def __init__(self): self._config = {} def get_key(self, key, default = None): """ Get a existing config key or a default value in any other case. @type key: str @param key: name of the config key. @type default: Any @param default: d...
kakaroto/amsn2
amsn2/core/config.py
Python
gpl-2.0
797
# Copyright 2014-2015 0xc0170 # # 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,...
sg-/project_generator
project_generator/clean.py
Python
apache-2.0
1,182
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
amitdeutsch/oppia
core/domain/summary_services_test.py
Python
apache-2.0
5,280
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest from django.template import Context, Template class WebdesignTest(unittest.TestCase): def test_lorem_tag(self): t = Template("{% load webdesign %}{% lorem 3 w %}") self.assertEqual(t.render(Context({})), ...
doismellburning/django
django/contrib/webdesign/tests.py
Python
bsd-3-clause
355
from bloom_freqmap import BloomFreqMap from pybloomfilter import BloomFilter from time import time from numpy import inf, log from sklearn.metrics import f1_score from code import interact import sanity_naive_bayes class MultinomiamNaiveBayes(object): def __init__(self, base, alpha, initial_capacity, error_rate, ca...
AWNystrom/BloomML
multinomial_naive_bayes.py
Python
apache-2.0
5,066
import re import os.path import glob import tempfile import shutil # For backwards compatibility, remove in bright and shiny future. def detect_version(problemdir, problemtex): # Check for 0.1 - lack of \problemname if open(problemtex).read().find(r'\problemname') < 0: return '0.1' return '' # Cu...
Kattis/problemtools
problemtools/template.py
Python
mit
5,068
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-16 08:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('argus', '0012_argusadsl_lira'), ] operations = [ migrations.CreateModel( ...
dehu4ka/lna
argus/migrations/0013_client.py
Python
mit
1,537
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory # 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/...
hanlind/nova
nova/tests/unit/volume/encryptors/test_luks.py
Python
apache-2.0
10,988
import math from collections import defaultdict # calculate the entropy for options with the given probabilities # eg. for a fair coin, entropy([0.5,0.5]) = 1 def entropy(probabilities): entropy = 0 # entropy = sum[P*log2(P)] for P in probabilities: # log is undefined for non-positive numb...
pmansour/algorithms
machine-learning/ID3.py
Python
mit
9,495
from phystricks import * def SuiteInverseAlterne(): def suite(i): return SR((-1)**i)/i pspict,fig = SinglePicture("SuiteInverseAlterne") n=10 for i in range(1,n+1): P=Point(i,suite(i)) P.put_mark(0.3,(-1)**i*90,"$%s$"%(repr(suite(i))),automatic_place=pspict) pspict.DrawGraph(P) pspict.axes.no_graduation...
Naereen/mazhe
phystricksSuiteInverseAlterne.py
Python
gpl-3.0
414
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Event.description' db.add_column('rcal_event', 'description', self.gf(...
apollo13/django-rcal
rcal/migrations/0004_add_field_event_description.py
Python
bsd-3-clause
5,814
# -*- coding: utf-8 -*- ############################################################################################### # # MediaPortal for Dreambox OS # # Coded by MediaPortal Team (c) 2013-2015 # # This plugin is open source but it is NOT free software. # # This plugin may only be distributed to and executed...
n3wb13/OpenNfrGui-5.0-1
lib/python/Plugins/Extensions/MediaPortal/additions/grauzone/sharedir.py
Python
gpl-2.0
21,955
"""Base classes for multi-valued assignments in methodgraphs""" from method import Method, MethodGraph class MultiVariable: """For representing multi-valued variables """ def __init__(self, name=None): self.name = name def __repr__(self): return str(self) def __str__(self): ...
philetus/geosolver
geosolver/multimethod.py
Python
gpl-3.0
4,069
# 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 PerlTestMore(PerlPackage): """Test2 is a new testing framework produced by forking Test::B...
LLNL/spack
var/spack/repos/builtin/packages/perl-test-more/package.py
Python
lgpl-2.1
940
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (build by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
foosel/GitIssueBot
src/gitissuebot/_version.py
Python
agpl-3.0
7,318
"""Tests for the Entity Registry.""" import asyncio from unittest.mock import patch import asynctest import pytest from homeassistant.core import valid_entity_id, callback from homeassistant.helpers import entity_registry from tests.common import mock_registry, flush_store YAML__OPEN_PATH = "homeassistant.util.yam...
fbradyirl/home-assistant
tests/helpers/test_entity_registry.py
Python
apache-2.0
12,247
############################################################################## # 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...
krafczyk/spack
var/spack/repos/builtin/packages/r-xvector/package.py
Python
lgpl-2.1
1,870
## -*- coding: utf-8 -*- ## ## util.py ## ## Author: Toke Høiland-Jørgensen (toke@toke.dk) ## Date: 16 October 2012 ## Copyright (c) 2012, Toke Høiland-Jørgensen ## ## 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 ## th...
tohoanglinh/study_bufferbloat
p_bb_os_netperf_wrapper/netperf-wrapper/build/lib.linux-i686-2.7/netperf_wrapper/util.py
Python
gpl-3.0
7,125
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry import story class ToughPathRenderingCasesPage(page_module.Page): def RunPageInteractions(s...
danakj/chromium
tools/perf/page_sets/tough_path_rendering_cases.py
Python
bsd-3-clause
1,424
import os import sys import tempfile import unittest from datetime import date from copy import deepcopy from pyprint.ConsolePrinter import ConsolePrinter from coalib.output.ConfWriter import ConfWriter from coala_quickstart.coala_quickstart import _get_arg_parser from coala_quickstart.generation.Settings import writ...
MalkmusT/coala-quickstart
tests/generation/SettingsTest.py
Python
agpl-3.0
2,273
# Copyright 2016 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...
karllessard/tensorflow
tensorflow/python/tools/inspect_checkpoint.py
Python
apache-2.0
7,468
from django.db import models class ActiveManager(models.Manager): def get_query_set(self): return super(ActiveManager, self).get_query_set().filter(date_deleted__isnull=True)
guilleJB/fabric-bolt
src/fabric_bolt/projects/model_managers.py
Python
mit
188
# -*- 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 the GNU...
Johnzero/erp
openerp/addons/base_report_designer/installer.py
Python
agpl-3.0
3,097
import json import types from copy import copy import six from django import template from django.forms import CheckboxInput, CheckboxSelectMultiple, RadioSelect from django.utils.html import escapejs from django.utils.safestring import mark_safe from six.moves import range, zip from oioioi.contests.scores import Int...
sio2project/oioioi
oioioi/base/templatetags/simple_filters.py
Python
gpl-3.0
6,994
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from openerp.osv import fields, osv from openerp.tools.translate import _ #in this file, we mostly add the tag translate=True on existing fields that we now want to be translated class account_account_template(osv.os...
vileopratama/vitech
src/addons/l10n_multilang/account.py
Python
mit
2,364
#!/usr/bin/env python3 import os, re, sqlite3 from bs4 import BeautifulSoup, NavigableString, Tag import sys import os.path res_dir = sys.argv[1] doc_id = "gettext" db = sqlite3.connect("{}/docSet.dsidx".format(res_dir)) cur = db.cursor() try: cur.execute('DROP TABLE searchIndex;') except: pass cur.execute('CREATE ...
pekingduck/dash-tools
docsets/GNU_Gettext/gen_gettext_doc.py
Python
gpl-3.0
1,995
# -*- coding: UTF-8 -*- # Authors: Thomas Hartmann <thomas.hartmann@th-ht.de> # Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at> # # License: BSD (3-clause) import numpy as np from ..meas_info import create_info from ...transforms import rotation3d_align_z_axis from ...channels import DigMontage from ..constants imp...
adykstra/mne-python
mne/io/fieldtrip/utils.py
Python
bsd-3-clause
11,251
import murraylab_tools.biotek as mt_biotek import os gitexamplepath = "C:\\Users\\Andrey\\Documents\\GitHub\\"+\ "murraylab_tools\\examples\\biotek_examples\\" data_filename = gitexamplepath+\ "180515_big384wellplate.csv" supplementary_filename = gitexamplepath+\ "supp_in...
sclamons/murraylab_tools
examples/biotektests.py
Python
mit
999
BROKER_URL = 'redis://localhost:6379' # TODO: Save Celery Result to Backend CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend' # CELERY_RESULT_BACKEND = 'redis://localhost:6379' # In Debug Mode this value be setting true CELERY_ALWAYS_EAGER = True #celery setting from datetime import timedelta CELER...
texib/bitcoin-zoo
core/celeryconfig.py
Python
mit
772
# Get the length of a word or variable # Variable = a a = "LeonThiess" print(len(a)) print(len("Google"))
TechGenius32400/python3-help
Python3-Class1/basic-functions/len.py
Python
gpl-3.0
108
def __rope_start_everything(): import os import sys import socket import cPickle as pickle import marshal import inspect import types import threading class _MessageSender(object): def send_data(self, data): pass class _SocketSender(_MessageSender): ...
JetChars/vim
vim/bundle/python-mode/pymode/libs2/rope/base/oi/runmod.py
Python
apache-2.0
7,738
import numpy as np import math from nlputils import tokenize_text from itertools import repeat import numpy as np from scipy import spatial import json from tqdm import tqdm from pprint import pprint from operator import itemgetter import time num_docs = 0 def build_index(corpus): terms_list = {} start_time = time...
DigitalUSSouth/ExploreSC
exploresc-server/api2/index.py
Python
bsd-3-clause
3,858
#!/usr/bin/env python # coding: utf-8 from __future__ import print_function from __future__ import absolute_import import tct import sys # import copy import cgi import os import shutil import six params = tct.readjson(sys.argv[1]) facts = tct.readjson(params['factsfile']) milestones = tct.readjson(params['milestones...
marble/Toolchain_RenderDocumentation
30-If-success/02-Create-html-report/01-Create-html-file/run_01-Create-html-file.py
Python
mit
21,159
import json import os.path, sys from pahera.Utilities import DictFetchAll from pahera.Utilities import WritingToJson from django.db import connection, transaction from pahera.models import Person from pahera.PythonModules import CheckIfUserExists_mod # To get the user's existing details..!!! def getDetails(person): ...
thebachchaoproject/bachchao-server
pahera/PythonModules/UpdateUser.py
Python
mit
2,068
# Copyright DataStax, 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 writing, softwa...
datastax/python-driver
tests/integration/advanced/test_auth.py
Python
apache-2.0
23,152
#!/usr/bin/env python2.5 # -*- coding:utf-8 -*- """ AppStatsMiddleware adapted to Kay framework. :Copyright: (c) 2010 Ian Lewis <ianmlewis@gmail.com>, :license: BSD, see LICENSE for more details. """ from kay.conf import settings class AppStatsMiddleware(object): """ Middleware to enable appstats recording. ...
yosukesuzuki/calendar-app
project/kay/ext/appstats/middleware.py
Python
mit
1,467
from ckan.lib.cli import CkanCommand import ckanapi from ckanext.canada.metadata_schema import schema_description import csv from paste.script import command import org_commands __author__ = 'Statistics Canada' __copyright__ = "Copyright 2013, Government of Canada" __maintainer__ = "Ross Thompson" __license__ = "MIT" ...
thriuin/ckanext-utilities
ckanext/utilities/commands.py
Python
mit
7,608
from tkinter import * from tkinter import filedialog as fd from tkinter import messagebox import random f2p = [301,308,316,326,335,382,383,384,393,394] p2p = [302,303,304,305,306,307,309,310,311,312, 313,314,315,317,318,319,320,321,322,323,324, 327,328,329,330,331,332,333,334,336,338,339, 340,341,342,343,344,...
Tylersobored/MakeBat
CreateBat.py
Python
mit
19,415
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-01-24 19:35 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('subscriptions', '0001_initial'), ] operations = [ migrations.AlterModelOptio...
rtancman/eventex
eventex/subscriptions/migrations/0002_auto_20160124_1935.py
Python
gpl-2.0
1,572
#!/usr/bin/env python # encoding=utf-8 from django.contrib.gis.utils import LayerMapping from django.contrib.gis.gdal import DataSource from django.utils.encoding import smart_text, python_2_unicode_compatible from ..models import Location, Gadm, SiteLocation, LocationType # ./manage.py ogrinspect apps/locations/da...
system7-open-source/imamd
imam/locations/utils/load.py
Python
agpl-3.0
7,981
from haystack import indexes from models import Banca class BancaIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document = True, use_template=True) def get_model(self): return Banca def index_queryset(self): """Used when the entire index for model is...
agendaTCC/AgendaTCC
tccweb/apps/bancas/search_indexes.py
Python
gpl-2.0
378
import metacomm.combinatorics.all_pairs2 all_pairs = metacomm.combinatorics.all_pairs2.all_pairs2 """ Provided to make it easier to compare efficiency with other tools as per http://pairwise.org/tools.asp Current iutput is: 3^4: produces 9 rows 3^13: produces 17 rows 4^15 * 3^17 * 2^29: produces 37 rows...
bayandin/allpairs
examples/compare_to_others.py
Python
mit
1,209
# # Copyright 2014 Quantopian, 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 wr...
YuepengGuo/zipline
zipline/algorithm.py
Python
apache-2.0
50,333
#!/usr/bin/python import numpy as np from sklearn.metrics import mutual_info_score import MDAnalysis import os import re import math import sys from itertools import combinations_with_replacement,permutations from concurrent.futures import ProcessPoolExecutor, Future, wait usecpus = 10#how many cores to use frms_num ...
id4zs2008/blob-dyn
ca-multicore.py
Python
gpl-3.0
4,857
#!/usr/bin/python # Copyright (c) 2012 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # # This is a thin wrapper for native LD. This is not meant to be # used by the user, but is called from pnacl-translate. # This ...
cohortfsllc/cohort-cocl2-sandbox
pnacl/driver/nativeld.py
Python
bsd-3-clause
10,971
""" Helper functions for managing processes. """ from __future__ import print_function import sys import os import subprocess import signal import psutil def kill_process(proc): """ Kill the process `proc` created with `subprocess`. """ p1_group = psutil.Process(proc.pid) child_pids = p1_group.ge...
nanolearning/edx-platform
pavelib/utils/process.py
Python
agpl-3.0
1,828
import logging from django.contrib.sessions.backends.base import SessionBase, CreateError from django.core.exceptions import SuspiciousOperation from django.db import IntegrityError, transaction, router from django.utils import timezone from django.utils.encoding import force_text class SessionStore(SessionBase): ...
redhat-openstack/django
django/contrib/sessions/backends/db.py
Python
bsd-3-clause
2,973
import sys, os, re classes_ignore_list = ( 'OpenCV(Test)?Case', 'OpenCV(Test)?Runner', 'CvException', ) funcs_ignore_list = ( '\w+--HashCode', 'Mat--MatLong', '\w+--Equals', 'Core--MinMaxLocResult', ) class JavaParser: def __init__(self): self.clear() d...
petterreinholdtsen/cinelerra-hv
thirdparty/OpenCV-2.3.1/modules/java/check-tests.py
Python
gpl-2.0
5,677
n = int(raw_input()) ans = 0 for i in range(n): x1, y1, x2, y2 = map(int, raw_input().split()) ans += (x2 - x1 + 1) * (y2 - y1 + 1) print ans
Sarthak30/Codeforces
vanya_and_tables.py
Python
gpl-2.0
150
# Copyright 2012 James McCauley # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # POX is distri...
09zwcbupt/undergrad_thesis
pox/openflow/spanning_tree.py
Python
gpl-3.0
6,719
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import datetime from dateutil.relativedelta import relativedelta import pytz import unittest from odoo.tools import misc, date_utils from odoo.tests.common import TransactionCase, tagged @tagged('standard', 'at_instal...
t3dev/odoo
odoo/addons/base/tests/test_misc.py
Python
gpl-3.0
8,288
from layers.core import Layer from utils.theano_utils import shared_zeros import initializations class BatchNormalization(Layer): ''' Reference: Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift http://arxiv.org/pdf/1502.03167v3.pdf ...
nagadomi/keras
layers/normalization.py
Python
mit
949
#!/usr/bin/python import json f = file('treasures.json', 'r') try: foo = json.load(f) json_contents = foo except ValueError: json_contents = dict() f.close() print 'Type \'q\' to [q]uit' while True: name = raw_input('Treasure Name: ') if name == 'q': break print 'Type \'n\' to stop e...
mosbasik/dotatreasures
create_treasures_json.py
Python
mit
794
from ray.rllib.utils.deprecation import deprecation_warning deprecation_warning( old="ray/rllib/examples/recsim_with_slateq.py", new="ray/rllib/examples/recommender_system_with_recsim_and_slateq.py", error=True, )
ray-project/ray
rllib/examples/recsim_with_slateq.py
Python
apache-2.0
227
# coding=utf-8 import logging module_logger = logging.getLogger("pyrst.client") module_logger.setLevel(logging.DEBUG) class PyrstException(Exception): """ Generic, abstract class of exception. """ def __init__(self): self.logger = logging.getLogger("pyrst.client") self.logger.warning...
chrisvoncsefalvay/pyrst
pyrst/exceptions.py
Python
apache-2.0
1,947
#!/usr/bin/env python import pylibftdi def runner_serial(func): """ Decorator for functions that take a serial number as the first argument, possibly with other arguments to follow """ def inner(): import sys args = sys.argv if len(args)>1: serial = args[1] else: serial = None ...
weinshec/pyAPT
scripts/runner.py
Python
mit
790
#!/usr/bin/env python3 #-*- coding: utf-8 -*- ##This software is available to you under the terms of the GPL-3, see "/usr/share/common-licenses/GPL-3". ##Copyright: ##- Tomasz Makarewicz (makson96@gmail.com) import os, tarfile, urllib.request, time, shutil from subprocess import Popen, PIPE recultis_dir = os.getenv(...
makson96/Recultis
tools/steam.py
Python
gpl-3.0
8,550
import unittest from fem import QuadFE class TestFiniteElement(unittest.TestCase): """ Test FiniteElement class """ def test_cell_type(self): for etype in ['Q1','Q2','Q3']: element = QuadFE(2,etype) t = element.cell_type() self.assertEqual(t,'quadrilateral',...
hvanwyk/quadmesh
tests/test_fem/test_finite_element.py
Python
mit
353
# -*- coding: utf-8 -*- # polkit_agent.py # Copyright (C) 2013 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # ...
leapcode/bitmask-dev
src/leap/bitmask/vpn/polkit.py
Python
gpl-3.0
2,160
import sys sys.path.insert(1,"../../") import h2o from tests import pyunit_utils def headers(): headers = h2o.import_file(pyunit_utils.locate("smalldata/airlines/allyears2k_headers_only.csv")) headers_and = h2o.import_file(pyunit_utils.locate("smalldata/airlines/allyears2k.zip")) headers_and....
madmax983/h2o-3
h2o-py/tests/testdir_misc/pyunit_headers.py
Python
apache-2.0
641
# Copyright (C) Ivan Kravets <me@ikravets.com> # See LICENSE for details. import atexit import re from os import getenv, listdir, remove, sep, walk from os.path import basename, dirname, isdir, isfile, join, normpath from SCons.Script import Exit, SConscript, SConscriptChdir from SCons.Util import case_sensitive_suff...
awong1900/platformio
platformio/builder/tools/platformio.py
Python
mit
10,278
# test_repo.py # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php from git.test.lib import ( patch, TestBase, with_rw_repo, fixture, assert_false...
avinassh/GitPython
git/test/test_repo.py
Python
bsd-3-clause
27,790
#!/bin/env python3 # -*- coding: utf-8 -*- """ This is a scraper for the Austrian Lobbying-Register. It fetches the HTML, saves it locally and converts the relevant data into a json file. """ import re from datetime import datetime, date import time import json import os import urllib.request from bs4 import Beautifu...
OKFNat/lobbyscraper
code/lobbyscraper.py
Python
mit
19,855
#! /usr/bin/env python # -*- coding: utf-8 -*- ########### DESCRIPTION ############ ## Ce script (qui n'est pas utilisé par l'UI) sert à calculer les impôts dûs par les différentes combinaisons ## de foyers fiscaux quand les jeunes adultes ont le choix d'être rattachés au foyer fiscal de leurs parents ## Il prend en e...
SophieIPP/openfisca-france
openfisca_france/scripts/rattachement.py
Python
agpl-3.0
5,128
from __future__ import unicode_literals from django.test import TestCase from django.utils import six from .models import (Building, Child, Device, Port, Item, Country, Connection, ClientStatus, State, Client, SpecialClient, TUser, Person, Student, Organizer, Class, Enrollment, Hen, Chick, A, B, C) class Se...
webostin/django-btc
tests/select_related_regress/tests.py
Python
bsd-3-clause
9,397
from __future__ import division import twitter_auth #calling the Twitter auth module def get_details(twitter_handle): # Get the User object for twitter... user = twitter_auth.api.get_user(twitter_handle) #Calculating the followers vs following ratio ff_ratio = round(int(user.followers_count) / int(user.friends_co...
ajotwani/alfred-show-me-the-klout
development/get_twitter_details.py
Python
mit
452
# -*- coding: utf-8 -*- # Scrapy settings for MYZXcrawler project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # http://doc.scrapy.org/en/latest/topics/settings.html # http://scrapy.readthedocs.org/en/la...
jeffreyzzh/MYZXcrawler
MYZXcrawler/MYZXcrawler/settings.py
Python
mit
18,797