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 |
|---|---|---|---|---|---|
# 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) any later version.
# This program is distributed in the hope that it will be useful,
# but... | pierg75/pier-sosreport | sos/plugins/nis.py | Python | gpl-2.0 | 1,203 |
# -*- coding: utf-8 -*-
"""
Authors: Tim Hessels and Gonzalo Espinoza
UNESCO-IHE 2018
Contact: t.hessels@unesco-ihe.org
g.espinoza@unesco-ihe.org
Repository: https://github.com/wateraccounting/wa
Module: Collect/HiHydroSoil
Restrictions:
The data and this python file may not be distributed to others ... | wateraccounting/wa | Collect/HiHydroSoil/__init__.py | Python | apache-2.0 | 830 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | klinger/volunteer_planner | accounts/migrations/0001_initial.py | Python | agpl-3.0 | 769 |
'''
bisect(sequence, item) => index ·µ»ØÌõÄ¿²åÈëºóµÄË÷ÒýÖµ, ²»¶ÔÐòÁÐ×öÈκÎÐÞ¸Ä.
Èç ÏÂÀý Ëùʾ.
'''
import bisect
list = [10, 20, 30]
print list
print bisect.bisect(list, 25)
print bisect.bisect(list, 15) | iamweilee/pylearn | bisect-example-2.py | Python | mit | 205 |
import json
from random import randint
class Generator:
"""Generate aleatory data readable by Tartopum."""
def __init__(self, rows_len=5, min_row_len=3, max_row_len=15,
row_name="row-{}"):
self.rows_len = rows_len
self.min_row_len = min_row_len
self.max_row_len ... | tartopum/DataExamples | rows/json/generate.py | Python | mit | 2,012 |
# Copyright (c) 2016 Orange.
# 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 a... | openstack/networking-bagpipe-l2 | networking_bagpipe/db/models/head.py | Python | apache-2.0 | 814 |
#!/usr/bin/env python3
# ver 0.1 - coding python by Hyuntae Jung on 6/1/2017
import argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='Initial coordiante of particles for MC simulation')
## args
#parser.add_argument('-i', '--input', default='init... | jht0664/Utility_python_gromacs | MonteCarlo/python/initial.py | Python | mit | 9,683 |
# Copyright 2015 Red Hat Inc., Durham, North Carolina.
# All Rights Reserved.
#
# openscap-daemon 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 2.1 of the License, or
# (at your option)... | pthierry38/openscap-daemon | openscap_daemon/dbus_daemon.py | Python | lgpl-2.1 | 20,907 |
'''
Tests various branching and search strategies. Compares number of LPs solved
for different branching and searching strategies.
The result of the script is as follows (until python decides to change its
random number generator).
problem | branching strategy | search strategy | num lp
----------------------... | tkralphs/GrUMPy | test/test_strategies.py | Python | epl-1.0 | 8,386 |
#!/usr/bin/python2.5
# Copyright 2010 Google 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 ... | istevens/personfinder-search-api | app/admin.py | Python | apache-2.0 | 3,881 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-07-04 15:11
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | rehandalal/morgoth | morgoth/addons/migrations/0001_initial.py | Python | mpl-2.0 | 1,129 |
# Generated by Django 1.11.15 on 2019-01-24 15:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0146_remove_log_queries_switch'),
]
operations = [
migrations.AddField(
model_name='degree',
n... | edx/course-discovery | course_discovery/apps/course_metadata/migrations/0147_degree_hubspot_lead_capture_form_id.py | Python | agpl-3.0 | 495 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Author: Thomas Beucher
Module: ArmParameters
Description: -We find here all arm parameters
-we use a model of arm with two joints and six muscles
'''
import numpy as np
from GlobalVariables import pathWorkingDirectory
class ArmParameters:
'''
... | osigaud/ArmModelPython | 3RModel_Gao2/ArmModel/ArmParameters.py | Python | gpl-2.0 | 6,375 |
#!/usr/bin/env python2
from __future__ import print_function
import smtplib
import uuid
import urllib2
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
import os
import sys
from django.template import loader, Context
from django.conf import set... | archangdcc/avalon-extras | farm-manager/status-report/sendmail.py | Python | unlicense | 5,272 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow | tests/unit/gapic/dialogflow_v2beta1/test_environments.py | Python | apache-2.0 | 97,936 |
#!/usr/bin/env python3
"""
For a given vcf file, compare each variant and its reference sequence to
a set of motifs to determine if any are significantly altered.
Usage:
python motifs.py -i <input.vcf> -r <reference.fa> -m <motif.txt>
-o <output.vcf> [OPTIONS]
Args:
-i (required) <input.vcf>: Name of ... | j-andrews7/VENUSAR | venusar/motifs.py | Python | mit | 44,017 |
"""Utilities to manipulate JSON objects.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.txt, distributed as part of this software.... | cloud9ers/gurumate | environment/lib/python2.7/site-packages/IPython/utils/jsonutil.py | Python | lgpl-3.0 | 6,908 |
"""The vimdoc parser."""
from vimdoc import codeline
from vimdoc import docline
from vimdoc import error
from vimdoc import regex
def IsComment(line):
return regex.comment_leader.match(line)
def IsContinuation(line):
return regex.line_continuation.match(line)
def StripContinuator(line):
assert regex.line_c... | google/vimdoc | vimdoc/parser.py | Python | apache-2.0 | 3,977 |
import spirit.spiritlib as spiritlib
import ctypes
### Load Library
_spirit = spiritlib.LoadSpiritLibrary()
# The Bohr Magneton [meV / T]
_mu_B = _spirit.Constants_mu_B
_mu_B.argtypes = None
_mu_B.restype = scalar
def mu_B():
return _mu_B()
# The Boltzmann constant [meV / K]
_k_B ... | GPMueller/spirit | core/python/spirit/constants.py | Python | mit | 422 |
# -*- coding: utf-8 -*-
"""
Clock Plugin
Provides the datetime
"""
import datetime
from lib.decorators import never_raise
from lib.plugin import BasePlugin, BaseConfig
NAME = 'Clock'
class Plugin(BasePlugin):
DEFAULT_INTERVAL = 5
@never_raise
def update(self):
self.data['datetime'] = datetime.da... | mikesmth/pi-dashboard | lib/plugins/clock.py | Python | bsd-3-clause | 406 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Canonical
#
# Authors:
# Didier Roche
#
# 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; version 3.
#
# This program is distributed in the hope that ... | mbkulik/ubuntu-make | umake/frameworks/dart.py | Python | gpl-3.0 | 3,196 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
from lxml import etree, html
class Escape():
def __init__(self, text):
self.text = text
self.erro... | RemiZOffAlex/specialistoff.net | Python/crm/crmapp/lib/escape.py | Python | mit | 1,697 |
import random
import copy
from fractions import Fraction
def get_matrix(file_name="matrix_new.txt"):
file = open(file_name, "r")
A = []
for line in file:
A.append([Fraction(x) for x in line.split()])
return A
def print_file(A, comment = ""):
file = open("matrix_show.txt", "a")
file.wr... | Lamzin/myPython | Algebra/matrix_extreme.py | Python | gpl-2.0 | 8,779 |
from warnings import warn
import inspect
from .conflict import ordering, ambiguities, super_signature, AmbiguityWarning
from .utils import expand_tuples
import itertools as itl
class MDNotImplementedError(NotImplementedError):
""" A NotImplementedError for multiple dispatch """
def ambiguity_warn(dispatcher, am... | wxgeo/geophar | wxgeometrie/sympy/multipledispatch/dispatcher.py | Python | gpl-2.0 | 10,936 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | nzlosh/st2 | st2tests/st2tests/mocks/liveaction.py | Python | apache-2.0 | 4,369 |
#!/usr/bin/env python
# encoding: utf-8
"""
__init__.py
The MIT License (MIT)
Copyright (c) 2013 Matt Ryan
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 ... | mattvryan/audiofile | afmq/__init__.py | Python | mit | 3,351 |
#!/usr/bin/env python
# WidgetWindow.py
#
# Copyright (C) 2015-2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# The MainWindow for the Desktop Feedback Widget
from gi.repository import Gtk, Gdk, GObject
from kano.gtk3.application_window import ApplicationWindow
from kano.gt... | KanoComputing/kano-feedback | kano_feedback/WidgetWindow.py | Python | gpl-2.0 | 14,552 |
import json
import io
from os.path import join as pjoin
from config import CONVERSIONS, SIMULATIONS_PATH
def parse_map(name):
""" parses a map from a file. The first line contains the map width
and the second line contains the corresponding height, followed
by the actual map data.
See the example bel... | Tooa/trafficSim | ioutil.py | Python | apache-2.0 | 1,654 |
from django.utils.translation import pgettext_lazy
from django_filters.filters import ModelMultipleChoiceFilter
from geotrek.authent.filters import StructureRelatedFilterSet
from .models import SensitiveArea, Species
class SensitiveAreaFilterSet(StructureRelatedFilterSet):
species = ModelMultipleChoiceFilter(
... | GeotrekCE/Geotrek-admin | geotrek/sensitivity/filters.py | Python | bsd-2-clause | 633 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ZonalStatistics.py
---------------------
Date : August 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
**********... | alexbruy/QGIS | python/plugins/processing/algs/qgis/ZonalStatistics.py | Python | gpl-2.0 | 11,154 |
# -*- coding: utf-8 -*-
# Copyright 2013,2016 Christoph Reiter
#
# 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) any later version.
from _... | elbeardmorez/quodlibet | quodlibet/quodlibet/util/windows.py | Python | gpl-2.0 | 5,464 |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from moto.ec2.utils import (
filters_from_querystring,
sequence_from_querystring,
dhcp_configuration_from_querystring)
class DHCPOptions(BaseResponse):
def associate_dhcp_options(self):
dhcp_opt_id = self.quer... | silveregg/moto | moto/ec2/responses/dhcp_options.py | Python | apache-2.0 | 5,169 |
'''
Settings
========
.. versionadded:: 1.0.7
This module is a complete and extensible framework for adding a
Settings interface to your application. By default, the interface uses
a :class:`SettingsWithSpinner`, which consists of a
:class:`~kivy.uix.spinner.Spinner` (top) to switch between individual
settings panels... | jffernandez/kivy | kivy/uix/settings.py | Python | mit | 41,333 |
#!flask/bin/python
import imp
from migrate.versioning import api
from main import db
from main import SQLALCHEMY_DATABASE_URI
from main import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
migration = SQLALCHEMY_MIGRATE_REPO + ('/versions/%03d_migration.py' % (v+1))
tmp_mo... | YinYang-Coders/Campus-Canteen | db_migrate.py | Python | mit | 934 |
#!/usr/bin/env python3
import cmd
import json
import argparse
import requests
def grab_CLA():
"""
Return the command line arguments.
"""
parser = argparse.ArgumentParser()
parser.add_argument('--host', type=str, required=False,
help='Host to connect to.')
parser.add_a... | Klump3n/fem-gl | fem-gl-cmd.py | Python | gpl-3.0 | 2,382 |
"""
Tests that deepchem models make deterministic predictions.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import os
import tempfile
import ... | joegomes/deepchem | deepchem/models/tests/test_predict.py | Python | mit | 2,023 |
#
# Copyright 2017-2020 Manuel Barrette
#
# 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 is distribute... | Pattedetable/onde-sonore-stationnaire | onde_son_stat.py | Python | gpl-3.0 | 1,760 |
import sys
__all__ = ['TestCase']
if sys.version_info[:2] == (2, 6):
import contextlib
import collections
from unittest import TestCase as BaseTestCase
class SkipException(Exception):
pass
class ExceptionContext(object):
def __init__(self):
self.exception = None
... | b-jesch/service.fritzbox.callmonitor | resources/lib/PhoneBooks/pyicloud/vendorlibs/win32ctypes/tests/compat.py | Python | gpl-2.0 | 2,422 |
#!/usr/bin/env python2
'''
You should normally never use this! Use emcc instead.
This is a small wrapper script around the core JS compiler. This calls that
compiler with the settings given to it. It can also read data from C/C++
header files (so that the JS compiler can see the constants in those
headers, for the li... | PopCap/GameIdea | Engine/Source/ThirdParty/HTML5/emsdk/emscripten/1.30.0/emscripten.py | Python | bsd-2-clause | 75,271 |
###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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
##
## ht... | frivoal/presto-testo | wpt/websockets/autobahn/oberstet-Autobahn-643d2ee/lib/python/autobahn/__init__.py | Python | bsd-3-clause | 1,107 |
import seven_segment
import myhdl
from myhdl import *
code = [None] * 10
for key, val in seven_segment.encoding.items():
if 0 <= key <= 9:
code[key] = int(val, 2)
code = tuple(code)
def bcd2led(led, bcd, clock):
""" bcd to seven segment led convertor.
led: seven segment led output
bcd: bcd ... | cfelton/myhdl | example/cookbook/stopwatch/bcd2led.py | Python | lgpl-2.1 | 649 |
# Orthographic Spanish
public_name='Orthographic Spanish'
default_data='orthographic_spanish.txt'
default_neighbor_lexicon='orthographic_spanish.txt'
default_word_lexicon='orthographic_spanish.txt'
default_lookup_lexicon='orthographic_spanish.txt'
from subsyllabic_common import *
import orth.es as language
def transfor... | crr-ugent/wuggy | plugins/orthographic_spanish.py | Python | gpl-2.0 | 433 |
import requests
import time
from bs4 import BeautifulSoup
from Crawler.HduCrawler.HduConfig import HduUser
class HduScanner:
s = requests.session()
scan_url = 'http://acm.hdu.edu.cn/status.php?first=&pid=&user={}&lang=0&status=0'
def Analyse(self, html):
'''
f = open('/tmp/status.html','... | CKboss/VirtualJudgePY | Crawler/HduCrawler/HduScanner.py | Python | gpl-2.0 | 1,551 |
import json
from housepy import util, log, config, strings
from ingest import ingest_json_body, ingest_data
def parse(request):
log.info("sensornet.parse")
data = ingest_json_body(request)
try:
t_local = strings.as_numeric(data['t_local'])
data = data['data']
log.debug(json.... | brianhouse/okavango | ingest/sensornet.py | Python | mit | 1,122 |
#!/usr/bin/env python3
import sys
from subprocess import run, PIPE
from urllib.parse import urljoin
args = sys.argv[1:]
hostenv = args.pop(0) if args else 'dev'
user = args.pop(0) if args else 'whelk'
host = ('pgsql01-{}.libris.kb.se'.format(hostenv)
if '.' not in hostenv else hostenv)
new_ids, old_ids = []... | libris/librisxl | librisxl-tools/scripts/canonical-lddb-ids.py | Python | apache-2.0 | 942 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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 So... | ddurieux/alignak | alignak/eventhandler.py | Python | agpl-3.0 | 6,318 |
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from . import source as pythonparser_source, lexer as pythonparser_lexer, parser as pythonparser_parser, diagnostic as pythonparser_diagnostic
def parse_buffer(buffer, mode="exec", flags=[], version=None, engine=None):
""... | google/grumpy | third_party/pythonparser/__init__.py | Python | apache-2.0 | 2,511 |
# Padding needed if length of input is not a multiple of BLOCK_SIZE
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[:-ord(s[len(s)-1:])] | TheShellLand/pies | v3/Libraries/Crypto/AES_Padding_BLOCKSIZE.py | Python | mit | 182 |
from __future__ import division
import re
import cStringIO
from symbol import Symbol
from token import Token
class Parser(object):
tokenizer = r"""\s*(#`|#,@|#,|#'|,@|[('`,)]|"(?:[\\].|;|[^\\"])*"|;.*|[^\s('"`,;)]*)(.*)"""
eof_object = Symbol('#<eof-object>')
eol_object = Symbol('#<eol-object>')
paus... | perkinslr/pypyjs | addedLibraries/scheme/parser.py | Python | mit | 3,126 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website_django.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure th... | fanchunke1991/website_django | manage.py | Python | mit | 812 |
#! /usr/bin/env python3
bdf = 'wenquanyi_cjk_basic_9pt.bdf'
cpp = '../../src/bitmapfont_wqy.h'
##cpp = 'bitmapfont_wqy.h'
# FONTBOUNDINGBOX 12 14 0 -3
control_point = 14 - 3
h = 12
w = 12
w_half = 12 // 2
chars = 0
glyphs = []
def getKey(item):
return item[0]
if __name__ == '__main__':
with open(bdf) as f:... | BlisterB/Player | resources/wenquanyi/gen_wqy_font_cpp.py | Python | gpl-3.0 | 3,721 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^update/', views.update, name='update')
] | njustesen/coep-starcraft | http_server/sup/urls.py | Python | gpl-3.0 | 165 |
#!/usr/bin/env python
# Read mouse events if X isn't running -- for instance, on a Raspberry Pi.
# Needs root, or at least read access to /dev/input/*
import evdev
import select
import time
import sys
class MouseReader:
def __init__(self):
self.mousedevice = None
devices = map(evdev.InputDevice, ... | akkana/scripts | mouseevent.py | Python | gpl-2.0 | 2,847 |
"""Source estimate functions."""
# Authors: Annalisa Pascarella <a.pascarella@iac.cnr.it>
#
# License: BSD (3-clause)
import mne
import numpy as np
import os.path as op
from mne import get_volume_labels_from_src
from .import_data import write_hdf5
from .source_space import _create_MNI_label_files
def _process_stc... | neuropycon/ephypype | ephypype/source_estimate.py | Python | bsd-3-clause | 3,229 |
# -*- coding: utf-8 -*-
"""
flaskbb.utils.decorators
~~~~~~~~~~~~~~~~~~~~~~~~
A place for our decorators.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from functools import wraps
from flask import abort
from flask_login import current_user
from opens... | USStateDept/FPA_Core | openspending/forum/utils/decorators.py | Python | agpl-3.0 | 1,481 |
# Generated by Django 1.11.5 on 2017-11-07 13:33
import django.db.models.deletion
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('devices', '0005_auto_20171026_1835'),
]
operations = [
migrations.AddField(
... | MPIB/Lagerregal | devices/migrations/0006_device_used_in.py | Python | bsd-3-clause | 529 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
''' Update handler, gets new pictures from picasa
only admins should be allowed to access this.'''
# Copyright (C) 2009 Florian Heinle
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | fheinle/Photoblog | update.py | Python | gpl-3.0 | 4,607 |
# Copyright 2013, Red Hat, 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 ... | ge0rgi/cinder | cinder/api/contrib/snapshot_actions.py | Python | apache-2.0 | 4,496 |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for changes affecting tools/style_variable_generator/
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for mor... | endlessm/chromium-browser | tools/style_variable_generator/PRESUBMIT.py | Python | bsd-3-clause | 746 |
# This file is part of project Sverchok. It's copyrighted by the contributors
# recorded in the version control history of the file, available from
# its original location https://github.com/nortikin/sverchok/commit/master
#
# SPDX-License-Identifier: GPL3
# License-Filename: LICENSE
import numpy as np
from collecti... | DolphinDream/sverchok | utils/relax_mesh.py | Python | gpl-3.0 | 9,318 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... | Codlydodly/python-client | venv/lib/python2.7/site-packages/pyglet/gl/glxext_mesa.py | Python | mit | 2,103 |
# -*- coding: utf-8 -*-
"""Family module for Wikidata."""
#
# (C) Pywikibot team, 2012-2018
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
from pywikibot import config
from pywikibot import family
# The Wikidata family
class Family(family.WikimediaFamil... | Wesalius/EloBot | pywikibot/families/wikidata_family.py | Python | gpl-3.0 | 3,979 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 running dashd with -reindex and -reindex-chainstate options.
- Start a single node and generate 3... | dashpay/dash | test/functional/feature_reindex.py | Python | mit | 1,372 |
# Copyright 2018 Rackspace US Inc. 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... | openstack/octavia | octavia/tests/unit/common/test_data_models.py | Python | apache-2.0 | 17,864 |
from sklearn.datasets import load_digits
from sklearn.preprocessing import scale
from sklearn.decomposition import PCA
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
from sklearn import metrics
import numpy as np
# -----------------------------------------------------------------------------------... | HoussemCharf/FunUtils | machine learning/k_means_clustering.py | Python | mit | 4,867 |
#!/usr/bin/python
# Begin sequences.py
#---------------------------------------------------------------------------
"""
Originally written by Jesse Bloom, 2004.
Updated by Zach Sailer, 2017."""
#---------------------------------------------------------------------------
import random, shelve, os
#---------------------... | Zsailer/latticeproteins | latticeproteins/sequences.py | Python | gpl-3.0 | 4,953 |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 17 18:39:09 2017
@author: rstreet
"""
from . import query_db
from . import observation_classes
from . import utilities
from . import rome_fields_dict
from . import observing_tools
import copy
from . import obs_conditions_tolerances
def build_rea_obs(script_config,log=No... | ytsapras/robonet_site | scripts/rea_obs.py | Python | gpl-2.0 | 8,387 |
#!/usr/bin/env python
"""Imaging library"""
from setuptools import find_packages, setup
setup(name = 'imaginglib',
version = '0.1',
description = "Imaging Library",
long_description = "For resizing, cropping, rotating and converting images",
platforms = ["Linux"],
author="Kumari Shalini",
auth... | shiminsh/imaginglib | setup.py | Python | mit | 456 |
import unittest
import string
import base64
import random
from sneakers.encoders.b64 import B64
class TestB64(unittest.TestCase):
def setUp(self):
self.randText = ''.join([random.choice(string.letters) for i in range(10)])
self.b64 = B64()
def test_encode(self):
encoded = self.b64.enc... | davinerd/sneaky-creeper | sneakers/tests/test_encoders/test_b64.py | Python | mit | 578 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2009 Ido Abramovich <ido.deluge@gmail.com>
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
# the additional special exception to link portions of this program wit... | rkokkelk/Gulliver | deluge/ui/console/commands/manage.py | Python | gpl-3.0 | 4,581 |
import json
from django.http import HttpResponse, JsonResponse
from django.core.mail import send_mail
from django.conf import settings
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.views.generic import CreateView
from django.utils.translation import ugettext as _
i... | eugena/django-mere-feedback | feedback/views.py | Python | bsd-3-clause | 3,945 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shu... | landism/pants | src/python/pants/backend/jvm/tasks/benchmark_run.py | Python | apache-2.0 | 4,864 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = '0.1.0'
| kezabelle/django-thadminjones | thadminjones/__init__.py | Python | gpl-2.0 | 69 |
from django import forms
class SearchForm(forms.Form):
params = forms.CharField(
label='Search field',
widget=forms.TextInput(
attrs={
"class": "form-control input-lg",
"autofocus": "true",
"placeholder": "Enter disease or disease area (e.... | rflbras/lmtt | stats/forms.py | Python | mit | 783 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-03-28 15:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('laboratory', '0020_auto_20170116_1147'),
]
operations = [
migrations.AddField... | solvo/organilab | src/laboratory/migrations/0021_object_imdg_code.py | Python | gpl-3.0 | 792 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Taifxx
#
# 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.... | Taifxx/xxtrep | context.addtolib/resources/lib/call.py | Python | gpl-3.0 | 28,359 |
import factory
from django.utils import timezone
from edc_constants.constants import YES, NO
from td_maternal.models import MaternalEligibility
class MaternalEligibilityFactory(factory.DjangoModelFactory):
class Meta:
model = MaternalEligibility
report_datetime = timezone.now()
age_in_years =... | botswana-harvard/tshilo-dikotla | td_maternal/tests/factories/maternal_eligibility_factory.py | Python | gpl-2.0 | 324 |
def test_thisIsAFunction_first_test(self):
# Given: these special conditions
obj = aClass()
parameter1 = "aString"
parameter2 = "anotherString"
# When: this specific thing happens
result = obj.thisIsAFunction(parameter1, parameter2)
... | anconaesselmann/ClassesAndTests | classes_and_testsTest/DocumentationFromUnitTestsTestData/TestData.py | Python | mit | 1,992 |
#!/usr/bin/python
#
# Copyright 2008-2010 WebDriver committers
# Copyright 2008-2010 Google 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... | gx1997/chrome-loongson | third_party/webdriver/python/test/selenium/webdriver/ie/test_ie_visibility_tests.py | Python | bsd-3-clause | 1,172 |
'''implements some basic number theory stuff: gcd, euler-phi function, inverts numbers modulo n.
'''
import functools
big_primes = 512927357,674506081
def find_a_factor(n):
for i in xrange(2, n):
if n%i == 0:
return n/i, i
return n, "Prime!"
def invert(a,n):
# multiplicative inverse ... | gabegaster/connectedness | number_theory.py | Python | mit | 2,698 |
#!/usr/bin/python
# --------------------------------------------------------------------------
#
# MIT License
#
# --------------------------------------------------------------------------
import pytest
import pickle
from cybld import cybld_ipc_message
# -------------------------------------------------------------... | dcvetko/cybld | tests/test_cybld_ipc_message.py | Python | mit | 3,079 |
import os
import jsonschema
import pytest
import numpy as np
import numpy.testing as npt
from io import StringIO
import logging
import pandas as pd
from pyxrf.xanes_maps.xanes_maps_api import (
_build_xanes_map_api,
_build_xanes_map_param_default,
_build_xanes_map_param_schema,
build_xanes_map,
che... | NSLS-II-HXN/PyXRF | pyxrf/xanes_maps/tests/test_xanes_maps_api.py | Python | bsd-3-clause | 16,067 |
"""
This file is part of contribution to the OAD Data Science Toolkit.
This 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.
The software is... | astro4dev/OAD-Data-Science-Toolkit | Teaching Materials/Machine Learning/Supervised Learning/Examples/PPC/EvaluationStats.py | Python | gpl-3.0 | 16,967 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# coala documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 6 21:18:18 2016.
#
# 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
# auto... | impmihai/coala | docs/conf.py | Python | agpl-3.0 | 9,703 |
#!/usr/bin/python
# (c) 2017-2022 Huwenbo Shi
import argparse, math, sys, logging, time
# main function
def main():
# get command line input
args = get_command_line()
# if shared sample size is 0 output 0
if args.ns == 0.0:
print 0.0
# parse cross-trait LDSC log
phenocor = None
... | huwenboshi/hess | misc/estimate_phenocor.py | Python | gpl-3.0 | 1,529 |
#!/usr/bin/env python3
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2018 NIWA & British Crown (Met Office) & 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... | matthewrmshin/cylc | lib/cylc/tests/test_cylc_subproc.py | Python | gpl-3.0 | 4,119 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Vladimir Chub
# All rights reserved.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# Author: Vladimir Chub
"""
TUVAN TOOLS. Yet another python toolkit. ;]
"""
__author__ = 'Vladimir Chub'
__... | vartagg/tuvan_tools | tuvan_tools.py | Python | bsd-3-clause | 5,479 |
# repo.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from git.exc import InvalidGitRepositoryError, NoSuchPathError
from git.cmd import Git
from git.util im... | dbaxa/GitPython | git/repo/base.py | Python | bsd-3-clause | 30,180 |
#!/usr/bin/env python
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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 ... | edespino/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/package/procedural_language/plpgsql_caching/functional/test_plpgsql.py | Python | apache-2.0 | 11,769 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v10/services/services/account_budget_proposal_service/transports/__init__.py | Python | apache-2.0 | 1,109 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sivigik.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | Klafyvel/Sivigik | manage.py | Python | agpl-3.0 | 805 |
from __future__ import unicode_literals
import swapper
from django.conf import settings
from django.db import models
from accelerator_abstract.models.accelerator_model import AcceleratorModel
DEFAULT_PANEL_SIZE = 10
class BaseScenario(AcceleratorModel):
name = models.CharField(max_length=40)
judging_round ... | masschallenge/django-accelerator | accelerator_abstract/models/base_scenario.py | Python | mit | 1,708 |
from django import template
register = template.Library()
@register.filter
def truncate_lines(text):
return '\n'.join(text.split('\n')[:300])
| nicksergeant/snipt | utils/templatetags/truncate_lines.py | Python | mit | 149 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
class OrderApp(CMSApp):
name = _("View Orders")
urls = ['shop.urls.order']
cache_placeholders = False
apphook_p... | rfleschenberg/django-shop | shop/cms_app.py | Python | bsd-3-clause | 343 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.opus_package import OpusPackage
class package(OpusPackage):
name = 'waterdemand'
required_opus_packages = ['opus_core']
| christianurich/VIBe2UrbanSim | 3rdparty/opus/src/waterdemand/opus_package_info.py | Python | gpl-2.0 | 272 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Radim Rehurek <me@radimrehurek.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Word vector storage and similarity look-ups. Common code independent of the way the vectors are trained(Word2Vec, FastText, WordRank, V... | ELind77/gensim | gensim/models/keyedvectors.py | Python | lgpl-2.1 | 37,089 |
# -*- coding: utf-8 -*-
from shoop.apps import AppConfig
class PugConfig(AppConfig):
name = "shoop_pugme"
provides = {
"admin_module": [
"shoop_pugme.admin_module:PugAdminModule"
]
}
| akx/shoop-pugme | shoop_pugme/apps.py | Python | mit | 227 |
from distutils import spawn
import mock
import pytest
import requests
from pyepm import config as c
config = c.get_default_config()
has_solc = spawn.find_executable("solc")
solc = pytest.mark.skipif(not has_solc, reason="solc compiler not found")
COW_ADDRESS = '0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826'
def is_h... | etherex/pyepm | test/helpers.py | Python | mit | 931 |
#
# 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 u... | joequant/Fudge-Python | fudgemsg/tests/func_tests/__init__.py | Python | apache-2.0 | 782 |
# 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
# distributed under t... | BiznetGIO/horizon | openstack_dashboard/dashboards/project/backups/forms.py | Python | apache-2.0 | 4,530 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.