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 |
|---|---|---|---|---|---|
from django.contrib.admin import ModelAdmin
from . import fields, forms
class I18nModelAdmin(ModelAdmin):
formfield_overrides_defaults = {
fields.I18nTextField: {"widget": forms.I18nTextarea},
fields.I18nCharField: {"widget": forms.I18nTextInput},
}
def __init__(self, *args, **kwargs):
... | raphaelm/django-i18nfield | i18nfield/admin.py | Python | apache-2.0 | 626 |
from distutils.version import LooseVersion
from django.core.management.base import BaseCommand
from django.utils.version import get_version
from django_rq import get_queue
class Command(BaseCommand):
"""
Queue a function with the given arguments.
"""
help = __doc__
def add_arguments(self, parse... | sbussetti/django-rq | django_rq/management/commands/rqenqueue.py | Python | mit | 1,188 |
# Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# 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, o... | dbbhattacharya/kitsune | vendor/packages/pylint/checkers/variables.py | Python | bsd-3-clause | 21,380 |
"""
@name: PyHouse/src/Modules/Web/web_nodes.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2014-2017 by D. Brian Kimmel
@license: MIT License
@note: Created on Dec 11, 2014
@Summary:
"""
__updated__ = '2019-10-08'
# Import system type stuff
import os
# from nevow impo... | DBrianKimmel/PyHouse | Project/src/Modules/Computer/Web/web_nodes.py | Python | mit | 2,309 |
#!/usr/bin/env python3
import os
from reader import fs, templates, morphgnt, ref
OUTPUT_DIR = "output"
template = templates.load("template.html")
def generate(verse, output_filename):
rows = [
{**row, "pos": morphgnt.pos(row), "parse": morphgnt.parse(row)}
for row in morphgnt.rows_for_verse(... | jtauber/online-reader | prototypes/morphgnt-interlinear/generate.py | Python | mit | 835 |
#!/usr/bin/python
# Tests p2p_find
# Will list all devices found/lost within a time frame (timeout)
# Then Program will exit
######### MAY NEED TO RUN AS SUDO #############
import dbus
import sys, os
import time
import gobject
import threading
import getopt
from dbus.mainloop.glib import DBusGMainLoop
def usage():
p... | s0lst1c3/eaphammer | local/hostapd-eaphammer/wpa_supplicant/examples/p2p/p2p_find.py | Python | gpl-3.0 | 4,731 |
import theano.tensor as T
import theano
from theano.ifelse import ifelse
import numpy as np
def test_4_conditionals():
a, b = T.scalars('a', 'b')
x, y = T.matrices('x', 'y')
f_switch = theano.function([a, b, x, y], T.switch(T.lt(a, b), T.mean(x), T.mean(y)))
f_lazy_ifelse = theano.function([a, b, x, ... | consciousnesss/learn_theano | learn_theano/basics_tutorials/test_4_conditionals.py | Python | apache-2.0 | 853 |
from vsg.rules import single_space_between_tokens
from vsg.token import component_declaration as token
class rule_007(single_space_between_tokens):
'''
This rule checks for a single space before the **is** keyword.
**Violation**
.. code-block:: vhdl
component fifo is
**Fix**
.... | jeremiah-c-leary/vhdl-style-guide | vsg/rules/component/rule_007.py | Python | gpl-3.0 | 589 |
""" test with the .transform """
import numpy as np
import pytest
from pandas._libs import groupby
from pandas.compat import StringIO
from pandas.core.dtypes.common import ensure_platform_int, is_timedelta64_dtype
import pandas as pd
from pandas import DataFrame, MultiIndex, Series, Timestamp, concat, date_range
fr... | MJuddBooth/pandas | pandas/tests/groupby/test_transform.py | Python | bsd-3-clause | 29,478 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, os, json
from frappe import _
from frappe.utils import get_timestamp
from frappe.utils import cint, today, formatdate
import frappe.defa... | neilLasrado/erpnext | erpnext/setup/doctype/company/company.py | Python | gpl-3.0 | 20,796 |
#!/usr/bin/python
import getopt, sys
import dpkt,socket
def usage():
print "dpkt_merge_pcap [-l input_pcap_file_list] [-o output_pcap_file]"
def main():
input_pcap_file_list="/dev/stdin"
output_pcap_file="/dev/stdout"
try:
opts, args = getopt.getopt(sys.argv[1:], "hl:o:", ["help", "input_pca... | t-umeno/dpkt_merge_pcap | dpkt_merge_pcap.py | Python | bsd-3-clause | 1,539 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Ericsson AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | EricssonResearch/calvin-base | calvin/runtime/north/plugins/requirements/device_scaling.py | Python | apache-2.0 | 3,073 |
# 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 unde... | stackforge/senlin | senlin/engine/actions/cluster_action.py | Python | apache-2.0 | 48,186 |
# -*- coding: utf-8 -*-
class Codes(object):
def __init__(self, **kws):
self._reverse_dict = {}
for k, v in kws.items():
self.__setattr__(k, v)
def str_value(self, value):
return self._reverse_dict[value]
def __setattr__(self, name, value):
super(Codes, self).... | RobbieClarken/channelarchiver | channelarchiver/structures.py | Python | mit | 703 |
# -*- coding: utf-8 -*-
import json
print "=================================="
# 5-1
print "=================================="
# 5-2
class Person(object):
def __init__(self, name, gender):
self.name = name
self.gender = gender
class Student(Person):
def __init__(self, name, gender, score):
... | llinmeng/PythonStudy | imooc/2jinjie/5.py | Python | mit | 6,001 |
# coding=utf-8
#
# BSD 3-Clause License
#
# Copyright (c) 2016-18, University of Liverpool
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the abov... | fsimkovic/conkit | conkit/applications/cdhit.py | Python | bsd-3-clause | 9,855 |
'''
OpenCV Camera: Implement CameraBase with OpenCV
'''
#
# TODO: make usage of thread or multiprocess
#
from __future__ import division
__all__ = ('CameraOpenCV')
from kivy.logger import Logger
from kivy.clock import Clock
from kivy.graphics.texture import Texture
from kivy.core.camera import CameraBase
try:
... | rnixx/kivy | kivy/core/camera/camera_opencv.py | Python | mit | 5,626 |
import random
nomes = '''Júlia Sophia Isabella Manuela Giovanna Alice Laura
Luiza Beatriz Mariana Yasmin Gabriela Rafaela Isabelle Lara
Letícia Valentina Nicole Sarah Vitória Isadora Lívia Helena
Lorena Clara Larissa Emanuelly Heloisa Marina Melissa Gabrielly
Eduarda Rebeca Amanda Alícia Bianca... | wsricardo/mcestudos | treinamento-webScraping/Abraji/adivinhandonúmeros05.py | Python | gpl-3.0 | 998 |
'''
Created on Sep 22, 2016
@author: rtorres
'''
from flaskiwsapp.settings.baseConfig import BaseConfig
class ProdConfig(BaseConfig):
"""Production configuration"""
ENV = 'prod'
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'postgresql://POSTGRES_USER:test@POSTGRES_PASSWORD:5432/POSTGRES_USER'
SERVER_N... | rafasis1986/EngineeringMidLevel | flaskiwsapp/settings/prodConfig.py | Python | mit | 583 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Adriano Monteiro Marques
#
# Author: Piotrek Wasilewski <wasilewski.piotrek@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Sof... | umitproject/network-admin | netadmin/events/templatetags/events_tags.py | Python | agpl-3.0 | 2,689 |
# proxy module
from __future__ import absolute_import
from scimath.units.angle import *
| enthought/etsproxy | enthought/units/angle.py | Python | bsd-3-clause | 88 |
from __future__ import unicode_literals
import swapper
from factory import (
Sequence,
SubFactory,
post_generation,
)
from factory.django import DjangoModelFactory
from .partner_factory import PartnerFactory
RefundCode = swapper.load_model('accelerator', 'RefundCode')
class RefundCodeFactory(DjangoMode... | masschallenge/django-accelerator | accelerator/tests/factories/refund_code_factory.py | Python | mit | 804 |
#!/usr/bin/env python
from setuptools import setup, find_packages
import functools
import os
_in_same_dir = functools.partial(os.path.join, os.path.dirname(__file__))
with open(_in_same_dir("pushbullet_cli", "__version__.py")) as version_file:
exec(version_file.read()) # pylint: disable=W0122
setup(
name="... | Saturn/pushbullet-cli | setup.py | Python | mit | 758 |
#!/usr/bin/env python
# Calculate a table of pairwise energies and forces between "INT" atoms
# in the lipid membrane model described in
# Brannigan et al, Phys Rev E, 72, 011915 (2005)
# The energy of this interaction U(r) = eps*(0.4*(sigma/r)^12 - 3.0*(sigma/r)^2)
# I realized later this is not what we want becau... | jcarlson23/lammps | tools/moltemplate/examples/CG_membrane_examples/membrane_BranniganPRE2005/moltemplate_files/version_charmm_cutoff/calc_table.py | Python | gpl-2.0 | 2,403 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from resources.datatables import FactionStatus
from java.util import Vector
def addTemplate(co... | ProjectSWGCore/NGECore2 | scripts/mobiles/generic/faction/imperial/imp_comm_security_guard_15.py | Python | lgpl-3.0 | 1,442 |
import pickle
import dataprepper
import outputgenerator
import sensorprocessor
root_folder = '/Users/philliphartin'
taut_folder = '/TAUT'
working_directory = root_folder + taut_folder
sensor_folder = '/SensorRecordings'
database_folder = '/ServerDatabase'
csv_log_file = '/ServerDatabase_2015_11_28_cleaned.csv'
windo... | pjhartin/taut-sensoranalysis-python | runme.py | Python | mit | 4,163 |
""" Custom command line validation parameters. """
import re
import sys
import click
from click.decorators import _param_memo
from gandi.cli.core.base import GandiContextHelper
class GandiChoice(click.Choice):
""" Base class for custom Choice parameters. """
gandi = None
def __init__(self):
... | ziir/gandi.cli | gandi/cli/core/params.py | Python | gpl-3.0 | 17,312 |
import os
import json
import requests
from fnmatch import filter as fnfilter
import pprint
import sys
# For this script to work correctly, you need to run
# pip install git+https://github.com/jirikuncar/dictdiffer@no-empty-lists
def spotlight_json(path):
for root, dirnames, filenames in os.walk(path):
fo... | alphagov/stagecraft | tools/test_dashboard_migration.py | Python | mit | 2,070 |
import herkulex
import time
herkulex.connect("/dev/ttyAMA0", 115200)
FR = herkulex.servo(0xfd)
FL = herkulex.servo(16)
BR = herkulex.servo(10)
BL = herkulex.servo(20)
ALL = herkulex.servo(0xfe)
#power = 1000
power = 1000
rtime = 1.54
#rtime = 20
calib = 0
calib = -50
corrpow = -300
ALL.torque_on()
FR.set_serv... | seiji56/rmaze-2016 | testes/correction_walk.py | Python | gpl-3.0 | 562 |
from test_suite.test_crispy import *
from test_suite.test_fields import *
from test_suite.test_files import *
from test_suite.test_misc import *
from test_suite.test_pre_processing import *
from test_suite.test_processors import *
from test_suite.test_text import *
from test_suite.test_utils import *
from test_suite.te... | un33k/django-smartfields | tests/test_app/tests/__init__.py | Python | mit | 337 |
import os
import time
if __name__ == "__main__":
i = 0
while True:
if i%60==0:
i = 0
file = r'request'
if os.path.exists(file):
os.remove(file)
#print "hello"
os.system("chmod +x regular.sh")
os.system("sudo ./regu... | starsight/hackathon | dragonBoard410c/regular/regular.py | Python | mit | 363 |
"""SCons.Tool.Packaging.ipk
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# 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 w... | kerwinxu/barcodeManager | zxing/cpp/scons/scons-local-2.0.0.final.0/SCons/Tool/packaging/ipk.py | Python | bsd-2-clause | 6,498 |
# Copyright (c) 2017 Huawei, 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 a... | Hybrid-Cloud/conveyor-dashboard | conveyordashboard/loadbalancers/panel.py | Python | apache-2.0 | 862 |
"""
tests.pytests.unit.beacons.test_bonjour_announce
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bonjour announce beacon test cases
"""
import pytest
import salt.beacons.bonjour_announce as bonjour_announce
@pytest.fixture
def configure_loader_modules():
return {
bonjour_announce: {"last... | saltstack/salt | tests/pytests/unit/beacons/test_bonjour_announce.py | Python | apache-2.0 | 801 |
# Copyright 2018 The Cirq Developers
#
# 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 ... | quantumlib/Cirq | cirq-core/cirq/value/timestamp.py | Python | apache-2.0 | 3,653 |
# Test the runpy module
import unittest
import os
import os.path
import sys
import tempfile
from test.support import verbose, run_unittest, forget
from runpy import _run_code, _run_module_code, run_module
# Note: This module can't safely test _run_module_as_main as it
# runs its tests in the current process, which wou... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/test/test_runpy.py | Python | mit | 9,925 |
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
#
# Trivial HTTP server for testing
# supports python 2.6+ & 3.2+
#
import random
import sys
import os
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler as Handler
except ImportError:
from http.server import SimpleHTTPRequestHandler as Handler
try:
impo... | hhru/graphite-dashboard | test_server.py | Python | mit | 838 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the Shiboken Python Bindings Generator project.
#
# Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
#
# Contact: PySide team <contact@pyside.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms... | o11c/shiboken2 | tests/samplebinding/derived_test.py | Python | gpl-2.0 | 5,748 |
#!/usr/bin/env python
'''
catalog_harvesting/__init__.py
'''
import logging
import os
__version__ = '1.2.0'
LOGGER = None
def get_logger():
'''
Returns an initialized logger
'''
global LOGGER
if LOGGER is None:
LOGGER = logging.getLogger(__name__)
return LOGGER
def get_redis_con... | ioos/catalog-harvesting | catalog_harvesting/__init__.py | Python | mit | 762 |
import datetime as dt
from datetime import datetime
import dateutil
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
Timestamp,
concat,
date_range,
to_timedelta,
)
import pandas._testing as tm
class Tes... | datapythonista/pandas | pandas/tests/reshape/concat/test_datetimes.py | Python | bsd-3-clause | 18,421 |
## filename: MaxScore.py
## GreedyAlgorithms
## CS6101: Design and Analysis of Algorithms
## Reference :
## http://www.geeksforgeeks.org
## http://topcoder.com
## Introduction to Algorithms, CLRS
## Fundamentals of Computer Algorithms-Horowitz, Sahani, Rajasekaran
## Topic Description :
## Greedy Algos:
## At each... | sukhoi/Algorithms-in-Python | greedyAlgorithms/MaxScore.py | Python | gpl-3.0 | 3,073 |
# The Hazard Library
# Copyright (C) 2013-2016 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#... | vup1120/oq-hazardlib | openquake/hazardlib/tests/source/non_parametric_test.py | Python | agpl-3.0 | 5,223 |
# gr.py <urls-file> <request base url> <print base url> <oauth token>
# demo e88cb6d1-771d-46ac-a207-2e58d7f12196
# linda.kim 4cf7a5d4-37a1-ca19-8b13-b5f95131ac85
# python gr.py urls-nocustom http://local.slidev.org:8080/api/rest/v1/ https://localhost/api/rest/v1/ 4cf7a5d4-37a1-ca19-8b13-b5f95131ac85
import sys
impor... | inbloom/legacy-projects | datastore_docs/scripts/archive/generate_examples_for_api_docs/gr.py | Python | apache-2.0 | 4,338 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from faint import Bitmap, Pattern
class TestPattern(unittest.TestCase):
def test_init(self):
bmp = Bitmap((10,10), (255,0,255));
p = Pattern(bmp)
| lukas-ke/faint-graphics-editor | tests/py_tests/test_faint/test_pattern.py | Python | apache-2.0 | 243 |
import unittest
import pexpect
import signal
import time
class TestInteraction(unittest.TestCase):
def test_keyboard_interrupt(self):
p = pexpect.spawn("python3 lesspass/core.py --prompt")
p.expect("Site: ")
p.kill(signal.SIGINT)
p.expect(pexpect.EOF)
self.assertEqual(p.bef... | oslab-fr/lesspass | cli/tests/test_interaction.py | Python | mit | 330 |
# flake8: noqa
import argparse
import asyncio
import copy
import logging
import os
import sys
from kafka_logger.handlers import KafkaLoggingHandler
from repour.lib.logs import file_callback_log
from repour.lib.logs import log_util
logger = logging.getLogger(__name__)
class ContextLogRecord(logging.LogRecord):
... | project-ncl/repour | repour/main.py | Python | apache-2.0 | 6,924 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Mirantis, 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/... | netscaler/neutron | neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_cfg.py | Python | apache-2.0 | 10,281 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012, Sergio Callegari
# All rights reserved.
# This file is part of PyDSM.
# PyDSM 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, o... | sergiocallegari/PyDSM | pydsm/NTFdesign/weighting/_quantization_noise_gain.py | Python | gpl-3.0 | 1,511 |
#!/bin/env python
# traj_compute_dist.py
# Given a trajectory and its associated files, calculates the RMSD distance for each frame
from __future__ import division, print_function
from atom_tools import rmsdDist
from argparse import ArgumentParser
from shared import *
from lineMD_RMSD import log
from numpy import zero... | charlesyuan314/lineMD | traj_compute_dist.py | Python | gpl-3.0 | 8,277 |
#!/usr/bin/env python
import layer
import math
from base_parser import *
from time import sleep
#convert the bulge of lwpolylines to arcs
def cvtbulge(bulge, sp, ep):
x1, y1 = sp[0], sp[1]
x2, y2 = ep[0], ep[1]
cotbce = (1.0/bulge - bulge)/ 2.0
# Compute center point and radius
cen = [(x1 + x2 -... | Victor-Haefner/ontocad | src/dxf_parser.py | Python | gpl-3.0 | 36,856 |
# Lint as: python3
""" Useful functions for running in colab.
"""
import PIL.Image, PIL.ImageDraw
from IPython.display import Image, HTML, clear_output
from self_organising_systems.shared.util import imencode
def imshow(a, fmt='jpeg'):
display(Image(data=imencode(a, fmt)))
| google-research/self-organising-systems | self_organising_systems/shared/colab_util.py | Python | apache-2.0 | 278 |
# rar archiving script
# david.barhuizen@gmail.com
# recurses subdirectories
# selectively includes only files with file extensions specified by FILE_EXTS
# creates archive named APP_NAME_yyyy-mm-dd-hh-mm
from datetime import datetime
import os
APP_NAME = 'black_widow'
FILE_EXTS = ['py', 'txt', 'sql', 'bat', 'html',... | davidbarkhuizen/blackwidow | arch.py | Python | mit | 1,285 |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""
Python parse tree definitions.
This is a very concrete parse tree; we need to keep every token and
even the comments and whitespace between tokens.
There's also a pattern matching implementation here.
"""
__autho... | 2ndy/RaspIM | usr/lib/python2.6/lib2to3/pytree.py | Python | gpl-2.0 | 28,107 |
from datetime import datetime, timedelta
import pymongo
import json
import re
from bson.objectid import ObjectId
def get_table(collection, start=None, end=None, numpoints=10):
""" return a table of data from the collection
kwargs:
collection -- the collection from which to get data from,... | xcorat/slow-control-test | ln2monitor/ln2methods.py | Python | gpl-2.0 | 2,153 |
#!/usr/bin/env python
# Copyright 2012-2014 VPAC
#
# This file is part of django-tldap.
#
# django-tldap 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) ... | Karaage-Cluster/karaage-admin | setup.py | Python | gpl-3.0 | 1,907 |
# -*- coding: utf-8 -*-
# Copyright 2015-TODAY LasLabs Inc.
# License MIT (https://opensource.org/licenses/MIT).
import unittest
from sqlalchemy.schema import Table
from carepoint.tests.db.db import DatabaseTest
from carepoint.models.cph.user import EnumUserType, User
class TestModelsCphUser(DatabaseTest):
def ... | laslabs/Python-Carepoint | carepoint/tests/models/cph/test_user.py | Python | mit | 831 |
import datetime
import json
from flask import current_app
from lxml import etree as ET
from geonature.utils.config import config
from geonature.core.gn_meta.models import TAcquisitionFramework
namespace = config["XML_NAMESPACE"]
_xml_parser = ET.XMLParser(ns_clean=True, recover=True, encoding="utf-8")
def get_ta... | PnX-SI/GeoNature | backend/geonature/core/gn_meta/mtd/xml_parser.py | Python | gpl-3.0 | 8,342 |
# mod_dash/main.py
#
# Copyright (c) 2013
# Nexa Center for Internet & Society, Politecnico di Torino (DAUIN)
# and Simone Basso <bassosimone@gmail.com>
#
# This file is part of Neubot <http://www.neubot.org/>.
#
# Neubot is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | neubot/neubot-client | mod_dash/main.py | Python | gpl-3.0 | 4,232 |
# -*- coding: utf-8 -*-
from contextlib import contextmanager
from fileinput import FileInput
import fileinput
import os
DEFAULT_ENCODING = 'utf-8'
class EOD(object):
"""
End of Document
"""
pass
@contextmanager
def FileReader(path):
if os.path.exists(path):
yield _get_word_from_file(pa... | khris/spamipsum | spamipsum/reader.py | Python | mit | 993 |
"""
Copyright 2011 Sami Dalouche
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 ... | iglootools/genconf | tests/genconftests/manifest/test_profile.py | Python | apache-2.0 | 2,513 |
# DExTer : Debugging Experience Tester
# ~~~~~~ ~ ~~ ~ ~~
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
from ctypes import *
from enum import *
f... | endlessm/chromium-browser | third_party/llvm/debuginfo-tests/dexter/dex/debugger/dbgeng/client.py | Python | bsd-3-clause | 7,990 |
import warnings
import numpy as np
from ..base import MetaEstimatorMixin, clone, BaseEstimator
from ..utils.validation import check_is_fitted
from ..utils.metaestimators import if_delegate_has_method
from ..utils import safe_mask
__all__ = ["SelfTrainingClassifier"]
# Authors: Oliver Rausch <rauscho@ethz.ch>
# ... | xuewei4d/scikit-learn | sklearn/semi_supervised/_self_training.py | Python | bsd-3-clause | 12,700 |
#! /usr/bin/env python
# -*- coding: Latin-1 -*-
# Recherche du plus grand élément d'une liste
# Liste fournie au départ :
tt = [32, 5, 12, 8, 3, 75, 2, 15]
# Au fur et à mesure du traitement de la liste, on mémorisera dans
# la variable ci-dessous la valeur du plus grand élément déjà trouvé :
max = 0
# Examen de tou... | widowild/messcripts | exercice/python2/solutions/exercice_5_13.py | Python | gpl-3.0 | 540 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from . import baselistener
from .. import ircresponse, irccommand
class NickFailListener(baselistener.BaseListener):
def processLine(self, line):
failmsg = "!!! Nickname is already in use."
ret = ircresponse.IRCResponse(line)
if... | IjonTichy/TichyBot | src/objects/listeners/nickfaillistener.py | Python | bsd-3-clause | 567 |
"""Test decomposition of rotation matrices around arbitrary axes"""
from __future__ import annotations
import math
import random
from libtbx.test_utils import approx_equal
from scitbx import matrix
from dials.algorithms.refinement.rotation_decomposition import (
solve_r3_rotation_for_angles_given_axes,
)
def... | dials/dials | tests/algorithms/refinement/test_rotation_decomposition.py | Python | bsd-3-clause | 5,265 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import inspect
import warnings
from functools import wraps
from flask import abort, jsonify, request
from marshmallow.exceptions import ValidationError
from six import string_types
from werkzeug.wrappers import Response as WerkzeugResponse
from eduid_co... | SUNET/eduid-common | src/eduid_common/api/decorators.py | Python | bsd-3-clause | 7,549 |
"""Support for IP Cameras."""
import asyncio
import logging
from contextlib import closing
import aiohttp
import async_timeout
import requests
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
import voluptuous as vol
from homeassistant.const import (
CONF_NAME, CONF_USERNAME, CONF_PASSWORD, CONF_AUTHENTICA... | jnewland/home-assistant | homeassistant/components/mjpeg/camera.py | Python | apache-2.0 | 6,054 |
import os, json
__all__ = [ 'doc_files', 'doc_meta_file',
'documents', 'document_metadata',
'corpus', 'paragraphs', 'doc_label_fn' ]
_doc_files = [ 'frontmatter.json', 'chapter1.json', 'chapter2.json',
'chapter3.json', 'chapter4.json', 'chapter5.json',
'chapter... | iSumitG/vsm | vsm/extensions/testdata/history_greek_philosophy/__init__.py | Python | mit | 2,662 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | dcroc16/skunk_works | google_appengine/google/appengine/tools/devappserver2/vm_runtime_proxy.py | Python | mit | 11,170 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
import unittest2 as unittest
import os
import json
import numpy as np
import warnings
import xml.etree.cElementTree as ET
from pymatgen.electronic_structur... | aykol/pymatgen | pymatgen/io/vasp/tests/test_outputs.py | Python | mit | 36,965 |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2005, 2006, 2007, 2008, 2011 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hop... | tradej/pykickstart-old | pykickstart/commands/raid.py | Python | gpl-2.0 | 16,234 |
from sympy.logic.boolalg import *
import equibel as eb
def test_global_completion_cardinality():
G = eb.star_graph(3)
G.add_formula(1, 'p')
G.add_formula(2, 'p')
G.add_formula(3, '~p')
R_semantic = eb.global_completion(G, method=eb.SEMANTIC, opt_type=eb.CARDINALITY, simplify=True)
assert(R_se... | asteroidhouse/equibel | tests/completion_tests.py | Python | mit | 2,605 |
"""
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing im... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/cluster/tests/test_dbscan.py | Python | mit | 13,916 |
from typing import Any, List, Mapping
from .utils import clean_filters
class DockerSwarmNodes(object):
def __init__(self, docker):
self.docker = docker
async def list(self, *, filters: Mapping = None) -> List[Mapping]:
"""
Return a list of swarm's nodes.
Args:
fil... | paultag/aiodocker | aiodocker/nodes.py | Python | mit | 2,275 |
#!/usr/bin/python
#
# \file projects.py
# \brief Projects configuration
# \date 2010-05-24-09-19-GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Projects configuration.
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2010 Winch Gate Property Limited
#
# ... | osgcc/ryzom | ryzom/tools/build_gamedata/workspace/projects.py | Python | agpl-3.0 | 20,251 |
#coding: utf-8
from gvars import db
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
age = db.Column(db.Integer)
name = db.Column(db.String)
gender = db.Column(db.Boolean) # 性别, True: Male, False: Female
birthday = db.Column(db.DateTi... | TheWaWaR/ahorn-table | common/models.py | Python | mit | 395 |
import logging
import os
from twisted.web import server, guard, resource
from twisted.internet import defer, reactor, error
from twisted.cred import portal
from lbrynet import conf
from lbrynet.daemon.Daemon import Daemon
from lbrynet.daemon.auth.auth import PasswordChecker, HttpPasswordRealm
from lbrynet.daemon.auth... | zestyr/lbry | lbrynet/daemon/DaemonServer.py | Python | mit | 2,661 |
import unittest
from fish import Fish
from unit import Directions
class TestFish(unittest.TestCase):
def setUp(self):
self.constraint = (1000, 1000)
self.fish = Fish(self.constraint, 100, 100, Directions.left, 1)
def test_init_no_params(self):
fish = Fish(self.constraint)
self... | gvpavlov/Insaniquarium | insaniquarium/core/fish_test.py | Python | gpl-2.0 | 1,951 |
# Copyright 2016-2017 Facundo Batista
#
# This program 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 hope that it will be useful, but
# WITHOUT ANY WARRANTY;... | facundobatista/recordium | recordium/main.py | Python | gpl-3.0 | 14,262 |
from geopytool.ImportDependence import *
from geopytool.CustomClass import *
class MyTrans(AppForm):
Lines = []
Tags = []
description = 'Trans'
settings_backup=pd.DataFrame()
unuseful = ['Name',
'Mineral',
'Author',
'DataType',
'Label... | cycleuser/GeoPython | geopytool/Trans.py | Python | gpl-3.0 | 6,998 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/Users/chernomirdinmacuvele/Documents/workspace/PscArt2.0.X/UserInt/ui_tableas_POT.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class ... | InUrSys/PescArt2.0 | GeneratedFiles/ui_tableas_POT.py | Python | gpl-3.0 | 4,584 |
from django import template
from django.conf import settings
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from django.utils.translation import get_language
from django.utils.translation import get_language_info
from django.utils.translation import ugettext_lazy a... | fle-internal/content-curation | contentcuration/contentcuration/templatetags/translation_tags.py | Python | mit | 2,802 |
__author__ = 'orhan'
from unittest import TestCase
from unionfind.quickfind import QuickFind
from unionfind.quickunion import QuickUnion
from unionfind.weightedquickunion import WeightedQuickUnion
from unionfind.wquwithpathcompression import WQUWithPathCompression
class UnionFindTests():
def test_initial(self):... | ocozalp/Algorithms | tests/unionfind/unionfind_test.py | Python | apache-2.0 | 1,388 |
# Copyright (c) 2014 Museum Victoria
# This software is released under the MIT license (see license.txt for details)
from Queue import *
import threading
import atexit
remote_action_PowerOn = RemoteAction()
remote_action_PowerOff = RemoteAction()
remote_action_SetInput = RemoteAction()
def local_action_activate(x = ... | museumsvictoria/nodel-recipes | (retired)/pjlinkqueue/script.py | Python | mit | 1,588 |
#
# Guernsey - Library to simplify creating REST web services using Python and Twisted
# Copyright (C) 2014 Magine Sweden AB
# Copyright (C) 2016 Ingemar Nilsson
#
# 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... | ingnil/guernsey | lib/python/web/rest.py | Python | gpl-3.0 | 49,701 |
#===========================================================================
#
# RainForest Eagle Electric meter reading package
#
#===========================================================================
__doc__ = """RainForest Eagle electric meter reader.
This package implements a web server which the RainForest... | TD22057/T-Home | python/tHome/broker/__init__.py | Python | bsd-2-clause | 821 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the fake directory implementation."""
import unittest
from dfvfs.lib import definitions
from dfvfs.path import fake_path_spec
from dfvfs.resolver import context
from dfvfs.vfs import fake_directory
from dfvfs.vfs import fake_file_system
from tests import tes... | joachimmetz/dfvfs | tests/vfs/fake_directory.py | Python | apache-2.0 | 2,323 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Cubic ERP SAC (<http://cubicerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | jolevq/odoopub | extra-addons/customize/res_currency.py | Python | agpl-3.0 | 1,199 |
import sys
n = int(raw_input().strip())
#print "n is" n
arr = map(int,raw_input().strip().split(' '))
print sum(arr)
| shobhitmishra/CodingProblems | HackerRank/simple_array_sum.py | Python | mit | 117 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_06_01/operations/_service_endpoint_policy_definitions_operations.py | Python | mit | 24,235 |
import tensorflow as tf
from swl.machine_learning.tensorflow.neural_net_trainer import NeuralNetTrainer, GradientClippingNeuralNetTrainer
#--------------------------------------------------------------------
class SimpleNeuralNetTrainer(NeuralNetTrainer):
def __init__(self, neuralNet, initial_epoch=0, augmenter=None... | sangwook236/sangwook-library | python/src/swl/machine_learning/tensorflow/simple_neural_net_trainer.py | Python | gpl-2.0 | 2,037 |
# Copyright 2017 OP5 AB
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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... | stackforge/monasca-api | monasca_api/tests/policy/base.py | Python | apache-2.0 | 3,063 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/r-party/package.py | Python | lgpl-2.1 | 2,047 |
import scrapy
from scrapy.crawler import CrawlerProcess
class IPv6Spider(scrapy.Spider):
name = "ipv6_spider"
start_urls = ["http://[::1]"]
process = CrawlerProcess(settings={"RETRY_ENABLED": False})
process.crawl(IPv6Spider)
process.start()
| starrify/scrapy | tests/CrawlerProcess/default_name_resolver.py | Python | bsd-3-clause | 254 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# 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/LICENS... | yamahata/python-tackerclient | tackerclient/version.py | Python | apache-2.0 | 846 |
import random
# Paso 1
start = 0 # Número más pequeño
stop = 100 # Número más grande
random_number = random.randrange(start, stop)
# Paso 2
guessed_number = int(input(f"Introduce un número entre {start}, {stop}: "))
assert guessed_number >= start and guessed_number <= stop, \
f"El número introducido {guessed_numbe... | vicente-gonzalez-ruiz/YAPT | workshops/programacion_python_ESO/guess_the_number.py | Python | cc0-1.0 | 870 |
from Cython.Compiler.Visitor import TreeVisitor
from Cython.Compiler.Nodes import *
from Cython.Compiler.ExprNodes import *
"""
Serializes a Cython code tree to Cython code. This is primarily useful for
debugging and testing purposes.
The output is in a strict format, no whitespace or comments from the input
is prese... | bzzzz/cython | Cython/CodeWriter.py | Python | apache-2.0 | 9,349 |
from django.db import models
# Create your models here.
from couchdbkit.ext.django.schema import Document
class _(Document): pass | gmimano/commcaretest | corehq/apps/cleanup/models.py | Python | bsd-3-clause | 132 |
import argparse
import io
import json
import itertools
class Regions:
def __init__(self, region_data="data/regions.json"):
with io.open(region_data, 'r') as f:
self.regions = json.load(f)
def is_point_in(self, x, y, name):
if name not in self.regions:
return False
... | Southclaws/ScavengeSurvive | pyss/pyss/utility/regions.py | Python | mpl-2.0 | 3,267 |
# -*- coding:utf-8 -*-
from Noun import NounFrame
from Adjective import AdjectiveAllGender
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
class PronounFrame(NounFrame):
def __init__(self,master=None):
NounFrame.__init__(self,master)
self.voc_s.grid_forget()
self.voc_p.grid_forget()
self... | pkqxdd/Latin-Helper | source/Pronoun.py | Python | mit | 9,073 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.