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 |
|---|---|---|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2014 Anke Boersma <demm@kaosx.us>
# SPDX-FileCopyrightText: 2015 Philip Müller <philm@manjaro.org>
# SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
# SPDX-FileC... | calamares/calamares | src/modules/localecfg/main.py | Python | gpl-3.0 | 6,225 |
# Copyright 2019 The TensorNetwork Authors
#
# 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 ... | google/TensorNetwork | tensornetwork/block_sparse/sizetypes.py | Python | apache-2.0 | 660 |
'''
Utilities for contentstore tests
'''
import json
import textwrap
from mock import Mock
from django.conf import settings
from django.contrib.auth.models import User
from django.test.client import Client
from opaque_keys.edx.locations import SlashSeparatedCourseKey, AssetLocation
from contentstore.utils import reve... | nttks/edx-platform | cms/djangoapps/contentstore/tests/utils.py | Python | agpl-3.0 | 18,146 |
#!/usr/bin/env python
# encoding: utf-8
"""
ransom-note.py
Created by Shuailong on 2016-09-01.
https://leetcode.com/problems/ransom-note/.
"""
# 217ms
from collections import Counter
class Solution(object):
def canConstruct(self, ransomNote, magazine):
"""
:type ransomNote: str
:type... | Shuailong/Leetcode | solutions/ransom-note.py | Python | mit | 752 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views import defaults as default_views
from django.views.generic import TemplateView
from re... | D3vSt0rm/sahem | config/urls.py | Python | mit | 3,329 |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function, unicode_literals)
from flask import Flask, Blueprint, current_app, url_for
from flask.ext.restless import APIManager
import types
from greidinet.model import *
restapi = APIManager()
# Dynamically bind create_apis() method to t... | juusokorhonen/greidinet | greidinet/restapi/__init__.py | Python | mit | 745 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import os
import sys
import numpy as np
#from tqdm import tqdm
import fnmatch
import argparse
import logging
logger = logging.getLogger(os.path.basename(sys.argv[0]))
def main(argv):
def formatter(prog):
return argparse.HelpFormatter(prog, max... | uclmr/inferbeddings | tools/parse_results_countries.py | Python | mit | 5,035 |
# Copyright (C) 2008 The Android Open Source Project
#
# 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 ... | 1379266135/git-repo | project.py | Python | apache-2.0 | 83,899 |
from core import ungzip
from core import ungzip_html
| mutarock/python-utils | compress/__init__.py | Python | mit | 53 |
"""
WSGI config for pelawak project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import Django... | mclumd/pelawak | pelawak/wsgi.py | Python | mit | 482 |
# coding=utf8
import json
from datetime import date, timedelta, datetime, time
from attivita.stats import statistiche_attivita_persona
from django.db.models import Count, F, Sum
from django.utils import timezone
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.shortcuts import red... | CroceRossaItaliana/jorvik | attivita/viste.py | Python | gpl-3.0 | 33,384 |
import pytest
import numpy as np
import os
import sys
import tempfile
from shutil import rmtree
from pyCGM_Single.pyCGM_Helpers import getfilenames
from pyCGM_Single.pycgmCalc import calcAngles, calcKinetics
from pyCGM_Single.pycgmIO import dataAsDict, loadData, loadVSK, writeResult
from pyCGM_Single.pycgmStatic import... | cadop/pyCGM | pyCGM_Single/tests/test_csvOutput.py | Python | mit | 15,746 |
# pylint: disable=no-member
from collections import Counter
from CommonServerUserPython import *
from CommonServerPython import *
from sklearn.feature_extraction.text import TfidfVectorizer
import pickle
import uuid
import spacy
import string
from html.parser import HTMLParser
from html import unescape
from re import c... | VirusTotal/content | Packs/Base/Scripts/DBotPreprocessTextData/DBotPreprocessTextData.py | Python | mit | 19,856 |
#!python
"""Computes mean of amino-acid preferences or differential preferences.
Written by Jesse Bloom.
"""
import sys
import os
import math
import time
import mapmuts
import mapmuts.io
import mapmuts.sequtils
import mapmuts.bayesian
def Entropy(pi_mean):
"""Computes site entropy in bits from array of proba... | jbloom/mapmuts | scripts/mapmuts_preferencemeans.py | Python | gpl-3.0 | 5,798 |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | mk270/iatidq_ui | iatidataquality/surveys.py | Python | agpl-3.0 | 13,490 |
import numpy as np
import geopy
from io import BytesIO
from matplotlib import image as img
import requests
class Map(object):
def __init__(self, lat, long, satellite=True,
zoom=10, size=(400,400), sensor=False):
base="http://maps.googleapis.com/maps/api/staticmap?"
params=dict(
... | jscott6/greengraph | greengraph/map.py | Python | mit | 1,522 |
import os
import jinja2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True
)
TRIPIT_USERNAME = 'yourmail'
TRIPIT_PASSWORD = 'yourpassword' | mcascallares/hand-luggage | config.py | Python | apache-2.0 | 256 |
# 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/IEC61970/SCADA/RemoteControl.py | Python | mit | 3,097 |
#!/usr/bin/python
import numpy as np
import pylab as plt
import seaborn as sns
sns.set_context("poster")
#with open("traj.dat") as f:
# data = f.read()
#
# data = data.split('\n')
#
# x = [row.split(' ')[0] for row in data]
# y = [row.split(' ')[1] for row in data]
#
# fig = plt.figure()
#
# ax1 = f... | binghongcha08/pyQMD | GWP/QTGB/resample/traj.py | Python | gpl-3.0 | 1,297 |
# -*- coding: utf-8 -*-
# test basic sqlite interactions
# based on http://qiita.com/mas9612/items/a881e9f14d20ee1c0703
# cf also https://docs.python.org/3/library/sqlite3.html
import sqlite3
dbname = "sqlite-dbs/yktest.sqlite3"
conn = sqlite3.connect(dbname)
conn.row_factory = sqlite3.Row
c = conn.cursor()
# drop... | yk0242/incubation | incubation-python/sqlite/sqlite-test1.py | Python | mit | 1,572 |
#!env /usr/bin/python3
import sys
import urllib.parse
import urllib.request
def main():
search = sys.argv[1]
url = 'http://rarbg.to/torrents.php?order=seeders&by=DESC&search='
url = url + search
print(url)
req = urllib.request.Request(url, headers={'User-Agent' : "Magic Browser"})
resp = urlli... | jadams/rarbg-get | rarbg-get.py | Python | mit | 409 |
from django.http import HttpResponse, HttpResponseRedirect
from django.views.decorators.http import require_GET
import requests
import json
from models import PdfFile, MediaFile
from annoying.decorators import render_to
from os.path import join
from django.conf import settings
@render_to('router/index.html')
def index... | elifesciences/elife-api | src/router/views.py | Python | gpl-3.0 | 4,870 |
"""
sentry.utils.samples
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import os.path
import random
from datetime import datetime, timedelta
import six
from sentry.constants import D... | jean/sentry | src/sentry/utils/samples.py | Python | bsd-3-clause | 5,584 |
#!/usr/bin/env python
import roslib
roslib.load_manifest('turtle_mix')
import rospy
import tf
import turtlesim.msg
def handle_turtle_pose(msg, turtlename):
br = tf.TransformBroadcaster()
br.sendTransform((msg.x, msg.y, 0),
tf.transformations.quaternion_from_euler(0, 0, msg.theta),
... | vuhpham/turtle_mix | scripts/turtle_broadcaster.py | Python | bsd-3-clause | 742 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from pybloom import ScalableBloomFilter
from scrapy.exceptions import DropItem
from scrapy_redis.pipelines import RedisPipeline
... | yangxue088/wish | pipelines.py | Python | mit | 883 |
import collections
# this will generate the emulator .s file
####### HELPERS/OPCODE HELPERS ##########################################
# given a string, inserts macros or format values from the 'override' definition, aligns comments
# returns new string
def format(string, **override):
formatDict = dict(_macros, *... | ant6n/femu | source/genemu.py | Python | gpl-2.0 | 20,025 |
"""
This file is part of geneticmonkeys.
Copyright (C) 2016 Yazan Obeidi
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) ... | yazanobeidi/geneticmonkeys | geneticmonkeys/evolution/__init__.py | Python | gpl-3.0 | 959 |
def make_header(**attrs):
return """graph G {
forcelabels=false;
node [label="", shape=plaintext];
""" + '\n'.join('%s="%s";' % (k, v) for (k, v) in attrs.items())
footer = "}"
def node_string(node, **kwargs):
if 'fontsize' not in kwargs:
kwargs = kwargs.copy()
kwargs['fontsize'] =... | dpfried/mocs | lib/write_dot.py | Python | mit | 3,901 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group.py | Python | mit | 1,777 |
# -*- coding: utf-8 -*-
#
# Copyright 2015 Simone Campagna
#
# 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... | simone-campagna/daikon | zirkon/toolbox/argparser.py | Python | apache-2.0 | 12,587 |
import os
import json
import subprocess
from abc import ABCMeta, abstractmethod
class Task:
__metaclass__ = ABCMeta
def __init__(self, structure, task_params=None, workdir='.', executable=None):
self.structure = structure
self.workdir = workdir
if not os.path.isdir(self.workdir):
... | MaterialsDiscovery/PyChemia | pychemia/code/tasks.py | Python | mit | 2,543 |
#!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
import os
import numpy as np
import matplotlib.pyplot as plt
from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile
fileName = 'fluid/forces/0/forces.dat'
liftList = []
dragList = []
controlDict = ParsedParameterFile( 'fluid/system/cont... | eterhofstede/FOAM-FSI | tutorials/fsi/cylinderFlap_FSI3/postprocess.py | Python | gpl-2.0 | 2,375 |
# -*- Mode: Python; py-indent-offset: 4 -*-
# this file contains code for loading up an override file. The override file
# provides implementations of functions where the code generator could not
# do its job correctly.
import fnmatch
import os
import re
import string
import sys
def class2cname(klass, method):
... | alessandrod/gst-rtsputils-python | rtsputils/codegen/override.py | Python | gpl-3.0 | 9,313 |
"""
KeepNote
Listener (Observer) pattern
"""
#
# KeepNote
# Copyright (c) 2008-2009 Matt Rasmussen
# Author: Matt Rasmussen <rasmus@alum.mit.edu>
#
# 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 Softw... | brotchie/keepnote | keepnote/listening.py | Python | gpl-2.0 | 2,204 |
def format_date(dt):
return dt.strftime('%Y-%m-%d %H:%M:%S')
| aabed/mhn | server/mhn/common/templatetags.py | Python | lgpl-2.1 | 65 |
#!/usr/bin/env python
import sys
import os
import subprocess
message = '!log {user} {sudo_user}: Deployed {rev} {msg}'.format(
user=os.environ['USER'],
sudo_user=os.environ['SUDO_USER'],
rev=subprocess.check_output(["git", "rev-list", "HEAD",
"--max-count=1", "--format=onel... | wikimedia/labs-tools-wikibugs2 | log_to_irc.py | Python | mit | 434 |
# -*- coding:utf-8 -*-
from nsnqtlib.strategies.strategy import basestrategy
import pandas as pd
import tushare as ts
class privatestrategy(basestrategy):
'''
重写买入条件和卖出条件,
'''
def __init__(self,startdate=(2011, 1, 1),enddate=[],emafast=12,emaslow=26,demday=9):
self.pre_MA = False
... | harry0519/nsnqt | nsnqtlib/strategies/privatestrategy.py | Python | bsd-2-clause | 11,881 |
# -*- coding: utf-8 -*-
#
# 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
... | zack3241/incubator-airflow | airflow/contrib/hooks/redshift_hook.py | Python | apache-2.0 | 4,181 |
# Resolver Library of Universal Mathematics System
# Copyright (C) 2016 Zhang Chang-kai #
# Contact via: phy.zhangck@gmail.com #
# General Public License version 3.0 #
'''Resolver Library of UnivMaths System'''
class Formulation(object):
'''Formula Information for Resolver'''
__slots__ = ('For... | Phy-David-Zhang/UnivMathSys | Interpreter/rslvlib.py | Python | gpl-3.0 | 1,725 |
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
Read metadata from RAR archives
'''
import os
from calibre.ptempfile import PersistentTemporaryFile, TemporaryDirectory
from calibre.libunrar import extract_member, names... | yeyanchao/calibre | src/calibre/ebooks/metadata/rar.py | Python | gpl-3.0 | 1,451 |
# Copyright 2013 Sascha Peilicke
# Copyright 2016 Thomas Bechtold
#
# 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 appli... | toabctl/py2pack | py2pack/setup.py | Python | apache-2.0 | 2,578 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-08-26 19:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('studygroups', '0096_delete_activity'),
]
operations = [
migrations.AddField... | p2pu/learning-circles | studygroups/migrations/0097_profile_reason_for_registration.py | Python | mit | 596 |
# Copyright (C) 2006, Red Hat, Inc.
# Copyright (C) 2007, One Laptop Per Child
# Copyright (C) 2009, Luke Kenneth Casson Leighton <lkcl@lkcl.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation... | certik/pyjamas | pyjd/hula.py | Python | apache-2.0 | 7,643 |
"""
Utilities for collecting and exporting group constants from a
branching file
"""
from itertools import product
from warnings import warn
from collections.abc import Iterable
from numpy import empty, nan, array, ndarray
from serpentTools import BranchingReader
__all__ = [
'BranchCollector',
'BranchedUniv... | CORE-GATECH-GROUP/serpent-tools | serpentTools/xs.py | Python | mit | 19,877 |
#!/usr/bin/python
import sys,os
from math import sqrt
from copy import deepcopy
import json, pickle, cPickle
import os
import shutil
from advprint import AdvPrint
from info import Info
from process import Process
from detectorsettings import DetectorSettings
from evaluator import Evaluator, find_strongest_evaluators, ... | HEPcodes/CheckMATE | tools/python/checkmate_core.py | Python | gpl-2.0 | 17,387 |
from flask import Flask
from flask_bootstrap import Bootstrap
from flask import render_template
import bootstrap
import xmlrpclib
from io import BytesIO
import base64
app = Flask(__name__)
import xmlrpclib
username = 'username' #the user
pwd = 'password' #the password of the user
dbname = 'ctpug' #the databa... | c-goosen/ctpug_11_july | flask/__init__.py | Python | cc0-1.0 | 4,174 |
import numpy as np
def Cov(xs, ys, meanx=None, meany=None):
'''mid compute covariance of xs and ys'''
xs = np.asarray(xs)
ys = np.asarray(ys)
if meanx is None:
meanx = np.mean(xs)
if meany is None:
meany = np.mean(ys)
cov = np.dot(xs-meanx, ys-meany) / len(xs)
return cov
| UpSea/midProjects | BasicOperations/09_NumPy/02_Numpy_02_covariance.py | Python | mit | 318 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import sys
def searchIndex(f):
fname = f.split('_')[-3]
if fname[:3] == 'L00':
# os.system("gunzip -c %s | sed -n '/@ST-E00244/p' | awk -F \":\" '{print $10}' > Undetermined_Index" % f) ##ymkd
os.system("gunzip -c %s | sed -n '/@ST-E00169/p' ... | longrw/mypython | Undetermined_Index_top20.py | Python | gpl-3.0 | 1,284 |
#! /usr/bin/python3
import re
err = "La contraseña no es segura"
msg = "Escriba una contraseña al menos 8 caracteres alfanumericos"
def ismayor8(a):
"""
Compara si es mayor a 8 caracteres
"""
if (len(a) < 8):
return False
return True
def minus(a):
"""
compara si existe alguna le... | IntelBUAP/Python3 | Evaluaciones/tuxes/eva2/validapass.py | Python | gpl-2.0 | 1,660 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | adaitche/luigi | test/contrib/hadoop_test.py | Python | apache-2.0 | 18,230 |
"""
The Chute Builder interprets the chute specification, which comes from a
paradrop.yaml file or from a JSON object via a cloud update. The Chute
Builder then produces a valid Chute ojbect with one or more Service
objects.
There are different versions of the chute specification in code
repositories, and so the inten... | ParadropLabs/Paradrop | paradrop/daemon/paradrop/core/chute/builder.py | Python | apache-2.0 | 8,996 |
import pika
import yaml
import threading
import sys
# The topic to which service instantiation requests
# of the GK are published
SERVICE_CREATE_TOPIC = 'service.instances.create'
# The topic to which available vims are published
INFRA_ADAPTOR_AVAILABLE_VIMS = 'infrastructure.management.compute.list'
# The topic to wh... | sonata-nfv/son-tests | int-slm-repositories/scripts/gk_ia_simulator.py | Python | apache-2.0 | 6,651 |
#
# Copyright 2001 - 2016 Ludek Smid [http://www.ospace.net/]
#
# This file is part of Outer Space.
#
# Outer Space 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
# (... | ospaceteam/outerspace | server/lib/igeclient/IClient.py | Python | gpl-2.0 | 13,106 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import sys
import tarfile
import zipfile
import funciones
ruta = funciones.CreaDirectorioTrabajo()
def main():
FicheroZip = '%s\\github.zip'%ruta
funciones.BoraFichero(FicheroZip)
zf = zipfile.ZipFile(FicheroZip, mode='a')
lista = glob.glob("%s\\*.git... | procamora/Testeador-de-Red | Compresion.py | Python | gpl-3.0 | 1,264 |
'''
* @author [Zizhao Zhang]
* @email [zizhao@cise.ufl.edu]
* @create date 2017-05-25 02:20:32
* @modify date 2017-05-25 02:20:32
* @desc [description]
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import os, sys
import num... | zizhaozhang/unet-tensorflow-keras | eval.py | Python | mit | 2,521 |
# Python Calculator
print " _____ _ _ _ " #Unnecessary but cool ASCII art.
print " / ____| | | | | | | "
print "| | __ _| | ___ _ _| | __ _| |_ ___ _ __ "
print "| | / _` | |/ __| | | | |/ _` | __/ _ \| '__|"
print "| |___| (_| | | (__| |_| | | (_... | ErikB97/Simple-Calculator | calculator.py | Python | mit | 1,698 |
# Copyright 2019, The TensorFlow Authors.
#
# 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 t... | tensorflow/privacy | tensorflow_privacy/privacy/bolt_on/optimizers.py | Python | apache-2.0 | 14,094 |
#!/usr/bin/env python
# vim: sw=2 ts=2
import click
import os
import sys
hexboard_sizes = ['tiny', 'xsmall', 'small', 'medium', 'large', 'xlarge']
@click.command()
### Cluster options
@click.option('--cluster-id', default='demo', show_default=True,
help='Cluster identifier (used for prefixing/naming v... | thoraxe/demo-ansible | run.py | Python | apache-2.0 | 12,962 |
import os
from cffi import FFI
ffi = FFI()
ffi.cdef("""
// Original source could be found here:
// https://github.com/krb5/krb5/blob/master/src/lib/gssapi/generic/gssapi.hin
typedef uint32_t gss_uint32;
typedef gss_uint32 OM_uint32;
typedef struct gss_OID_desc_struct {
OM_uint32 length;
void *el... | GitHubFriction/pywinrm | winrm/tests/kerberos/test_cffi_mini.py | Python | mit | 8,021 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-07 23:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cocomapapp', '0005_auto_20161203_2224'),
]
operations = [
migrations.AddFie... | bounswe/bounswe2016group11 | cocomapapp/migrations/0006_tag_hidden.py | Python | apache-2.0 | 452 |
import os
import signal
import sys
import time
import subprocess
import wx
import wx.stc as stc
import re
import Queue
from sim_doc_base import DocBase
import sim_doc_lexer as doc_lexer
#test_cmd = {"break 30\n", "break 40\n", "run\n", "continue\n",
# "step\n", "step\n", "step\n", "step\n", "step\n", "step\n"... | athenajc/XideSDCC | ide/sim/sim_doc.py | Python | gpl-2.0 | 2,983 |
import dicom.UID
import dicom.dataset
import requests
import requests_toolbelt
import datetime
import numpy as np
import time
from PIL import Image
import math
import uuid
import os
def load_img(in_img):
img = Image.open(in_img)
scale_factor = math.ceil(img.height/256)
img=img.convert('RGB').resize((img.wi... | ImExHS/hackathon2017 | store_img.py | Python | mit | 3,319 |
#!/usr/bin/python
# coding=utf-8
# region License
# Findeco is dually licensed under GPLv3 or later and MPLv2.
#
################################################################################
# Copyright (c) 2012 Klaus Greff <klaus.greff@gmx.net>
# This file is part of Findeco.
#
# Findeco is free software; you can r... | Qwlouse/Findeco | findeco/tests/test_load_text.py | Python | gpl-3.0 | 9,903 |
from django.contrib import admin
from django import forms
from django.utils.translation import ugettext_lazy as _
from ovp_projects.models import Work
class WorkAdmin(admin.ModelAdmin):
fields = [
('id', 'project'),
'weekly_hours',
'description',
'can_be_done_remotely',
]
list_display = [
'id',... | OpenVolunteeringPlatform/django-ovp-projects | ovp_projects/admin/work.py | Python | agpl-3.0 | 654 |
# coding=utf-8
# Copyright 2021 RLDSCreator Authors.
#
# 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 o... | google-research/rlds-creator | rlds_creator/environment_handler_test.py | Python | apache-2.0 | 42,579 |
# -*- coding: UTF-8 -*-
# (c) 2013, Ovais Tariq <ovaistariq@gmail.com>
#
# This file is part of mha-helper
#
# 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
#... | wubx/mha-helper | scripts/lib/email_helper.py | Python | gpl-3.0 | 2,117 |
import socket
import urlparse
import struct
import simplejson
import select
import errno
class TimeoutError(Exception):
pass
class ClosedError(Exception):
pass
class LocalyClosedError(ClosedError):
pass
class RemotelyClosedError(ClosedError):
pass
class Transport:
_HEADER = "!I"
_SAFE_... | noam-stratoscale/rackattack-api | py/rackattack/tcp/transport.py | Python | apache-2.0 | 2,624 |
# -*- coding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
STOP_RENDERING = runtime.STOP_RENDERING
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1443802885.9030464
_enable_loop = True
_template_filename = 'themes/monospace/templates/index.tmpl... | wcmckee/moejobs-site | cache/.mako.tmp/index.tmpl.py | Python | mit | 5,332 |
default_app_config = 'apps.authentication.appconfig.AuthenticationConfig'
| dotKom/onlineweb4 | apps/authentication/__init__.py | Python | mit | 74 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import strfile
import wx
import sys, os
import locale, gettext
from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin
class TransDictListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin):
"""ListCtrl for a translation dictionary"""
def __init__(self, parent):
wx.ListCtrl.... | kch42/dotstr_edit | dotstr_edit.py | Python | mit | 15,425 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2013, Dylan Martin <dmartin@seattlecentral.edu>
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
# (c) 2016, Dag Wieers <dag@wieers.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redist... | mkrupcale/ansible | lib/ansible/modules/files/unarchive.py | Python | gpl-3.0 | 34,616 |
import os
def job_dir(settings):
path = settings['JOBDIR']
if path and not os.path.exists(path):
os.makedirs(path)
return path
| bdh1011/wau | venv/lib/python2.7/site-packages/scrapy/utils/job.py | Python | mit | 148 |
import datetime
from combine import factorial
def main(num):
return sum(map(int, str(factorial(num))))
try:
para = int(input())
except:
para = 100
beg = datetime.datetime.now()
ans = main(para)
end = datetime.datetime.now()
print("answer:", ans)
print("time:", end - beg)
| nowsword/ProjectEuler | p020.py | Python | gpl-3.0 | 288 |
import os
from kubeflow.kubeflow.crud_backend import config, logging
from ..common import create_app as create_default_app
from .routes import bp as routes_bp
log = logging.getLogger(__name__)
def create_app(name=__name__, cfg: config.Config = None):
cfg = config.Config() if cfg is None else cfg
# Properl... | kubeflow/kfserving-lts | web-app/backend/apps/v1beta1/__init__.py | Python | apache-2.0 | 709 |
from core.hook import BaseHook
class Hook(BaseHook):
def addChecklistToCard(self, action):
data = action["data"]
context = {
"card_link": data["card"]["shortLink"],
"card_name": data["card"]["name"],
"checklist_name": data["checklist"]["name"],
}
... | Lujeni/matterllo | core/hook/checklist.py | Python | mit | 1,786 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Alias,
Typed,
String,
Float,
Integer,
Bool,
NoneSet,
Set,
)
from openpyxl.descriptors.excel import (
ExtensionList,... | aragos/tichu-tournament | python/openpyxl/workbook/protection.py | Python | mit | 3,908 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class MailMessage(models.Model):
_inherit = 'mail.message'
def portal_message_format(self):
return self._portal_message_format([
'id', 'body', 'date', 'author_id', '... | jeremiahyan/odoo | addons/portal/models/mail_message.py | Python | gpl-3.0 | 978 |
from pycp2k.inputsection import InputSection
from ._aa_planar2 import _aa_planar2
from ._planar2 import _planar2
from ._aa_cylindrical2 import _aa_cylindrical2
from ._aa_cuboidal2 import _aa_cuboidal2
class _dirichlet_bc2(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Verbose_... | SINGROUP/pycp2k | pycp2k/classes/_dirichlet_bc2.py | Python | lgpl-3.0 | 2,187 |
# encoding: 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 model 'StickyTweet'
db.create_table('lizard_sticky_twitterized_stickytweet', (
('id',... | lizardsystem/lizard-sticky-twitterized | lizard_sticky_twitterized/migrations/0001_initial.py | Python | gpl-3.0 | 2,652 |
"""log more
Revision ID: 430039611635
Revises: d827694c7555
Create Date: 2016-02-10 08:47:28.950891
"""
# revision identifiers, used by Alembic.
revision = '430039611635'
down_revision = 'd827694c7555'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('logs', sa.Column('dashboard_id',... | alanmcruickshank/superset-dev | superset/migrations/versions/430039611635_log_more.py | Python | apache-2.0 | 530 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GridAverage.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*************... | gioman/QGIS | python/plugins/processing/algs/gdal/GridAverage.py | Python | gpl-2.0 | 4,840 |
# Copyright (c) 2010 Cloud.com, Inc
# Copyright 2012 Cloudbase Solutions Srl / Pedro Navarro Perez
# 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
#
# ... | jumpstarter-io/nova | nova/virt/hyperv/vmutils.py | Python | apache-2.0 | 27,434 |
# TeamLogger
# Copyright (C) 2017 Maxence PAPILLON
#
# 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.
#
# This program i... | mpapillon/django-teamlogger | src/teamlogger/urls.py | Python | gpl-3.0 | 1,933 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... | InakiZabala/odoomrp-wip | account_treasury_forecast_cashflow/models/account_treasury_forecast_template.py | Python | agpl-3.0 | 2,861 |
from jawa.attribute import get_attribute_classes
def test_mandatory_attributes():
required_properties = ['ADDED_IN', 'MINIMUM_CLASS_VERSION']
for name, class_ in get_attribute_classes().items():
for p in required_properties:
assert hasattr(class_, p), (
'{name} parser missi... | TkTech/Jawa | tests/attributes/test_general_attributes.py | Python | mit | 791 |
"""Tests for add_inator route."""
import json
from http import HTTPStatus
from urllib.parse import urlparse
from utils import from_datetime
def test_login_required(app):
"""Redirect to login if we're not logged in."""
# Perform a GET and check that we're redirected properly
rv = app.get("/add/")
ass... | kevinschoonover/cs2001-cpl | homework/2017-fs-1b-hw04-ksyh3/test/test_add_inator.py | Python | gpl-3.0 | 5,836 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 12, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_MovingMedian/cycle_12/ar_12/test_artificial_1024_Anscombe_MovingMedian_12_12_0.py | Python | bsd-3-clause | 268 |
# In The Name Of God
# ========================================
# [] File Name : functions.py
#
# [] Creation Date : 10-05-2015
#
# [] Created By : Parham Alvani (parham.alvani@gmail.com)
# =======================================
__author__ = 'Parham Alvani'
import dis
def square(x):
if not isinstance(x, int):
... | 1995parham/Python101 | src/functions.py | Python | gpl-2.0 | 825 |
from django.conf.urls import url
from . import views
app_name = 'polls'
urlpatterns = [
# ex: /polls/
url(r'^$', views.index, name='index'),
# ex: /polls/5/
#url(r'^(?P<question_id>[0-9]+)/$', views.detail, name='detail'),
# ex: /polls/5/results/
url(r'^specifics/(?P<question_id>[0-9]+)/$', vi... | jas1/pythonWEBprueba | mysite/polls/urls.py | Python | mit | 523 |
import agros2d
from test_suite.scenario import Agros2DTestCase
from test_suite.scenario import Agros2DTestResult
class TestRFTEHarmonicPlanar(Agros2DTestCase):
def setUp(self):
# model
problem = agros2d.problem(clear = True)
problem.coordinate_type = "planar"
probl... | hpfem/agros2d | resources/test/test_suite/fields/rf_te.py | Python | gpl-2.0 | 9,777 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from . import account_invoice
# vim:expandtab:smar... | sysadminmatmoz/ingadhoc | account_invoice_commercial/__init__.py | Python | agpl-3.0 | 366 |
# -*- coding: utf-8 -*-
"""
modulestore Django application initialization.
"""
from __future__ import absolute_import, unicode_literals
from django.apps import AppConfig
class ModulestoreConfig(AppConfig):
"""
Configuration for the modulestore Django application.
"""
name = 'modulestore'
| bmedx/modulestore | modulestore/apps.py | Python | apache-2.0 | 310 |
from scrapy.utils.markup import *
def removeTagsAndWhiteSpaces(text):
text = remove_comments(text)
text = remove_tags_with_content(text,which_ones=('script',))
text = remove_tags(text,keep=('br',))
text = replace_tags(text,token='\n')
return text
def removeTopTag(text):
return text.partition("... | shengcanxu/CCrawler | source/helper/textUtil.py | Python | apache-2.0 | 345 |
import cloud
| ichi23de5/ichi_Repo | cloud_management/models/__init__.py | Python | gpl-3.0 | 13 |
# -*- coding: utf-8 -*-
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""chroot_lib unit tests."""
from __future__ import print_function
import os
import sys
from chromite.lib import chroot_lib
fro... | endlessm/chromium-browser | third_party/chromite/lib/chroot_lib_unittest.py | Python | bsd-3-clause | 4,560 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Networking/Responses/CheckChallengeResponse.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
f... | favll/pogom | pogom/pgoapi/protos/POGOProtos/Networking/Responses/CheckChallengeResponse_pb2.py | Python | mit | 2,768 |
# encoding: 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):
# Deleting field 'Drink.endtime'
db.delete_column('core_drink', 'endtime')
# Changing field 'Drin... | Alwnikrotikz/kegbot | pykeg/src/pykeg/core/migrations/0049_remove_drink_endtime.py | Python | gpl-2.0 | 26,331 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-24 15:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('emailer', '0007_auto_20150509_1922'),
]
operations = [
migrations.AlterField(
... | JustinWingChungHui/okKindred | emailer/migrations/0008_auto_20151224_1528.py | Python | gpl-2.0 | 467 |
#!/usr/bin/env python
from runtest import TestBase
class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'abc', """
# DURATION TID FUNCTION
0.508 us [ 772] | __monstartup();
0.425 us [ 772] | __cxa_atexit();
[ 772] | main() {
[ 772] | a() {
... | andrewjss/uftrace | tests/t072_no_comment.py | Python | gpl-2.0 | 621 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 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 opt... | egabancho/invenio | invenio/base/scripts/database.py | Python | gpl-2.0 | 12,655 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.