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 |
|---|---|---|---|---|---|
__copyright__ = 'Copyright(c) Gordon Elliott 2017'
"""
"""
from a_tuin.in_out.gsheet_integration import get_gsheet_fields, load_class
from a_tuin.metadata import StringField, Mapping
from glod.db.fund import FundRestriction, Fund
from glod.db.account import AccountQuery
FUND_RESTRICTION_MAP = {
'01. unrestric... | gordon-elliott/glod | src/glod/in_out/fund.py | Python | mit | 1,742 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# quadcopter documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 27 18:40:16 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
#... | claws/quadcopter | doc/conf.py | Python | mit | 9,210 |
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
# Copyright (c) 2014, Niko Usai <mogui83@gmail.com>
#
# 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... | mogui/pyipa | pyipa/IPAparser.py | Python | mit | 2,263 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import numpy as np
import re
import math
import itertools
import collections
import warnings
from monty.json import MSONable
from pymatgen.core.periodic_table import get_el_sp, Specie
from pymatgen.core.struc... | dongsenfo/pymatgen | pymatgen/electronic_structure/bandstructure.py | Python | mit | 52,567 |
import csv
import sys
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
def parse(file_name):
"Parses the data sets from the csv file we are given to work with"
try:
file = open(file_name)
except IOError:
print "Failed to open the data file"
sys.exit()
... | GZakharov1525/SOFE3770 | Assignment2/plot_lines.py | Python | gpl-3.0 | 2,119 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test fee estimation code
#
from test_framework.test_framework import BitcoinTestFramework
from test_... | Kangmo/bitcoin | qa/rpc-tests/smartfees.py | Python | mit | 12,523 |
import copy
import operator
empty = object()
def unpickle_lazyobject(wrapped):
"""
Used to unpickle lazy objects. Just return its argument, which will be the
wrapped object.
"""
return wrapped
def new_method_proxy(func):
def inner(self, *args):
if self._wrapped is empty:
... | avara1986/gozokia | gozokia/utils/functional.py | Python | mit | 4,105 |
"""
@file basic_rilsacorridor3.py
@author Daniel Krajzewicz
@date 2014-09-01
@version $Id: basic_rilsacorridor3.py 22608 2017-01-17 06:28:54Z behrisch $
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors
This file is part of SUMO.
SUMO ... | 702nADOS/sumo | tools/sumolib/scenario/scenarios/basic_rilsacorridor3.py | Python | gpl-3.0 | 9,899 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing 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
# Unles... | probcomp/cgpm | src/primitives/crp.py | Python | apache-2.0 | 6,189 |
# -*- coding: utf-8 -*-
from invoke import task
DEFAULT_OPTS = '--backtrack=50 --deep --verbose --verbose-conflicts'
@task
def emerge(ctx, default_opts=DEFAULT_OPTS, opts='', target='world', tag=''):
ctx.run('ionice -c3 {} /usr/bin/emerge {} {} {}'.format(tag, default_opts, opts, target))
| lmiphay/gentoo-oam | oam/tasks/merge.py | Python | gpl-2.0 | 297 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | zuotingbing/spark | python/pyspark/resource/taskrequests.py | Python | apache-2.0 | 3,865 |
# coding=utf-8
from __future__ import print_function
__author__ = 'Mario Romera Fernández'
__license__ = 'GNU General Public License v2.0'
def to_unicode(obj, encoding="utf-8"):
if isinstance(obj, basestring):
if not isinstance(obj, unicode):
obj = unicode(obj, encoding)
return obj
def ... | Taabu/batcave | utilidades.py | Python | gpl-2.0 | 3,746 |
from menpo.landmark.labels import ibug_face_66
def process(lms):
return ibug_face_66(lms)[1]
| menpo/menpobench | menpobench/predefined/landmark_process/face_ibug_68_to_face_ibug_66.py | Python | bsd-3-clause | 98 |
#!/usr/bin/python
#
# Copyright: Ansible Team
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | Russell-IO/ansible | lib/ansible/modules/network/aireos/aireos_config.py | Python | gpl-3.0 | 10,887 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0019_auto_20151130_0122'),
]
operations = [
migrations.AlterModelOptions(
name='discipline',
... | rskwan/ucb-grade-dists | ucbgradedists/core/migrations/0020_auto_20151201_0051.py | Python | mit | 681 |
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: debug
type: stdout
short_description: formatted stdout/stderr displa... | alexlo03/ansible | lib/ansible/plugins/callback/debug.py | Python | gpl-3.0 | 1,772 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_auto_20141029_1945'),
]
operations = [
migrations.CreateModel(
name='Tag',
fields=[
... | bobisjan/django-shanghai | tests/project/blog/migrations/0003_auto_20141104_2232.py | Python | mit | 823 |
from django.utils.translation import ugettext_lazy as _
# Reviewer Tools
REVIEWER_VIEWING_INTERVAL = 8 # How often we ping for "who's watching?"
REVIEWER_REVIEW_LOCK_LIMIT = 3 # How many pages can a reviewer "watch"
# Types of Canned Responses for reviewer tools.
CANNED_RESPONSE_ADDON = 1
CANNED_RESPONSE_THEME = 2... | harry-7/addons-server | src/olympia/constants/reviewers.py | Python | bsd-3-clause | 6,664 |
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import redirect_to
from webdnd.player.views.main import HomeView
from webdnd.player.views.main import AboutView
from webdnd.player.views.main import ContactView
urlpatterns = patterns('webdnd.player.views.main',
url(r'^... | Saevon/webdnd | player/urls/main.py | Python | mit | 558 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **Script for pushing new earthquake impact report**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Lice... | drayanaindra/inasafe | realtime/update_latest_report.py | Python | gpl-3.0 | 5,772 |
""" DIRAC Graphs package provides tools for creation of various plots to provide
graphical representation of the DIRAC Monitoring and Accounting data
The DIRAC Graphs package is derived from the GraphTool plotting package of the
CMS/Phedex Project by ... <to be added>
"""
__RCSID__ = "$Id$"
# Make su... | andresailer/DIRAC | Core/Utilities/Graphs/__init__.py | Python | gpl-3.0 | 4,866 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import redirect
from flask import request
from flask import url_for
from flask.ext.wtf import Form as BaseForm
from sqlalchemy.orm.exc import MultipleResultsFound
from sqlalchemy.orm.exc import NoResultFound
from wtforms import fields
from wtforms import validat... | oldhawaii/oldhawaii-metadata | www/oldhawaii_metadata/apps/users/forms.py | Python | mit | 6,532 |
#!/usr/bin/python -i
# -*- coding: utf-8 -*-
import sys, os, re
from glob import glob
#sys.path = ['/home/lcampagn/work/manis_lab/code/libs'] + sys.path
localDir = os.path.dirname(__file__)
sys.path.append(os.path.join(localDir, '..'))
sys.path.append(os.path.join(localDir, '../util'))
#from helpers import *
from PyQ... | hiuwo/acq4 | acq4/analysis/old/caImagingAnalysis.py | Python | mit | 9,655 |
#!/usr/bin/python
# coding: utf-8
# Copyright 2013 The Font Bakery 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... | jessamynsmith/fontbakery | tools/compute_font_weight_and_width.py | Python | apache-2.0 | 7,384 |
#!/usr/bin/env python
# coding:utf-8
import sys
import imp
import redis
from rq import Queue
import random
from task.worker.PushWorker import push_messenger
def main(msg, config, silent=False):
"""
Job enqueue
:param msg:str
:param config:
:return:
"""
queue_dsn = config["queue"]["dsn"]
... | smices/mWorkerService | src/task/scheduler/PushWorker.py | Python | mit | 692 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from celery_proj.celery import app
from sharefun import create_app
from sharefun.models import db, Recommendation, User, Category, Comment, Work
from sharefun.script.spider.crawlDoubanWorkInfo import main
from sharefun.config import load_config
from sharef... | Fansion/sharefun | celery_proj/tasks.py | Python | mit | 10,916 |
#!/usr/bin/env python
from __future__ import print_function
import linchpin.FilterUtils.FilterUtils as filter_utils
class FilterModule(object):
''' A filter to fix network format '''
def filters(self):
return {
'map_results': filter_utils.map_results
}
| samvarankashyap/linch-pin | linchpin/provision/roles/azure/filter_plugins/map_results.py | Python | gpl-3.0 | 292 |
#!/usr/bin/env python
import io
import os
import re
import sys
from setuptools import setup, find_packages
PACKAGE = "lancet"
if sys.argv[-1] == "publish":
os.system("python setup.py sdist bdist_wheel upload")
sys.exit()
class Setup(object):
@staticmethod
def read(fname, fail_silently=False):
... | GaretJax/lancet | setup.py | Python | mit | 3,730 |
import datetime
import requests
import time
__author__ = 'ApigeeCorporation'
def total_milliseconds(td):
return (td.microseconds + td.seconds * 1000000) / 1000
url_template = "http://localhost:9200/_cat/pending_tasks?v'"
x = 0
SLEEP_TIME = 3
while True:
x += 13
try:
r = requests.get(url=url... | jwest-apigee/usergrid-util-python | es_tools/monitor_tasks.py | Python | mit | 855 |
# ext/declarative/api.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Public API functions and helpers for declarative."""
from ...schema import ... | rclmenezes/sqlalchemy | lib/sqlalchemy/ext/declarative/api.py | Python | mit | 15,843 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# copyright 2003-2010 Sylvain Thenault, all rights reserved.
# contact mailto:thenault@gmail.com
#
# This file is part of logilab-astng.
#
# logilab-astng is free software: you can redi... | tkaitchuck/nupic | external/common/lib/python2.6/site-packages/logilab/astng/test/unittest_scoped_nodes.py | Python | gpl-3.0 | 24,944 |
import numpy as np
import matplotlib
matplotlib.use("Qt5Agg")
from matplotlib.pyplot import cm
from spimagine import volshow
import OpenGL.GL as GL
if __name__ == '__main__':
data = np.einsum("ij,k",np.ones((100,)*2), np.linspace(0,1,100))
w = volshow(data)
w.glWidget._set_colormap_array(cm.hot(np.linsp... | maweigert/spimagine | tests/test_gui/test_bitdepth.py | Python | bsd-3-clause | 421 |
import numpy
import energyfunc
import pdb
from scipy import weave
#==========================================
# FORCE CALCULATION METHODS
#==========================================
def cdihedforces(torsparam, bonds, dsq, d, numbeads):
forces = numpy.zeros((numbeads,3))
code = """
double x1, x2, x3, y1, y2... | shirtsgroup/pygo | package/HMCforce.py | Python | gpl-2.0 | 18,951 |
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# 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,... | Fxrh/tispa-wm | libqtile/layout/stack.py | Python | gpl-3.0 | 11,746 |
from __future__ import absolute_import
from .pypi import show
from .pypi import list
| harshasrinivas/pypilist | pypilist/__init__.py | Python | mit | 85 |
import os
import io
import os.path
from recipemd.parser import parseFile
from recipemd import git
from recipemd.serializer.xml import dump
def process(obj_id, target, xslt = None):
""" get file from git, process, write to target folder
Arguments:
obj_id -- git object id of the file (as string)
target -- targ... | andreasWallner/recipe-markdown | recipemd/common.py | Python | mit | 1,135 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : rootntsd
# E-mail : rootntsd@gmail.com
# Date : 14/01/26 0:35:00
# Desc : '''
#
#from __init__ import BasePlugin
from plugins import BasePlugin
import logging
import inspect
import os
logger = logging.getLogger("plugin")
def callit(obj,... | evilbinary/robot | plugins/shell.py | Python | mit | 2,486 |
from bokeh.charts import Scatter, output_file, show
x = [1, 2, 3, 4, 5, 6, 7, 8]
y = [2.1, 6.45, 3, 1.4, 4.55, 3.85, 5.2, 0.7]
z = [.5, 1.1, 1.9, 2.5, 3.1, 3.9, 4.85, 5.2]
species = ['cat', 'cat', 'cat', 'dog', 'dog', 'dog', 'mouse', 'mouse']
country = ['US', 'US', 'US', 'US', 'UK', 'UK', 'BR', 'BR']
df = {'time': x,... | Serulab/Py4Bio | code/ch14/scatter.py | Python | mit | 618 |
# -*- coding: utf-8 -*-
"""
Hybrid Dile Server
~~~~~~~~
A data tile server
:copyright: (c) 2016 by Raffaele Montella & Sergio Apreda.
:license: Apache 2.0, see LICENSE for more details.
"""
import json, sys, re, urllib, urllib2, socket, unicodedata
import pydoc, cgi, os, time, inspect, collections... | RDCEP/hybrid-dile-server | lib/hybrid_dile_server.py | Python | apache-2.0 | 18,985 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import importlib
import os
from .... | mlperf/training_results_v0.5 | v0.5.0/nvidia/submission/code/translation/pytorch/fairseq/tasks/__init__.py | Python | apache-2.0 | 1,387 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2014, Jens Depuydt <http://www.jensd.be>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | ravibhure/ansible | lib/ansible/modules/database/postgresql/postgresql_lang.py | Python | gpl-3.0 | 9,607 |
import threading
import re
import os
import datetime
import time
import sublime
from .console_write import console_write
from .package_installer import PackageInstaller
from .package_renamer import PackageRenamer
from .open_compat import open_compat, read_compat
class AutomaticUpgrader(threading.Thread):
"""
... | dostavro/dotfiles | sublime2/Packages/Package Control/package_control/automatic_upgrader.py | Python | mit | 7,477 |
#!/usr/bin/env python
'''
File name: main_ripp_mod.py
Author: Guillaume Viejo
Date created: 16/08/2017
Python Version: 3.5.2
'''
import sys
import numpy as np
import pandas as pd
import scipy.io
from functions import *
# from pylab import *
from multiprocessing import Pool
import os
import neurose... | gviejo/ThalamusPhysio | python/main_make_SWS_scalar_product.py | Python | gpl-3.0 | 14,308 |
import asyncio
import glob
import importlib
import json
import logging
import os
import pkg_resources
from aiohttp import web
import dcos_installer.action_lib
import gen.calc
import pkgpanda.util
from dcos_installer import backend
from dcos_installer.config import Config, make_default_config_if_needed
from dcos_insta... | mellenburg/dcos | dcos_installer/async_server.py | Python | apache-2.0 | 14,276 |
def gcd(a, b):
"""
Input:
a: A nonnegative int
b: A nonnegative int
Precondition:
isinstance(a, int) and isinstance(b, int)
Output:
The greatest int that divides evenly into a and b
"""
if b == 0:
return a
else:
return gcd(b, a % b)
def lcm(nu... | evandrix/Splat | code/demo/quixey/mine_tests/gcd.py | Python | mit | 448 |
from opentrons.types import Point
MOVE_TO_TIP_RACK_SAFETY_BUFFER = Point(0, 0, 10)
# Add in a 2mm buffer to tiprack thresholds on top of
# the max acceptable range for a given pipette based
# on calibration research data.
DEFAULT_OK_TIP_PICK_UP_VECTOR = Point(3.79, 3.64, 2.8)
P1000_OK_TIP_PICK_UP_VECTOR = Point(4.7,... | Opentrons/labware | robot-server/robot_server/robot/calibration/check/constants.py | Python | apache-2.0 | 809 |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire X (FoFiX) #
# Copyright (C) 2006 Sami Kyöstilä ... | west2554/fofix | src/Theme.py | Python | gpl-2.0 | 108,925 |
# coding=utf-8
# author: @netmanchris
# -*- coding: utf-8 -*-
"""
This module contains functions for working with the access controller
capabilities of the HPE IMC WSM Module using the RESTful API
"""
# This section imports required libraries
import json
import requests
from pyhpeimc.auth import HEADERS
def get_a... | HPNetworking/HP-Intelligent-Management-Center | pyhpeimc/wsm/acinfo.py | Python | apache-2.0 | 1,510 |
"""Configure pytest for Dyson tests."""
from unittest.mock import patch
from libpurecool.dyson_device import DysonDevice
import pytest
from homeassistant.components.dyson import DOMAIN
from homeassistant.core import HomeAssistant
from .common import BASE_PATH, CONFIG
from tests.common import async_setup_component
... | aronsky/home-assistant | tests/components/dyson/conftest.py | Python | apache-2.0 | 1,218 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/report2bq | application/cli/postprocessor.py | Python | apache-2.0 | 2,165 |
# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option)... | pelson/cartopy | lib/cartopy/tests/mpl/test_gridliner.py | Python | lgpl-3.0 | 6,136 |
import json
from pimlico.datatypes.corpora.json import JsonDocumentType
from pimlico.cli.browser.tools.formatter import DocumentBrowserFormatter
class JsonFormatter(DocumentBrowserFormatter):
DATATYPE = JsonDocumentType()
def format_document(self, doc):
return json.dumps(doc.data, indent=4)
| markgw/pimlico | src/python/pimlico/datatypes/corpora/formatters/json.py | Python | gpl-3.0 | 313 |
#---------------------------------------------------------------------------------
# Vega Strike script for a quest
# Copyright (C) 2008 Vega Strike team
# Contact: hellcatv@sourceforge.net
# Internet: http://vegastrike.sourceforge.net/
#.
# This program is free software; you can redistribute it and/or
# modify it unde... | costalfy/Vega-Strike | data/modules/quests/quest_dispute.py | Python | gpl-2.0 | 17,423 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def sortedArrayToBST(self, nums):
"""
:type nums: List[int]
:rtype: TreeNode
"""
... | Chasego/cod | leetcode/108-Convert-Sorted-Array-to-Binary-Search-Tree/ConvSrtArr2BST_001_rec.py | Python | mit | 553 |
# 主要是为了使用中文显示 app 于 admin 界面
default_app_config = 'bespeak_meal.apps.Bespeak_meal_config'
| zhengxinxing/bespeak_meal | __init__.py | Python | mit | 120 |
import html.parser
import re
import glob
class _Parser(html.parser.HTMLParser):
def __init__(self):
self.subs = []
super().__init__()
def handle_pi(self,data):
data = data.strip()
if data.startswith('?'):
data = data[1:]
if data.startswith("python"):
data = data[6:]
if data.endswith('?'):
data... | Malex/FrozenFW | frozen/plugins/Template.py | Python | gpl-3.0 | 2,730 |
# -*- coding: utf-8 -*-
#
# workspace-tools documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 26 01:16:43 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | maxzheng/workspace-tools | docs/conf.py | Python | mit | 8,268 |
#!/usr/bin/python
import os
import sys
import warnings
# the site module must be imported for normal behavior to take place; it is
# done dynamically so that cx_Freeze will not add all modules referenced by
# the site module to the frozen executable
__import__("site")
# now locate the pth file to modify the path app... | jnoortheen/nigandu | src/initscript.py | Python | gpl-2.0 | 500 |
import os
import re
import urllib
from django.conf import settings
from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import Site, RequestSite
from django.contrib.auth.models import User
from django.test import Test... | bdelliott/wordgame | web/django/contrib/auth/tests/views.py | Python | mit | 15,291 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import logging
import logging.config
import logging.handlers
import os
import warnings
from pprint import ... | pferreir/indico | indico/core/logger.py | Python | mit | 5,242 |
import xmlrpclib
import sys
sys.path.append('../plagiabot')
from plagiabot_config import ithenticate_user, ithenticate_password
from flup.server.fcgi import WSGIServer
from cgi import parse_qs, escape
#cgitb.enable()
def get_view_url(report_id):
report='a'
a=''
try:
a='a'
server_i = xmlrpcl... | Jobava/plagiabot | ithenticate.py | Python | mit | 1,465 |
# -*- coding: utf-8 -*-
import re
from os.path import splitext
from vilya.libs.consts import IS_GENERATED, MINIFIED
PEG_REGEX = re.compile(
'^(?:[^\/]|\/[^\*])*\/\*(?:[^\*]|\*[^\/])*Generated by PEG.js', re.DOTALL)
GENERATED_REGEX = re.compile('^\/\/ Generated by ', re.DOTALL)
class Generated(object):
def ... | xtao/code | vilya/libs/generated.py | Python | bsd-3-clause | 5,041 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 14:27
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
replaces = [('plugin_anchor_menu', '0001_initial'), ('plugin_anchor_menu', '0002_drop... | jedie/django-cms-tools | django_cms_tools/plugin_anchor_menu/migrations/0001_squashed_0002_dropdownanchormenupluginmodel.py | Python | gpl-3.0 | 2,156 |
import sys
import math
positions = []
current = int(raw_input("Enter starting point: "))
dir = int(raw_input("Enter starting direction (0=decreasing, 1=increasing): "))
while True: #Gather the input
n = raw_input("Input integer position (inter nothing to end input): ")
if n == "":
break
n=int(n)
positions.... | dberliner/CS423_test_help | elevator_SCAN.py | Python | mit | 891 |
from __future__ import absolute_import
import sys
import warnings
from collections import defaultdict
import numpy as np
from holoviews.core.util import isscalar, unique_iterator, unique_array, pd
from holoviews.core.data import Dataset, Interface, MultiInterface
from holoviews.core.data.interface import DataError... | ioam/geoviews | geoviews/data/geopandas.py | Python | bsd-3-clause | 22,492 |
import errno
import os
import pytest
from wal_e.worker import prefetch
from wal_e import worker
@pytest.fixture
def pd(tmpdir):
d = prefetch.Dirs(unicode(tmpdir))
return d
@pytest.fixture
def seg():
return worker.WalSegment('0' * 8 * 3)
@pytest.fixture
def raise_eperm():
def raiser(*args, **kwarg... | intoximeters/wal-e | tests/test_prefetch.py | Python | bsd-3-clause | 2,302 |
# Performs raw decompression of various compression algorithms (currently, only deflate).
import os
import zlib
import lzma
import struct
import binwalk.core.compat
import binwalk.core.common
from binwalk.core.module import Option, Kwarg, Module
class LZMAHeader(object):
def __init__(self, **kwargs):
for ... | WooyunDota/binwalk | src/binwalk/modules/compression.py | Python | mit | 9,259 |
#!/usr/bin/env python
"""Use clang-format and autopep8 when available to clean up the listed source
files."""
from __future__ import print_function
from optparse import OptionParser
import subprocess
import os
import sys
import multiprocessing
try:
from queue import Queue # python3
except ImportError:
fro... | salilab/rmf | tools/dev_tools/cleanup_code.py | Python | apache-2.0 | 6,511 |
import pandas as pd
import numpy as np
__author__ = 'Allison MacLeay'
def load_mnist_features(n):
csv_file = 'df_save_img_everything.csv'
print 'Loading {} records from haar dataset'.format(n)
df = pd.read_csv(csv_file)
del df['Unnamed: 0']
skr = set(np.random.choice(range(len(df)), size=n, repl... | alliemacleay/MachineLearning_CS6140 | Homeworks/HW6/__init__.py | Python | mit | 425 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_operations.py | Python | mit | 4,391 |
"""Qgram based tokenizer"""
from py_stringmatching import utils
from six.moves import xrange
from py_stringmatching.tokenizer.definition_tokenizer import DefinitionTokenizer
class QgramTokenizer(DefinitionTokenizer):
"""Qgram tokenizer class.
Parameters:
qval (int): Q-gram length (defaults to 2)
... | Anson-Doan/py_stringmatching | py_stringmatching/tokenizer/qgram_tokenizer.py | Python | bsd-3-clause | 2,448 |
# Natural Language Toolkit: Confusion Matrices
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function, unicode_literals
from nltk.probabil... | TeamSPoon/logicmoo_workspace | packs_sys/logicmoo_nlu/ext/pldata/nltk_3.0a3/nltk/metrics/confusionmatrix.py | Python | mit | 7,586 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Pexego Sistemas Informáticos All Rights Reserved
# $Jesús Ventosinos Mayor <jesus@pexego.es>$
#
# This program is free software: you can redistribute it and/or modify
# it under the ... | jgmanzanas/CMNT_004_15 | project-addons/purchase_picking/purchase.py | Python | agpl-3.0 | 5,513 |
# -*- coding: utf-8 -*-
import logging
log = logging.getLogger(__name__)
def init_single_entity(scenario, axes = None, enfants = None, famille = None, foyer_fiscal = None, menage = None, parent1 = None, parent2 = None, period = None):
if enfants is None:
enfants = []
assert parent1 is not None
... | sgmap/openfisca-france | openfisca_france/scenarios.py | Python | agpl-3.0 | 2,063 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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, either version 3 of the License, or
# (at your option) an... | alvaroaleman/ansible | lib/ansible/executor/stats.py | Python | gpl-3.0 | 2,779 |
import sys
sys.path.insert(0, '..')
import patch_socket
import redis
print(redis.__file__)
try:
import redis._pack
except ImportError:
print('using pure python _pack_command')
else:
print('using cython _pack_command')
from redis.connection import Connection
class DummyConnectionPool(object):
def __... | yihuang/redis-py | benchmarks/c_command_packer_benchmark.py | Python | mit | 1,265 |
from django.shortcuts import redirect
from social.pipeline.partial import partial
@partial
def require_email(strategy, details, user=None, is_new=False, *args, **kwargs):
if kwargs.get('ajax') or user and user.email:
return
elif is_new and not details.get('email'):
email = strategy.request_da... | aneumeier/userprofile | userprofile/pipeline.py | Python | mit | 452 |
from bson.objectid import ObjectId
import json
class Room():
def __init__(self, players_num, objectid, table, current_color='purple'):
if players_num:
self.players_num = players_num
else:
self.players_num = 0
for el in ['p', 'b', 'g', 'r']:
if ... | Andrey-Tkachev/infection | models/room.py | Python | mit | 6,066 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-02-09 09:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scoping', '0044_auto_20170209_0949'),
]
operations = [
migrations.AlterFiel... | mcallaghan/tmv | BasicBrowser/scoping/migrations/0045_auto_20170209_0950.py | Python | gpl-3.0 | 495 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bitcamp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jerrrytan/bitcamp | bitcamp/manage.py | Python | mit | 250 |
# -*- coding: utf-8 -*-
# Asymmetric Base Framework - A collection of utilities for django frameworks
# Copyright (C) 2013 Asymmetric Ventures Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... | AsymmetricVentures/asym-core | asymmetricbase/_models/roles.py | Python | gpl-2.0 | 9,821 |
import os
import zipfile
import requests
import pandas as pd
WALKING_DATASET = (
"https://archive.ics.uci.edu/ml/machine-learning-databases/00286/User%20Identification%20From%20Walking%20Activity.zip",
)
def download_data(path='data', urls=WALKING_DATASET):
if not os.path.exists(path):
os.mkdir(path)
... | rebeccabilbro/rebeccabilbro.github.io | _drafts/get_walking_data.py | Python | mit | 1,420 |
import datetime
from unittest import mock
from django.db import IntegrityError, connection, transaction
from django.db.models import CheckConstraint, F, Func, Q
from django.utils import timezone
from . import PostgreSQLTestCase
from .models import HotelReservation, RangesModel, Room
try:
from django.contrib.post... | kaedroho/django | tests/postgres_tests/test_constraints.py | Python | bsd-3-clause | 13,556 |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import attr
from attr import ib as Field
from addonpayments.api.common.requests import ApiRequest
from addonpayments.api.elements import Card, DccInfoWithRateType, DccInfoWithAmount
from addonpayments.api.mixins import FieldsAmountMix... | ComerciaGP/addonpayments-Python-SDK | addonpayments/api/dcc/requests.py | Python | mit | 1,336 |
import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from pyramid.scripts.common import parse_vars
from ..models import (
DBSession,
MyModel,
FocusModel,
Base,
)
def usage(argv):
cmd = o... | xydinesh/focus | focus/scripts/initializedb.py | Python | apache-2.0 | 1,032 |
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from library.preprocessing import ZCA
def transform(input, transform_method='StandardScaler'):
if transform_method == 'StandardScaler':
ss = StandardScaler()
elif transform_method == 'MinMaxScaler':
ss = MinMaxScaler()
else:
... | sonapraneeth-a/object-classification | library/preprocessing/data_transform.py | Python | mit | 426 |
# Copyright 2016 Hewlett Packard Enterprise Development LP.
# Copyright 2016 Universidade Federal de Campina Grande
# 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 Licens... | NaohiroTamura/ironic | ironic/drivers/modules/oneview/deploy.py | Python | apache-2.0 | 17,139 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C): 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Requirements
# - pyvmomi >= 6.0.0.2016.4
# TODO:
# * more jq examples
# * optional folder heriarchy
"""
$ jq '._meta.hostvars[].c... | GheRivero/ansible | contrib/inventory/vmware_inventory.py | Python | gpl-3.0 | 28,632 |
# -*- coding: utf-8 -*-
import argparse
import logging
import requests
import sys
import os
import glob
import imp
import inspect
from dogen.generator import Generator
from dogen.version import version
from dogen.errors import Error
from dogen.plugin import Plugin
import colorlog
# Source: http://stackoverflow.com/... | goldmann/dogen | dogen/cli.py | Python | mit | 4,867 |
# Based on lazy pirate pattern
import zmq
import sys
import numpy
def recv_array(socket, flags=0, copy=True, track=False):
"""recv a numpy array"""
md = socket.recv_json(flags=flags)
msg = socket.recv(flags=flags, copy=copy, track=track)
buf = buffer(msg)
A = numpy.frombuffer(buf, dtype=md['dtype'... | DawesLab/Camserver | TestClient.py | Python | mit | 2,036 |
"""add table mailtemplates
Revision ID: 34f15d11d02
Revises: 2fadbf7a01a
Create Date: 2015-08-04 17:28:24.372803
"""
# revision identifiers, used by Alembic.
revision = '34f15d11d02'
down_revision = '2fadbf7a01a'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alem... | uaprom-summer-2015/Meowth | migrations/versions/2015_08_04_34f1_add_table_mailtemplates.py | Python | bsd-3-clause | 1,045 |
# -*- coding: utf-8 -*-
"""Building and simulating spiking neural networks using Brian2.
@author: rbodo
"""
import warnings
import numpy as np
import os
from tensorflow.keras.models import load_model
from snntoolbox.parsing.utils import get_type
from snntoolbox.simulation.utils import AbstractSNN, get_shape_from_la... | NeuromorphicProcessorProject/snn_toolbox | snntoolbox/simulation/target_simulators/brian2_target_sim.py | Python | mit | 15,271 |
import argparse
import jenkins
from rdoutils import jenkins_utils
def parse_args():
parser = argparse.ArgumentParser(description='Get status of jenkins job'
'running in ci.centos.org')
parser.add_argument('-j', '--job-name', dest='job_name', required=True,
... | rdo-infra/releng | rdoutils/cmd/get_jenkins_job.py | Python | apache-2.0 | 1,329 |
"""
Copyright 2008-2015 Free Software Foundation, Inc.
This file is part of GNU Radio
SPDX-License-Identifier: GPL-2.0-or-later
"""
import sys
import re
import subprocess
import threading
import json
import random
import itertools
import six
from six.moves import queue, filter, range
############################... | trabucayre/gnuradio | grc/core/utils/extract_docs.py | Python | gpl-3.0 | 9,513 |
#!/usr/bin/env python
from __future__ import division
from __future__ import print_function
# General libraries
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import sys
import argparse
import datetime
import getpass
import os
import time
# OpenCV
import cv2
#... | meteoswiss-mdr/precipattractor | pyscripts/radar_extrapolation.py | Python | gpl-3.0 | 15,346 |
# -*- coding: utf-8 -*-
import os, Image
from datetime import datetime
from django.template import Library
from django.utils.timesince import timesince
from oi.settings import MEDIA_ROOT, MEDIA_URL
from oi.forum.postmarkup import render_bbcode
register = Library()
@register.filter
def thumbnail(file, size='200x200'... | MehmetNuri/ozgurlukicin | st/templatetags/library.py | Python | gpl-3.0 | 4,221 |
# import yaml
# import json
# import sql
import psycopg2
# import datetime
# import pprint
# # connect to database makerspace
# conn = psycopg2.connect("host=localhost dbname=makerspace user=postgres")
# # open a cursor to perform database operations
# cur = conn.cursor()
# sdb = StudentDatabase( "host", "db_name", ... | aradler/Card-lockout | server/StudentDatabase.py | Python | mit | 12,892 |
# Copyright 2014 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | jonparrott/gcloud-python | api_core/tests/unit/test_exceptions.py | Python | apache-2.0 | 7,078 |
"""Runtime entry data for ESPHome stored in hass.data."""
import asyncio
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple
from aioesphomeapi import (
COMPONENT_TYPE_TO_INFO,
BinarySensorInfo,
CameraInfo,
ClimateInfo,
CoverInfo,
DeviceInfo,
EntityInfo,
En... | tboyce021/home-assistant | homeassistant/components/esphome/entry_data.py | Python | apache-2.0 | 6,177 |
"""
Student Views
"""
import datetime
import feedparser
import json
import logging
import random
import re
import string # pylint: disable=W0402
import urllib
import uuid
import time
from django.conf import settings
from django.contrib.auth import logout, authenticate, login
from django.contrib.auth.models impor... | pdehaye/theming-edx-platform | common/djangoapps/student/views.py | Python | agpl-3.0 | 51,566 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.