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 |
|---|---|---|---|---|---|
"""Command to compare a Git tree against CVS."""
import os
import re
import subprocess
from subprocess import PIPE
import sys
from cvsgit.cvs import split_cvs_source
from cvsgit.git import GitCommandError
from cvsgit.i18n import _
from cvsgit.main import Command, Conduit
from cvsgit.utils import Tempdir, stripnl
cla... | ustuehler/git-cvs | cvsgit/command/verify.py | Python | isc | 4,467 |
from math import radians, cos, sin, asin, sqrt
def haversine(lon1, lat1, lon2, lat2):
'''
Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
'''
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, ... | annahs/atmos_research | haversine_calculator.py | Python | mit | 523 |
# functions that implement analysis and synthesis of sounds using the Stochastic Model
# (for example usage check stochasticModel_function.py in the models_interface directory)
import numpy as np
from scipy.signal import hanning, resample
from scipy.fftpack import fft, ifft
import utilFunctions as UF
def stochasticMo... | georgid/sms-tools | software/models/stochasticModel.py | Python | agpl-3.0 | 6,831 |
"""
=====================================================================
Reconstruction of the diffusion signal with the kurtosis tensor model
=====================================================================
The diffusion kurtois model is an expansion of the diffusion tensor model. In
addition to the diffusion t... | jyeatman/dipy | doc/examples/reconst_dki.py | Python | bsd-3-clause | 10,048 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'QuestionReport'
db.create_table(u'survey_questionreport', (
(u'question_ptr', se... | point97/hapifis | server/apps/survey/migrations/0036_auto__add_questionreport__del_field_question_filterBy__del_field_quest.py | Python | gpl-3.0 | 7,859 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Integration tests for :class:`iris.cube.Cube`."""
# Import iris.tests first so that some things can be initialised before
#... | pp-mo/iris | lib/iris/tests/integration/test_cube.py | Python | lgpl-3.0 | 2,218 |
# proxy module
from __future__ import absolute_import
from chaco.tools.data_label_tool import *
| enthought/etsproxy | enthought/chaco/tools/data_label_tool.py | Python | bsd-3-clause | 96 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010, Monash e-Research Centre
# (Monash University, Australia)
# Copyright (c) 2010, VeRSI Consortium
# (Victorian eResearch Strategic Initiative, Australia)
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are per... | nrmay/hpctardis | tardis/tardis_portal/tests/test_models.py | Python | bsd-3-clause | 11,660 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Li... | Mendelone/forex_trading | Algorithm.Python/UpdateOrderRegressionAlgorithm.py | Python | apache-2.0 | 5,973 |
from AppKit import NSSearchField
from vanillaBase import VanillaBaseControl
class SearchBox(VanillaBaseControl):
"""
A text entry field similar to the search field in Safari.::
from vanilla import *
class SearchBoxDemo(object):
def __init__(self):
self.w = Windo... | bitforks/vanilla | Lib/vanilla/vanillaSearchBox.py | Python | mit | 2,743 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from apex.contrib.multihead_attn import fast_mask_softmax_dropout_func
from bmm1 import *
from bmm2 import *
from padding import *
from softmax import *
class FastUnpadBertSelfAttention(nn.Module):
def __init__(self, config, enable_stream=True, e... | mlperf/training_results_v0.7 | NVIDIA/benchmarks/bert/implementations/pytorch/mha.py | Python | apache-2.0 | 7,152 |
try:
from bs4 import BeautifulSoup
except ImportError:
BeautifulSoup = None
import re
import urllib.parse
from xl.lyrics import LyricSearchMethod, LyricsNotFoundException
from xl import common, providers
def enable(exaile):
"""
Enables the lyric wiki plugin that fetches track lyrics
from lyrics.w... | exaile/exaile | plugins/lyricwiki/__init__.py | Python | gpl-2.0 | 2,155 |
import re
from bs4 import BeautifulSoup
import codecs
from crawler import crawler_helper as crawler
# TODO modify for Hindi and English
def extract_intros(topic_name):
filename = '../../data/raw/intros/' + topic_name + '.txt'
with codecs.open(filename, "w", "utf-8") as output_file:
# for introductor... | anshuli-patil/secret-project | src/crawler/intro_crawler.py | Python | gpl-3.0 | 1,127 |
class MaxAttemptsExceededException(Exception):
def __init__(self, err=""):
self.message = str(err)
def __str__(self):
return self.message
| ISISComputingGroup/EPICS-inst_servers | server_common/common_exceptions.py | Python | bsd-3-clause | 163 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
types = {
'astakos': 'identity',
'cyclades': 'compute',
'pithos': 'storage',
... | grnet/synnefo | snf-astakos-app/astakos/im/migrations/old/0033_service_type.py | Python | gpl-3.0 | 23,883 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016, Germán Fuentes Capella <development@fuentescapella.com>
# BSD 3-Clause License
#
# Copyright (c) 2017, Germán Fuentes Capella
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... | germfue/vps-tools | vps/tool/__init__.py | Python | bsd-3-clause | 1,685 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Stephen Fromm <sfromm@gmail.com>
# 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.0',
... | Tatsh-ansible/ansible | lib/ansible/modules/system/group.py | Python | gpl-3.0 | 13,823 |
from __future__ import absolute_import
from __future__ import print_function
import owmeta as P
import datetime
from yarom.quantity import Quantity
from owmeta.channel import Channel
from owmeta.channelworm import PatchClampChannelModel, PatchClampExperiment
from owmeta.context import Context
from owmeta.evidence impor... | openworm/PyOpenWorm | examples/channel.py | Python | mit | 1,234 |
# Copyright 2014 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | mariusvniekerk/ibis | ibis/expr/tests/mocks.py | Python | apache-2.0 | 13,683 |
# -*- coding: utf-8 -*-
import res_partner
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| levkar/odoo-addons | partner_person/__init__.py | Python | agpl-3.0 | 130 |
"""Functional tests for the Ruleset features such as:
- Configuring a report
- Interpolating tags correctly
- Adjust the message (headers/body)
etc.
"""
from __future__ import absolute_import
import os
import tests.util
import unittest
from tests.util import GTUBE
PRE_CONFIG = """
report _REPORT_
"""
# Define... | SpamExperts/SpamPAD | tests/functional/test_ruleset.py | Python | gpl-2.0 | 7,584 |
#
# Copyright (C) 2008-2009 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License version 3 as published by the Free
# Software Foundation.
#
# This program is distributed in the... | UNINETT/nav | python/nav/web/devicehistory/urls.py | Python | gpl-2.0 | 1,725 |
from __future__ import unicode_literals
import pytz
from nose.tools import * # flake8: noqa
from api.base.settings.defaults import API_BASE
from api_tests import utils as api_utils
from framework.auth.core import Auth
from tests.base import ApiTestCase, capture_signals
from tests.factories import (
ProjectFacto... | abought/osf.io | api_tests/files/views/test_file_detail.py | Python | apache-2.0 | 18,808 |
from flask import Blueprint, render_template, flash, request, redirect, url_for
from flask.ext.login import login_user, logout_user, login_required
from minions.extensions import cache
from minions.forms import LoginForm
from minions.models import User
main = Blueprint('main', __name__)
@main.route('/')
@cache.cach... | kuberkaul/Minions | minions/controllers/main.py | Python | bsd-2-clause | 1,053 |
from .mrtrix3 import load_mif
from .dsi_studio import load_fib, load_fixels_from_fib
| mattcieslak/MITTENS | mittens/external/__init__.py | Python | bsd-2-clause | 85 |
# -*- coding: utf-8 -*-
"""
Adds a new couple category that will be used to track rewards given
to members of the community who make security disclosures.
"""
from django.db import migrations
from oscar.apps.catalogue.categories import create_from_breadcrumbs
from oscar.core.loading import get_model
Category = get... | eduNEXT/edunext-ecommerce | ecommerce/extensions/catalogue/migrations/0037_add_sec_disc_reward_coupon_category.py | Python | agpl-3.0 | 1,420 |
#!/usr/bin/env python
import logging
from cocaine.asio.exceptions import LocatorResolveError
from cocaine.worker import Worker
import log
try:
log.setup_logger('mm_inventory_logging')
logger = logging.getLogger('mm.init')
except LocatorResolveError:
log.setup_logger()
logger = logging.getLogger('mm.i... | nobodyisme/mastermind_toshik | src/cocaine-app/inventory_worker.py | Python | gpl-2.0 | 1,119 |
# You may assume no duplicate
class Solution(object):
def findMin(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
lo, hi = 0, len(nums) - 1
if nums[hi] >= nums[lo]:
return nums[lo]
while lo < hi:
mid = (lo + hi) >> 1
... | wufangjie/leetcode | 153. Find Minimum in Rotated Sorted Array.py | Python | gpl-3.0 | 652 |
#!/usr/bin/env python2
from distutils.core import setup, Extension
import os
import subprocess
import sys
def pkg_config(package):
if os.name == "nt":
if package == "MagickCore":
# pkg-config cannot be used, try to find needed libraries from the filesystem
import fnmatch
... | mlq/fMBT | utils/setup.py | Python | lgpl-2.1 | 4,003 |
def Setup(Settings, DefaultModel):
# set5-osm-model-variable-widths-depths/set5_w32_depth2_d1.py
Settings["experiment_name"] = "set5_w32_depth2_d1"
Settings["graph_histories"] = [] # ['all','together',[],[1,0],[0,0,0],[]]
n = 0
#d1 5556x_markable_640x640 SegmentsData_marked_R100_4... | previtus/MGR-Project-Code | Settings/set5-osm-model-variable-widths-depths/set5_w32_depth2_d1.py | Python | mit | 1,670 |
"""
Created on Thu Mar 24 08:18:04 2016
@author: npop
The windower takes the data for a decimation level
And a reference time to reference the window to
And then calculates number of windows
And gives access to windows
The important thing is that windows can be compared to each other
Can also choose to save a window
... | nss350/magPy | core/windower.py | Python | apache-2.0 | 7,417 |
# coding=utf-8
from functools import wraps
from flask import abort
from flask_login import current_user
from app.models import Permission
def permission_require(permission):
def decorators(f):
@wraps(f)
def decorators_function(*args, **kwargs):
if not current_user.can(permission):
... | xcLtw/small-blog | app/decorators.py | Python | gpl-3.0 | 521 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'walker_lee'
import os
# __file__ refers to the file settings.py
APP_ROOT = os.path.dirname(os.path.abspath(__file__)) # refers to application_top
APP_STATIC = os.path.join(APP_ROOT, 'website/static/')
# 端口配置
API_PORT = 15102
ADMIN_PORT = 15103
# Blueprint... | alexli0707/pyforum | configs/config_local.py | Python | apache-2.0 | 1,856 |
import feedparser
def test(url):
rss = feedparser.parse(url)
return rss.entries[0]['link']
def test_answer():
result = test('https://www.reddit.com/r/all/.rss')
if 'reddit' in result:
return 0
else:
return 1
if __name__ == "__main__":
test_answer()
| dmckinney5/SlackOff | test.py | Python | mit | 264 |
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.template import Template, TemplateSyntaxError, TemplateDoesNotExist
from django.utils.encoding import force_text
from .compat import text_type
def validate_email_with_name(value):
"""
Validate ema... | saukrIppl/seahub | thirdpart/django_post_office-2.0.6-py2.7.egg/post_office/validators.py | Python | apache-2.0 | 1,399 |
#!/usr/bin/env python
# -*-:coding:utf-8-*-
import wx
import os
import json
import sys
import converter.dictionary as dictionary
import converter.formulate as formulate
class mainWindow(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, wx.ID_ANY, title, size = (wx.DisplaySize... | blindtex/blindtex | blindtex/gui/dictionariesGUI.py | Python | gpl-3.0 | 12,696 |
import _plotly_utils.basevalidators
class LenmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="lenmode", parent_name="treemap.marker.colorbar", **kwargs
):
super(LenmodeValidator, self).__init__(
plotly_name=plotly_name,
p... | plotly/python-api | packages/python/plotly/plotly/validators/treemap/marker/colorbar/_lenmode.py | Python | mit | 545 |
import unittest
from ticdat.pandatfactory import PanDatFactory
from ticdat.utils import DataFrame, numericish, ForeignKey, ForeignKeyMapping
import ticdat.utils as utils
from ticdat.testing.ticdattestutils import fail_to_debugger, flagged_as_run_alone, spacesSchema, firesException
from ticdat.testing.ticdattestutils im... | opalytics/opalytics-ticdat | ticdat/testing/testpandat_io.py | Python | bsd-2-clause | 34,733 |
# -*- coding: iso-8859-1 -*-
# (c) 2006 Stephan Reichholf
# This Software is Free, use it where you want, when you want for whatever you want and modify it if you want but don't remove my copyright!
from __future__ import print_function
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from ... | openatv/enigma2 | lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py | Python | gpl-2.0 | 4,091 |
#!/usr/bin/env python
'''
ZCR Shellcoder
ZeroDay Cyber Research
Z3r0D4y.Com
Ali Razmjoo
'''
import binascii
def run(path_file,content):
skip = 0
if '8' in str(len(content)) or '9' in str(len(content)):
length = str(hex(int(str(len(content)))))
skip = 1
if skip is 0:
length = str(hex(int(str(len(content)),8)))... | firebitsbr/ZCR-Shellcoder | lib/generator/linux_x86/write.py | Python | gpl-3.0 | 4,933 |
from django.conf.urls import patterns, url
from readings import views
urlpatterns = patterns('',
url(r'^$', views.reading, name='book'),
url(r'^payment/$', views.book, name='payment'),
# ex: /polls/5/vote/
url(r'^thankyou/$', views.thankyou, name='thankyou'),
) | cs98jrb/Trinity | mysite/readings/urls.py | Python | gpl-2.0 | 281 |
""" DIRAC.TransformationSystem.Service package """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| yujikato/DIRAC | src/DIRAC/TransformationSystem/Service/__init__.py | Python | gpl-3.0 | 160 |
from BaseHTTPServer import BaseHTTPRequestHandler
from BaseHTTPServer import HTTPServer
import logging
import requests
from threading import Thread
import urlparse
import os
FIXTURES_BASE = 'frontend/tests/fixtures/functional/'
logger = logging.getLogger(__name__)
def _load_json(name):
return open("%s/%s.json" ... | annapowellsmith/openpresc | openprescribing/frontend/tests/functional/mock_api_server.py | Python | mit | 4,913 |
from collections import defaultdict
from collections import OrderedDict
import logging
import operator
import re
import pandas as pd
import numpy as np
from sklearn.base import BaseEstimator,TransformerMixin
import time
logger = logging.getLogger(__name__)
class Binary_transform(BaseEstimator,TransformerMixin):
... | smrjan/seldon-server | python/build/lib/seldon/pipeline/basic_transforms.py | Python | apache-2.0 | 12,726 |
import sys
# where RobotControl.py, etc lives
sys.path.append('/home/pi/Desktop/ADL/YeastRobot/PythonLibrary')
from RobotControl import *
#################################
### Define Deck Layout
#################################
deck="""\
DW96P DW96W DW96W BLANK BLANK
DW96P DW96W DW96W BLANK BLANK
DW96P DW... | tdlong/YeastRobot | UserPrograms/ASE/Mon_PrebeadsFix_3.py | Python | gpl-3.0 | 2,163 |
#
# Copyright (C) 2011 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License version 2 as published by the Free
# Software Foundation.
#
# This program is distributed in the hope... | sigmunau/nav | python/nav/web/seeddb/urls.py | Python | gpl-2.0 | 6,889 |
from __future__ import annotations
import argparse
import dataclasses
from datetime import datetime, timedelta, timezone
from typing import NamedTuple, Optional, Tuple
from redbot.core.commands import BadArgument, Context
from .time_utils import parse_time, parse_timedelta
class NonNumeric(NamedTuple):
parsed:... | mikeshardmind/SinbadCogs | scheduler/converters.py | Python | mit | 4,607 |
import base64
from datetime import datetime, timedelta, timezone
import json
from docutils.core import publish_string
from django.db import models
from django.contrib.auth.models import User
from zwiki.sluggable.models import Sluggable
class Page(Sluggable):
"""A page in the wiki"""
UNLOCKED = 'UU'
LO... | williamscales/zwiki | zwiki/pages/models.py | Python | mit | 3,746 |
from django.contrib import admin
from django.db import models
from django.forms.widgets import TextInput
#from django.contrib.contenttypes.admin import *
# Register your models here.
from .models import *
class HighestPointsOptionsInline(admin.StackedInline):
model = HighestPointsOptions
min_num = 0
ex... | baryon5/mercury | voting/admin.py | Python | gpl-2.0 | 2,334 |
from lib.actions import YammerAction
__all__ = [
'ListMessagesFromTopicAction'
]
class ListMessagesFromTopicAction(YammerAction):
def run(self, topic_id):
yammer = self.authenticate()
messages = yammer.messages.about_topic(topic_id)
return messages
| tonybaloney/st2contrib | packs/yammer/actions/list_messages_about_topic.py | Python | apache-2.0 | 284 |
"""Paster Commands, for use with paster in your project
.. highlight:: bash
The following commands are made available via paster utilizing
setuptools points discovery. These can be used from the command line
when the directory is the Pylons project.
Commands available:
``controller``
Create a Controller and acc... | grepme/CMPUT410Lab01 | virt_env/virt1/lib/python2.7/site-packages/Pylons-1.0.1-py2.7.egg/pylons/commands.py | Python | apache-2.0 | 22,566 |
# -*- coding: latin-1 -*-
import re
import math
import urllib
from string import join
import traceback, sys
#from aifc import data
class JsFunctions:
def hp_d01(self, s):
ar=[]
os=""
for i in range(0,len(s)-1):
c = ord(s[i])
if c < 128:
c = c^2
... | siouka/dmind | plugin.video.SportsDevil/lib/utils/javascriptUtils.py | Python | gpl-2.0 | 9,859 |
#!/usr/bin/env python3
# coding=utf-8
from multiprocessing import Pool
import os
import time
import random
def long_time_task(name):
print('Run task %s (%s)...' % (name, os.getpid()))
start = time.time()
time.sleep(random.random() * 3)
end = time.time()
print('Task %s runs %0.2f seconds.' % (name... | tenlee2012/AllCode | Python/mul_process.py | Python | gpl-2.0 | 614 |
from LogAnalyzer import Test,TestResult
import DataflashLog
from math import sqrt
class TestIMUMatch(Test):
'''test for empty or near-empty logs'''
def __init__(self):
Test.__init__(self)
self.name = "IMU Mismatch"
def run(self, logdata, verbose):
#tuning parameters:
war... | zhumingliang1209/Ardupilot | ardupilot/Tools/LogAnalyzer/tests/TestIMUMatch.py | Python | gpl-3.0 | 4,071 |
# pylint: disable=print-statement, unnecessary-comprehension,missing-docstring,too-few-public-methods
"""Tests for loopvar-in-closure."""
from __future__ import print_function
from enum import Enum
def good_case():
"""No problems here."""
lst = []
for i in range(10):
lst.append(i)
def good_case... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/c/cellvar_escaping_loop.py | Python | mit | 2,708 |
import os
import time
import flask
import logging
import dropbox
import time_machine
import functools
import dropbox_flask_session
import forms
import tasks
from main import app
import pytz
timezone = pytz.timezone(app.config.get('TIMEZONE', 'UTC'))
if app.debug:
try:
import flask_debugtoolbar
too... | WoLpH/dropbox-time-machine | time_machine/web.py | Python | bsd-3-clause | 4,675 |
#!/anaconda/bin/python
# Usage:
# ./classify.py <CAGE_OUTPUT> <CONTIG> <BEDFILE_PREFIX> <PARAMS_FILE>
#
# Example:
# ./classify.py chr20_output.txt chr20 chr20_classified chr20_params.txt
import sys
from configparser import RawConfigParser
# hardcoded thresholds determining 'low' vs 'high' complexity regions
# thres... | adambloniarz/CAGe | scripts/classify.py | Python | apache-2.0 | 2,607 |
# JURASSIC PARK GOGGLES
#
# To find out how to do the Twitter authorization tokens
# go to projects.raspberrypi.org/en/projects/tweeting-babbage
#
# If you make these, please share them with me!
#
# This file is part of the Estefannie Explains It All repo.
#
# (c) Estefannie Explains It All
#
# For the full copyrigh... | estefanniegg/estefannieExplainsItAll | makes/JurassicGoggles/jurassic_park.py | Python | mit | 5,678 |
#!/usr/bin/python
# We are declaring variable "x" which contain string "There are %d types of people." , %d is replaced with 10
x = "There are %d types of people." % 10
# declare a varilable binary with value(String) "binary"
binary = "binary"
# Declare variable "do_not" , wich contains string "don't"
do_not = "don't... | mrniranjan/python-scripts | practice/ex6.py | Python | gpl-2.0 | 1,475 |
#!/usr/bin/python
#
# 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) any later version.
#
# Ansible is distribut... | jonathonwalz/ansible | lib/ansible/modules/network/junos/junos_config.py | Python | gpl-3.0 | 12,438 |
# Copyright 2012, 2013 by the Micromagnum authors.
#
# This file is part of MicroMagnum.
#
# MicroMagnum 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) a... | MicroMagnum/MicroMagnum | src/magnum/micromagnetics/io/write_vtk.py | Python | gpl-3.0 | 1,978 |
# Copyright (C) 2016 Equinor ASA, Norway.
#
# The file 'forward_load_context.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 o... | joakim-hove/ert | res/enkf/forward_load_context.py | Python | gpl-3.0 | 2,012 |
from setuptools import setup, find_packages
setup(name='MODEL0911532520',
version=20140916,
description='MODEL0911532520 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL0911532520',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/MODEL0911532520 | setup.py | Python | cc0-1.0 | 377 |
# -*- coding: utf-8 -*-
#
# license: AGPLv3, see LICENSE for details. In addition we strongly encourage
# you to buy us beer if we meet and you like the software.
"""General testing utilities."""
from datetime import datetime, timezone
import pytest
from itertools import count
import json
import sys
import u... | amiv-eth/amivapi | amivapi/tests/utils.py | Python | agpl-3.0 | 7,014 |
import json
import pathlib
from typing import Optional, Dict, Any
from .logger import Logger, Log
from .singleton import Singleton
class Settings(metaclass=Singleton):
def __init__(self, filepath: Optional[str] = None, reference_filepath: Optional[str] = None):
"""
Initialize settings with filep... | PetterKraabol/Twitch-Chat-Downloader | tcd/settings.py | Python | mit | 3,975 |
import collections
import datetime
import math
import subprocess
import asyncio
import random
import glob
import gc
import psutil
import sys
import re
import traceback
import argparse
import os
import logging
import requests
import logging.handlers
import discord
from bs4 import BeautifulSoup
from js... | chenzw95/Discord-Selfbot | appuselfbot.py | Python | gpl-3.0 | 45,590 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import djangocms_blog
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = djangocms_blog.__version__
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup(
n... | skirsdeda/djangocms-blog | setup.py | Python | bsd-3-clause | 1,991 |
import os
import fcntl
import types
import sys
import tempfile
import uuid
import code
import traceback
import threading
import signal
import signalfd
import operator
import re
import builtins
import functools
from ..utils import copy
from .. import iterio
from .. import redir
from .. import log
from . import ... | redhog/pieshell | pieshell/pipeline/pipe.py | Python | lgpl-3.0 | 1,783 |
# Copyright 2012 OpenStack LLC.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | wallnerryan/quantum_migrate | quantumclient/tests/unit/test_name_or_id.py | Python | apache-2.0 | 5,971 |
from plotlib import Item
class Text(Item):
def __init__(self, position, text, **options):
super().__init__(**options)
self.position = position
self.text = text
def render(self, ax, container):
opts = self.effective_options(container)
x, y = self.position
... | deffi/protoplot | plotlib/pl_text.py | Python | agpl-3.0 | 359 |
"""**Class projection**
"""
from osgeo import osr
# The projection string depends on the gdal version
DEFAULT_PROJECTION = '+proj=longlat +datum=WGS84 +no_defs'
def proj4_to_dict(P):
"""Helper to turn a proj4 string into a dictionary for ease of comparison
See issue #304
Args:
P: proj4 string, ... | Jannes123/inasafe | safe/storage/projection.py | Python | gpl-3.0 | 6,217 |
__author__ = 'ioparaskev'
from unittest import TestCase, mock
import prompt_handles
def mock_input(func):
def mock_input_builtin(*args):
with mock.patch('builtins.input', return_value=args[-1]):
return func(*args)
return mock_input_builtin
class TestPromptWrapper(TestCas... | ioparaskev/schulze_voting | tests/prompt_handles_tests.py | Python | mit | 4,289 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
for key in orm.ApiKey.objects.all():
try:
key.dat... | openplans/shareabouts-api | src/sa_api_v2/apikey/south_migrations/0007_copy_apikey_datasets.py | Python | gpl-3.0 | 6,284 |
#
# 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
# ... | rdo-management/heat | heat/engine/constraints.py | Python | apache-2.0 | 19,465 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ---------------------------------------
# Gamification
# ---------------------------------------
# Twitter Sentiment Analyzer
# ---------------------------------------
# CIS 496H - Term Project
# Instructor - Gabriel Murray
# Created by - Radha Satam [300130632]
#
# GetT... | RadhaSatam/Gamification---Twitter-Sentiment-Analyzer | GetTweets.py | Python | mit | 1,880 |
from unittest import TestCase
import urlparse
import ltc_scrypt
import weakref
import binascii
import StringIO
from binascii import unhexlify, hexlify
class Test(TestCase):
def test_powhash(self):
teststart = '700000005d385ba114d079970b29a9418fd0549e7d68a95c7f168621a314201000000000578586d149fd07b22f3a8a... | bitbandi/all-hash-python | algorithm/scrypt-hash/test.py | Python | mit | 625 |
"""Constants for Met component."""
from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT,
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_FOG,
ATTR_CONDITION_LIGHTNING_RAINY,
ATTR_CONDITION_PARTLYCLOUDY,
ATTR_CONDITION_POURING,
ATTR_CONDITION_RAINY,
ATTR_CONDITION_SNOWY,
AT... | jawilson/home-assistant | homeassistant/components/met/const.py | Python | apache-2.0 | 5,750 |
#!/usr/bin/python
# qbox_dos.py: extract electronic DOS from Qbox output
# generate DOS plot in gnuplot format
# use: qbox_dos.py [-last] emin emax width file.r
# emin, emax: bounds of plot in [eV]
# width: gaussian broadening in [eV]
# the DOS is accumulated separately for each spin
# With the -last option, only the l... | yaoyi92/qbox_libxc | util/qbox_dos.py | Python | gpl-2.0 | 2,774 |
# Maildir folder support
# Copyright (C) 2002-2015 John Goerzen & contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option... | Redsift/offlineimap | offlineimap/folder/Maildir.py | Python | gpl-2.0 | 18,679 |
from flask import request
from flask_restful import Resource
from app import api
from app.auth import require_token
from app.handler.dbHelper import DBHelper
from app.handler.error_handler import CustomError, NotAllowed
__author__ = 'Xiaoxiao.Xiong'
class ReceiptAPI(Resource):
"""
Consent Receipt API
"""... | dhrproject/mydatasource | DataSource/app/views/receipt.py | Python | mit | 1,378 |
# Copyright 2015, Province of British Columbia
# License: https://github.com/bcgov/ckanext-bcgov/blob/master/license
from ckan.common import c, _
import pylons.config as config
import ckan.lib.base as base
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
from routes.mapper import SubMapper
fr... | gjlawran/ckanext-bcgov | ckanext/bcgov/plugin.py | Python | agpl-3.0 | 17,900 |
#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self)
@process_method # Process - triggered each time it's run
... | sparkslabs/guild | examples/dogs_go_woof_actors.py | Python | apache-2.0 | 988 |
# -*- coding: utf-8 -*-
# daemon/pidfile.py
# Part of ‘python-daemon’, an implementation of PEP 3143.
#
# Copyright © 2008–2015 Ben Finney <ben+python@benfinney.id.au>
#
# This is free software: you may copy, modify, and/or distribute this work
# under the terms of the Apache License, version 2.0 as published by the
#... | madflow/qnap-radicale | shared/lib/daemon/pidfile.py | Python | gpl-2.0 | 2,139 |
import os
import sys
from .templatelang import TemplateLanguage
lang = TemplateLanguage(openseq='{%', closeseq='%}')
@lang.add_tag
def include(path, context={}):
'''
Renders the content of a file. File paths should be relative
to the site's root folder. Ex: {% include nav.html %}
'''
fullpath = o... | braceio/tags | tags/tags.py | Python | mit | 1,826 |
# -*- coding: utf-8 -*-
import csv
import io
from django.http import HttpResponse
from package.models import Project
def package_csv(request):
output = io.StringIO()
fieldnames = ['title', 'created', 'num_participants', 'pypi_downloads', 'repo_forks', ]
writer = csv.DictWriter(output, fieldnames=fie... | noisy/steemprojects.com | reports/views.py | Python | mit | 950 |
# North Arrow
#
# Ladybug: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
#
# This file is part of Ladybug.
#
# Copyright (c) 2013-2015, Mostapha Sadeghipour Roudsari <Sadeghipour@gmail.com>
# Ladybug is free software; you can redistribute it and/or modify
# it under the terms of... | boris-p/ladybug | src/Ladybug_North.py | Python | gpl-3.0 | 5,035 |
# Here we test writing to a captured variable via the `nonlocal` keyword (see `out`).
# We also test reading one captured variable and writing the value to another (see `through`).
# All functions starting with "test_" should run and execute `print("OK")` exactly once.
# This can be checked by running validTest.py.
i... | github/codeql | python/ql/test/experimental/dataflow/variable-capture/nonlocal.py | Python | mit | 2,180 |
################################################################################
# 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... | apache/flink | flink-python/pyflink/common/completable_future.py | Python | apache-2.0 | 3,240 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('basket', '0006_basket_site'),
]
operations = [
migrations.CreateModel(
name='BasketAttribute',
fields=[
('id', models.AutoF... | edx/ecommerce | ecommerce/extensions/basket/migrations/0007_auto_20160907_2040.py | Python | agpl-3.0 | 1,452 |
# -*- coding: UTF-8 -*-
# Copyright (c) 2006, 2011, 2013-2017 Matthew Zipay.
#
# 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 ... | mzipay/Aglyph | test/test_format_dotted_name.py | Python | mit | 5,100 |
# Author : Antoine Broyelle
# Licence : MIT
# inspired by : KTH - DD2432 : Artificial Neural Networks and Other Learning Systems
# https://www.kth.se/student/kurser/kurs/DD2432?l=en
import numpy as np
import sys
class PCN:
'''Perceptron. Based on McCulloch and Pitts neurons'''
def __init__(self, inputs, targ... | antoinebrl/practice-ML | pcn.py | Python | mit | 5,893 |
"""empty message
Revision ID: 8394f226cadd
Revises: 0edf64a31311
Create Date: 2017-08-15 10:50:05.796139
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8394f226cadd'
down_revision = '0edf64a31311'
branch_labels = None
depends_on = None
def upgrade():
# ... | anapaulagomes/to-vendendo | migrations/versions/8394f226cadd_.py | Python | mit | 987 |
import magic
from flask import Blueprint, Response, render_template, jsonify
from flask.ext.restful import Api, Resource, fields, marshal_with, marshal, reqparse
from werkzeug.datastructures import FileStorage
from werkzeug.utils import secure_filename
import files_persistence as fp
app = Blueprint('files', __name__... | fahadshaon/dev_journal | dev_journal/files/files_web.py | Python | mit | 2,225 |
"""distutils.file_util
Utility functions for operating on single files.
"""
import os
from distutils.errors import DistutilsFileError
from distutils import log
# for generating verbose output in 'copy_file()'
_copy_action = { None: 'copying',
'hard': 'hard linking',
'sym': 'symbo... | ruibarreira/linuxtrail | usr/lib/python3.4/distutils/file_util.py | Python | gpl-3.0 | 7,812 |
import re
import logging
import hashlib
from flask import request
logger = logging.getLogger(__name__)
# django url regex
re_URL = re.compile(
r'^(?:http|ftp)s?://' # http:// or https://
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain...
r'localhost|' #localhost...... | tomazk/thumbproxy | thumbproxy/request_data.py | Python | mit | 1,513 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "instasleuth.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sumit12dec/instasleuth | instasleuth/manage.py | Python | mit | 254 |
# Joshua Mazur (carpeyoyo.github.io)
# Last Edited: Mar. 29, 2017
# Sleeps to test interrupt
# See included License file for license
import PyRule
import time
# Simple program to demonstrate printing to PyRule's program output.
# This program does not cause anything to be drawn.
def main():
print("Before Sleep")... | carpeyoyo/PyRule | PythonExample/sleep.py | Python | gpl-3.0 | 373 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | Johnzero/OE7 | openerp/addons/mail/mail_mail.py | Python | agpl-3.0 | 16,471 |
from MorcoWrapper2D.mw2_GameObject import *
from MorcoWrapper2D.mw2_Vector2 import *
from MorcoWrapper2D.mw2_Application import *
import pygame
class mw2_Image (mw2_GameObject):
def __init__(self, name, fileName):
mw2_GameObject.__init__(self, name)
self.mSize = mw2_Vector2()
# private
self.mImage = pygame.im... | MorcoFreeCode/2014__MorcoWrapper2D | full_project/2D/3. PyGame [Python2]/MorcoWrapper2D/mw2_Image.py | Python | mit | 1,110 |
# -*- coding: utf-8 -*-
#
# AWL simulator - instructions
#
# Copyright 2012-2014 Michael Buesch <m@bues.ch>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
... | Vignesh2208/Awlsim | awlsim/core/instructions/insn_asin.py | Python | gpl-2.0 | 1,437 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.