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
# threadlocals middleware try: from threading import local except ImportError: from django.utils._threading_local import local _thread_locals = local() def get_current_user(): return getattr(_thread_locals, 'user', None) def get_current_ip(): return getattr(_thread_locals, 'ip', None) class ThreadLo...
MehmetNuri/ozgurlukicin
middleware/threadlocals.py
Python
gpl-3.0
615
import flask import os import hashlib from infosystem import database from infosystem import request from infosystem import subsystem as subsystem_module from infosystem import scheduler POLICYLESS_ROUTES = [ ('POST', '/users/reset'), ('GET', '/users/<id>'), ('GET', '/users/routes') ] SYSADMIN_RESOURCES...
samueldmq/infosystem
infosystem/__init__.py
Python
apache-2.0
5,110
from Hogwash.Results import ResultsFile #type for file created by hw job from Hogwash.Action import Action #supertype for runnable objects from Hogwash.Errors import BadExitCode #error if the program crashed #get a job-specific name from Hogwash.Helpers import make_job_output_filename, get_cpu_bitness from waterworks.P...
pathak22/corr_clustering
correlation-distr/script/DistributedExperiment.py
Python
gpl-2.0
2,961
# Copyright 2011 OpenStack Foundation # 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 requ...
hplustree/trove
trove/common/wsgi.py
Python
apache-2.0
23,631
import random depth = 0 track = None pos = None result = 0 def EvaluateTree(track, pos, tree): global result setTrack(track) setPos(pos) result = 0 if not isinstance(tree, BaseNode): raise TypeError("Tree is not a BaseNode") try: tree.getResult(); except StepException: pa...
tb2johm/GeneticWalker
src/Nodes.py
Python
agpl-3.0
5,313
#prerequisites: none, just a range from 0-9 # Each number is from 0-9, when raised to the power of 5 #will produce a the same number as when all are put together def armstrong5(): print("These are the five digit Armstrong numbers:") for first in range (1, 10): for second in range (0, 10): f...
khoanguyen0791/cs170
CS170_homework/Armstrong.py
Python
apache-2.0
1,312
import sys import os import os.path import fnmatch import shutil import glob #------------------------------------------------------------------------------- # the main function # cd tools # python elxReplaceCopyrightNotice.py def main() : # The path to the source files relative to this script srcdir = os.pat...
kaspermarstal/SuperElastix
Tools/elxReplaceCopyrightNotice.py
Python
apache-2.0
3,468
# Copyright 2011 Brendan Kidwell <[email protected]>. # # This file is part of caliload. # # caliload 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 ...
bkidwell/caliload
caliload/metadata.py
Python
gpl-3.0
3,883
# -*- coding: utf-8 -*- """ Created on Mon Oct 10 23:58:35 2016 @author: Subhajit """ import numpy as np import scipy.io import h5py def load_matfile(filename='./data/indian_pines_data.mat'): f = h5py.File(filename) #print f['X_r'].shape if 'pca' in filename: X=np.asarray(f['X_r'...
Shashank00/testdata
prepData.py
Python
mit
784
__author__ = 'tobin' from otee.mouth.mouth import random_mouth
skyczhao/silver
AOTee/otee/mouth/__init__.py
Python
gpl-2.0
64
# -*- coding: utf-8 -*- from src import icons from src.actions import StashWorkflowAction, StashFilterableMenu, PROJECT_AVATAR_DIR, PULL_REQUESTS_OPEN_CACHE_KEY, \ UPDATE_INTERVAL_OPEN_PULL_REQUESTS, UPDATE_INTERVAL_MY_PULL_REQUESTS, UPDATE_INTERVAL_CREATED_PULL_REQUESTS, \ PULL_REQUESTS_REVIEW_CACHE_KEY, PULL_...
f440/alfred-stash-workflow
workflow/src/actions/pull_requests.py
Python
mit
4,218
# -*- coding: utf-8 -*- from dec2str import dec2str as d2s class Matrix(): def __init__(self, rows=[], cols=[]): self.totaltitle = 'Total' self.minsize = len(self.totaltitle) self.rows = rows self.cols = cols self.vals = {} # Totals self.trows = {} ...
tedlaz/pyted
functions/matrix.py
Python
gpl-3.0
4,582
# # Katello Repos actions # Copyright (c) 2012 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should...
iNecas/katello
cli/src/katello/client/core/package.py
Python
gpl-2.0
5,937
import json from flask_login import UserMixin, AnonymousUserMixin import hashlib import logging import os import threading import time import datetime import itertools from funcy import project import peewee from passlib.apps import custom_app_context as pwd_context from playhouse.postgres_ext import ArrayField, DateT...
olivetree123/redash-x
redash/models.py
Python
bsd-2-clause
36,856
import angr class InterlockedExchange(angr.SimProcedure): def run(self, target, value): #pylint:disable=arguments-differ if not self.state.solver.symbolic(target): old_value = self.state.memory.load(target, 4, endness=self.state.arch.memory_endness) self.state.memory.store(target, ...
angr/angr
angr/procedures/win32/InterlockedExchange.py
Python
bsd-2-clause
525
#!/usr/bin/python3 # -*- coding: utf-8 -*- from PySide.QtGui import QWidget, QBoxLayout, QFileDialog, QPushButton, QLabel, QFrame import os from correlate import correlate class MainWindow(QWidget, object): # noinspection PyUnresolvedReferences def __init__(self): super(MainWindow, self).__init__() ...
pinae/Audiosyncer
gui.py
Python
gpl-3.0
3,171
# (c) 2013, Daniel Hokka Zakrisson <[email protected]> # (c) 2014, Serge van Ginderachter <[email protected]> # # This file is part of Ansible # # Ansible 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, ...
j00bar/ansible
lib/ansible/inventory/dir.py
Python
gpl-3.0
13,251
# -*- coding: utf-8 -*- import unittest import inspect from structures.prefix_tree import TrieNode, PrefixTree class TrieNodeTest(unittest.TestCase): def test_insert(self): trie = TrieNode() values = ['amy', 'ann', 'emma', 'rob', 'roger'] for value in values: trie.insert(value...
prawn-cake/data_structures
structures/tests/test_prefix_tree.py
Python
mit
2,876
class Grids: """All Grid logic, including static (station), ship, and single block.""" def __init__(self, sbc_world_filename): # grids are in sbs # import Sbc # self.sbc = Sbc.Sbc(sbc_world_filename) pass def get(self): print('STUB') return False
mccorkle/seds-utils
Grids.py
Python
gpl-3.0
309
# -*- coding: utf-8 -*- mapping = ( "abvhgdezyijklmnoprstuf'ABVHGDEZYIJKLMNOPRSTUF'", "абвгґдезиійклмнопрстуфьАБВГҐДЕЗИІЙКЛМНОПРСТУФЬ", ) reversed_specific_mapping = ( "ьЬ", "''" ) pre_processor_mapping = { "ye": "є", "zh": "ж", "yi": "ї", "kh": "х", "ts": "ц", "ch": "ч", "s...
akosiaris/transliterate
src/transliterate/contrib/languages/uk/data/python32.py
Python
gpl-2.0
597
#!/usr/bin/python ############################################################################### # # This script produces state labels for all ionic states in MDAnalysis output # based on coordination integers and groups these according to a passed # regular expression. Though, the passed state_labels could be any num...
cing/ChannelAnalysis
ChannelAnalysis/CoordAnalysis/Grouping.py
Python
mit
9,522
import math import random #The Red Queen's dragon is trapped in a cage waiting for the day to kill Alice, who is supposed to bring the White Queen back in charge of Wonderland. You are Alice and preparing for the day when you can finally bring peace to Wonderland. You have 5 objects to choose from for the weapons you ...
hannah2306-cmis/hannah2306-cmis-cs2
conditionals.py
Python
cc0-1.0
6,999
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('core', '0006_matchrulesinline'), ] operations = [ migrations.AlterField( model_name='match', name='d...
LordNeodym/intranet
src/core/migrations/0007_auto_20150829_2047.py
Python
gpl-3.0
455
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 06/09/2015' import numpy as np class Label: def __init__(self, path): file_path = "{}labels.csv".format(path) try: data = np.genfromtxt(file_path, delimiter=',', skip_header=1, names=['timestamp'...
tonybeltramelli/Deep-Spying
server/analytics/modules/label/Label.py
Python
apache-2.0
725
import StringIO import socket import cv2 import numpy as np EMSG_ROBOT_NOT_FOUND = 'Could not connect to the robot at %s:%s' class EZBv4Video(object): # Default IP Address and Port for the JD Humanoid Robot. ConnectedEndPointAddress = '192.168.1.1' ConnectedEndPointPort = 24 Res160x120 ...
BrutusTT/pyJD
pyJD/pyEZB/EZBv4Video.py
Python
agpl-3.0
4,187
# SPDX-License-Identifier: GPL-2.0+ # Copyright 2018 Google, Inc # Written by Simon Glass <[email protected]> # # Holds and modifies the state information held by binman # import hashlib import re from dtoc import fdt import os from patman import tools from patman import tout # Records the device-tree files known to ...
CTSRD-CHERI/u-boot
tools/binman/state.py
Python
gpl-2.0
12,809
# 1222, Fri 18 Dec 2015 (NZDT) # # build-cpldns.py: makes pypy cpldns module # # Copyright (C) 2016 by Nevil Brownlee, U Auckland | WAND # # 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...
nevil-brownlee/pypy-libtrace
lib/pldns/build-cpldns.py
Python
gpl-3.0
3,848
# -*- coding: utf-8 -*- """ Type inference for NumPy binary ufuncs and their methods. """ from __future__ import print_function, division, absolute_import import numpy as np from numba import * from numba.minivect import minitypes from numba import typesystem from numba.type_inference.module_type_inference import (mo...
shiquanwang/numba
numba/type_inference/modules/numpyufuncs.py
Python
bsd-2-clause
7,943
# Authors: # Rob Crittenden <[email protected]> # # Copyright (C) 2009,2013 Red Hat # see file 'COPYING' for use and warranty information # # 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, e...
pspacek/freeipa
ipatests/test_xmlrpc/test_cert_plugin.py
Python
gpl-3.0
15,240
# Copyright (c) 2013 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
ChameleonCloud/blazar
blazar/plugins/dummy_vm_plugin.py
Python
apache-2.0
1,668
import os from ifaint import cmd_arg """Script be passed to Faint with --run by test-svg-suite.py. Requires that the type is passed with --arg as well, e.g. > Faint --run test-save.py --arg png """ outdir = os.path.join(os.getcwd(), 'out', 'suite', cmd_arg) active = get_active_image() filename = active.ge...
lukas-ke/faint-graphics-editor
py/test/faint_scripts/test-save-suite.py
Python
apache-2.0
572
# -*- coding: utf-8 -*- import string, os, re from random import choice from django.db import connection, transaction from django.conf import settings from django.core.mail import EmailMultiAlternatives def get_random_string(length=8, chars=string.letters + string.digits): return ''.join([choice(chars) for i in xr...
rokj/django_basketball
common/functions.py
Python
mit
4,465
from flask import current_app from elasticsearch import Elasticsearch class Elastic(object): """ A thin wrapper around elasticsearch.Elasticsearch() """ def __init__(self, app=None, **kwargs): if app is not None: self.init_app(app, **kwargs) def init_app(self, app,...
marceltschoppch/flask-elastic
flask_elastic.py
Python
mit
1,061
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2004-2011 Pexego Sistemas Informáticos. All Rights Reserved # $Omar Castiñeira Saavedra$ # # This program is free software: you can redistribute it and/or modify # it under the terms of t...
Pexego/sale_commission
__unported__/mrp_bom_formula/__openerp__.py
Python
agpl-3.0
1,607
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe import datetime from frappe.utils import formatdate, fmt_money, flt, cstr, cint, format_datetime, format_time, format_duration from frappe.model.meta import get_fiel...
saurabh6790/frappe
frappe/utils/formatters.py
Python
mit
3,202
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import time from odoo.tests.common import TransactionCase, Form from odoo.tools import mute_logger class TestSaleMrpProcurement(TransactionCase): def test_sale_mrp(self): warehouse0 = self.env.ref('stock....
maxive/erp
addons/sale_mrp/tests/test_sale_mrp_procurement.py
Python
agpl-3.0
2,492
#!/usr/bin/python # -*- coding: utf-8 -*- # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # this is a virtual module that is entirely implemented server side ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], ...
pilou-/ansible
lib/ansible/modules/windows/win_template.py
Python
gpl-3.0
5,199
"""Total Generalized Variation denoising using PDHG. Solves the optimization problem min_x ||x - d||_2^2 + alpha TGV_2(x) Where ``d`` is given noisy data TGV_2 is the second order total generalized variation of ``x``, defined as TGV_2(x) = min_y ||Gx - y||_1 + beta ||Ey||_1 where ``G`` is the spatial gradi...
kohr-h/odl
examples/solvers/pdhg_denoising_tgv.py
Python
mpl-2.0
4,074
import sys import pytest if __name__ == '__main__': # Exit with correct code sys.exit(pytest.main(["--pyargs", "pohmm.tests"] + sys.argv[1:]))
vmonaco/pohmm
pohmm/tests/__main__.py
Python
bsd-3-clause
153
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django_otp.util import two_factor.models class Migration(migrations.Migration): dependencies = [ ('two_factor', '0001_initial'), ] operations = [ migrations.AlterField( ...
mathspace/django-two-factor-auth
two_factor/migrations/0002_auto_20150110_0810.py
Python
mit
563
from bottle import route, run, template import pymongo from pymongo import MongoClient @route('/hello/<name>') def index(name): return template('<b>Hello {{name}}</b>!', name=name) @route('/hell') def index(): # Connect to database connection = MongoClient('localhost',27017) db = connection.test ...
nesterione/experiments-of-programming
MongoDB/Python/Week1/bottleframework/bottle_mongo.py
Python
apache-2.0
516
import json class BayonetError(Exception): """All errors related to making an API request extend this.""" def __init__(self, message=None, request_body=None, request_headers=None, http_response_code=None, http_response_message=None): super(BayonetError, self).__init_...
Bayonet-Client/bayonet-python
bayonet/exceptions.py
Python
mit
1,465
# Copyright 2016 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "GPLv3" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.html from PyQt5.QtWidgets import QFormLayout fro...
arsenetar/dupeguru
qt/pe/preferences_dialog.py
Python
gpl-3.0
4,332
""" ToolbarWidget :Authors: Berend Klein Haneveld """ import sys from PySide.QtGui import QWidget from PySide.QtGui import QLabel from PySide.QtGui import QHBoxLayout from PySide.QtGui import QToolButton from PySide.QtGui import QPushButton from PySide.QtGui import QMainWindow from PySide.QtGui import QFont from PySi...
berendkleinhaneveld/Registrationshop
ui/widgets/ToolbarWidget.py
Python
mit
5,515
################################################################################### # # Copyright (c) 2017-2019 MuK IT GmbH. # # This file is part of MuK Backend Theme # (see https://mukit.at). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesse...
muk-it/muk_web
muk_web_theme/__init__.py
Python
lgpl-3.0
1,428
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse, socket, json from sys import exit import sys from marcopolo.bindings import marco from marcopolo.marco_conf.utils import Node TIMEOUT = 4000 def main(args=None): parser = argparse.ArgumentParser(description="Discovery of MarcoPolo nodes in the subne...
Alternhuman/marcopolo-shell
marcopolo/utils/marcodiscover.py
Python
mpl-2.0
2,164
from south.db import db from django.db import models from cms.models import * import datetime class Migration: def forwards(self, orm): # Changing field 'Title.language' db.alter_column('cms_title', 'language', models.CharField(_("language"), max_length=5, db_index=True)) ...
emiquelito/django-cms-2.0
cms/migrations/0010_5char_language.py
Python
bsd-3-clause
7,237