code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018:
# Frederic Mohier, frederic.mohier@alignak.net
#
# This file is part of (WebUI).
#
# (WebUI) 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 F... | Alignak-monitoring-contrib/alignak-webui | alignak_webui/plugins/backend_graphite/backend_graphite.py | Python | agpl-3.0 | 1,405 |
# Django
from django.conf.urls import patterns, url
# local Django
from organization.views import OrganizationCreateView, OrganizationDeleteView, OrganizationListView, OrganizationUpdateView
urlpatterns = patterns(
'',
url(r'^create/$', OrganizationCreateView.as_view(), name='create'),
url(r'^delete/(?P<o... | kamsuri/vms | vms/organization/urls.py | Python | gpl-2.0 | 585 |
# Copyright (C) 2015 University of Nebraska at Omaha
# Copyright (C) 2015 Thomas T. Gurney
#
# This file is part of dosocs2.
#
# dosocs2 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 ... | sschuberth/dosocs2 | dosocs2/scanners.py | Python | gpl-2.0 | 16,528 |
#!/usr/bin/env python
# Execute with
# $ python youtube_dl/__main__.py (2.6+)
# $ python -m youtube_dl (2.7+)
import sys
if __package__ is None and not hasattr(sys, "frozen"):
# direct call of __main__.py
import os.path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))... | RajShahCrazy/youtube-dl | youtube_dl/__main__.py | Python | unlicense | 390 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2006-2008, 2011-2014, 2017 Lukáš Lalinský
# Copyright (C) 2007 Santiago M. Mola
# Copyright (C) 2008 Robert Kaye
# Copyright (C) 2008-2009, 2018-2021 Philipp Wolfer
# Copyright (C) 2009 Carlin Mangar
# Co... | phw/picard | setup.py | Python | gpl-2.0 | 29,569 |
"""
Test runner to run all test suites.
"""
import unittest
import test.finsignia.gae.loader as loader_tests
import test.finsignia.gae.controllers as controllers_tests
import test.finsignia.gae.router as router_tests
__TEST_MODULES__ = [loader_tests, controllers_tests, router_tests]
def run_suite():
suites = []
... | finsignia/finsignia-gae | testrunner.py | Python | mit | 694 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------
# test_noRedundantChildSelectors.py
#
# test for noRedundantChildSelectors rule
# ----------------------------------------------------------------
# copyright (c) 2014 - Domen Ipavec
# Distributed under Th... | matematik7/CSSQC | tests/test_noRedundantChildSelectors.py | Python | mit | 1,894 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf import settings
from django.views.generic import RedirectView
from django.core.urlresolvers import reverse_lazy as reverse
a... | allisson/mutirao-python-oauth | oauth_example/oauth_example/urls.py | Python | mit | 1,045 |
# Copyright 2020 DeepMind Technologies Limited. 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... | deepmind/dm_env_rpc | dm_env_rpc/v1/compliance/create_destroy_world.py | Python | apache-2.0 | 3,731 |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | talon-one/talon_one.py | talon_one/models/new_customer_profile.py | Python | mit | 4,094 |
import unittest
from conans.test.utils.tools import TestClient, TestServer
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.paths import CONANFILE
import os
from conans.util.files import load, save
class InfoTest(unittest.TestCase):
def setUp(self):
test_server = TestServer(... | birsoyo/conan | conans/test/command/info_command_test.py | Python | mit | 5,004 |
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation 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 sou... | IntelLabs/hpat | sdc/hiframes/hiframes_untyped.py | Python | bsd-2-clause | 88,759 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This code testing the segmenting images using watersheds.
This code testing the segmenting images using watersheds.
"""
from __future__ import absolute_import, division, \
print_function, unicode_literals
# import ipdb; ipdb.set_trace() ; # debugging-------
impo... | neilhan/python_cv_learning | 05-segment_watersheds/run_me.py | Python | bsd-3-clause | 4,060 |
"""
Created on Mar 8, 2014
@author: jtaghiyar
"""
from helpers import validate_argument
import logging
class Plumber(object):
"""
pipe components into a pipeline based on the given configuration and
generate a python script.
"""
def __init__(self, pipeline_script, workflow=None):
## the ... | jtaghiyar/kronos | kronos/plumber.py | Python | mit | 28,257 |
#! /usr/bin/env python
#
# Copyright (C) 2016 Rich Lewis <rl403@cam.ac.uk>
# License: 3-clause BSD
"""
# skchem.features.descriptors.charge
Charge descriptors for scikit-chem.
"""
from collections import OrderedDict
import numpy as np
from rdkit.Chem import rdPartialCharges
from .caching import cache
from .fundame... | richlewis42/scikit-chem | skchem/features/descriptors/charge.py | Python | bsd-3-clause | 8,628 |
from __future__ import print_function, absolute_import, division
import sys
import argparse
from . import parser_download, parser_train
NAME = 'molencoder'
VERSION = '0.1a'
def main():
help = 'osprey is a tool for machine learning hyperparameter optimization.'
p = argparse.ArgumentParser(description=help)
... | cxhernandez/molencoder | molencoder/cli/main.py | Python | mit | 1,295 |
"""
WSGI config for elmo project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... | StephenSwat/eve_lunar_mining_organiser | elmo/elmo/wsgi.py | Python | mit | 392 |
# coding=utf-8
from django import forms
from backend_candidate.models import CandidacyContact
from merepresenta.models import VolunteerGetsCandidateEmailLog
from .models import VolunteerProfile
from votai_utils.send_mails import send_mail
class VolunteerGetsCandidateEmailLogMixin(object):
def _save_log(self, cont... | ciudadanointeligente/votainteligente-portal-electoral | merepresenta/voluntarios/forms.py | Python | gpl-3.0 | 2,962 |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 LE GOFF Vincent
# 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 above copyright notice, this
# lis... | stormi/tsunami | src/primaires/scripting/fonctions/deverrouillee.py | Python | bsd-3-clause | 2,553 |
from __future__ import print_function
from Bio import SeqIO
import argparse
import os, sys, re
from pdb import set_trace
def fixHeaders(seqs):
with open("source-data/mumps_header_fix.tsv", 'rU') as fh:
fixes = {x.strip().split()[0]: x.strip().split()[1] for x in fh.readlines() if not x.startswith('#')}
... | blab/nextstrain-db | vdb/mumps_preprocess_fasta.py | Python | agpl-3.0 | 2,251 |
# Copyright 2011-2012 10gen, 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... | 0111001101111010/open-health-inspection-api | venv/lib/python2.7/site-packages/pymongo/common.py | Python | gpl-2.0 | 23,408 |
"""
Copyright (C) 2014, Web Bender Consulting, LLC. - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
Written by Elijah Ethun <elijahe@gmail.com>
"""
"""
Database.py
Module containing Postgres database connection and usage methods.
"""
import ... | yarhajile/sven-daemon | Sven/Database.py | Python | gpl-2.0 | 1,175 |
import ReviewHelper
import pandas as pd
df = ReviewHelper.get_pandas_data_frame_created_from_bibtex_file()
# find problematic ones
df[df.metaDatasetsUsed.isnull()]
list1 = df.metaDatasetsUsed.str.split(",").tolist()
df1 = pd.DataFrame(list1)
for i in range(df1.columns.size):
df1[i] = df1[i].str.strip()
stac... | ati-ozgur/KDD99ReviewArticle | HelperCodes/create_table_metaDatasetsUsed.py | Python | mit | 1,724 |
# -*- coding: utf-8 -*-
import csv
import hashlib
import hmac
import os
import re
from babel.core import get_global
from babel.dates import format_date
from codecs import getincrementalencoder
from imp import load_source
from numbers import Number
from os.path import splitext, join
from io import open
from random impo... | jcherqui/searx | searx/utils.py | Python | agpl-3.0 | 13,213 |
import logging
from math import isclose
try: # pragma: no cover
import torch
optim = torch.optim
except ImportError: # pragma: no cover
optim = None
def pinverse(t):
"""
Computes the pseudo-inverse of a matrix using SVD.
Parameters
----------
t: torch.tensor
The matrix wh... | pgmpy/pgmpy | pgmpy/utils/optimizer.py | Python | mit | 3,651 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-20 16:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('chatbot', '0001_initial'),
]
operations = [
migrations.AddField(
... | dchaplinsky/declarations.com.ua | declarations_site/chatbot/migrations/0002_auto_20170520_1936.py | Python | mit | 1,685 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-04 11:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('catalog', '0014_auto_20171004_1759'),
]
operations... | PairMhai/Backend | catalog/migrations/0015_auto_20171004_1843.py | Python | agpl-3.0 | 817 |
import os
import sys
container_folder = os.path.abspath(os.path.join(
os.path.dirname(__file__), '..'
))
sys.path.insert(0, container_folder)
import flask
import pypi_org.data.db_session as db_session
app = flask.Flask(__name__)
def main():
register_blueprints()
setup_db()
app.run(debug=True)
def... | Wintellect/WintellectWebinars | 2019-06-06-ten-tips-python-web-devs-kennedy/code/top_10_web_explore/ex05_migrations/pypi_org/app.py | Python | apache-2.0 | 817 |
#!/usr/bin python
# -*- coding: utf-8 -*-
from __future__ import division
from lib.flowchart.nodes.generalNode import NodeWithCtrlWidget, NodeCtrlWidget
from lib.functions.general import isNumpyNumeric
class divideNode(NodeWithCtrlWidget):
"""Divide all values in A-column `a` by a constant `c`. Divide itemwise A-... | cdd1969/pygwa | lib/flowchart/nodes/n_25_divide/node_divide.py | Python | gpl-2.0 | 3,010 |
# 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 use ... | ByteInternet/libcloud | libcloud/storage/drivers/local.py | Python | apache-2.0 | 19,000 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-27 23:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("studies", "0024_merge_20170823_1352"),
("studies", "0029_auto_20170825_1505"),
]
op... | CenterForOpenScience/lookit-api | studies/migrations/0030_merge_20170827_1909.py | Python | apache-2.0 | 334 |
# -*- coding: utf-8 -*-
from datetime import datetime
import uuid
from werkzeug.exceptions import Forbidden
import logging
import openerp
from openerp import api, tools
from openerp import SUPERUSER_ID
from openerp.addons.website.models.website import slug
from openerp.exceptions import Warning
from openerp.osv impo... | Jgarcia-IAS/SITE | addons/website_forum/models/forum.py | Python | agpl-3.0 | 36,003 |
from Tkinter import *
from tkMessageBox import *
class Radiobar(Frame):
def __init__(self, parent=None, picks=[], side=LEFT, anchor=W):
Frame.__init__(self, parent)
self.var = StringVar()
for pick in picks:
rad = Radiobutton(self, text=pick, value=pick, variable=self.var)
... | mgaitan/beppo | sandbox/tkGui4.py | Python | gpl-2.0 | 1,132 |
import xbmcgui
import urllib
def download(url, dest, dp = None):
if not dp:
dp = xbmcgui.DialogProgress()
dp.create("SimpleKodi...Maintenance","Downloading & Copying File",' ', ' ')
dp.update(0)
urllib.urlretrieve(url,dest,lambda nb, bs, fs, url=url: _pbhook(nb,bs,fs,url,dp))
de... | davies1995/SimpleCD | repo/plugin.video.simplecd/downloader.py | Python | gpl-2.0 | 622 |
"""
Name Dictionaries to Map NCA Regions
W. R. Emanuel, University of Maryland, College Park
E-Mail: wemanuel@umd.edu
Gmail: wemanuel@gmail.com
"""
# Dictionaries to map region short names to long names.
name_dct = {"Alaska": "Alaska", "GrtPlns": "Great Plains",
"Hawaii": "Hawaii", "... | wemanuel/smry | smry/name_dcts.py | Python | apache-2.0 | 1,849 |
import logging
import socket
import ssl
import struct
import warnings
import zlib
import io
import os
import platform
from functools import wraps
from threading import local as thread_local
from .rencode import dumps, loads
DEFAULT_LINUX_CONFIG_DIR_PATH = '~/.config/deluge'
RPC_RESPONSE = 1
RPC_ERROR = 2
RPC_EVENT = ... | Vagab0nd/SiCKRAGE | lib3/deluge_client/client.py | Python | gpl-3.0 | 12,557 |
"""
Problem 13: https://projecteuler.net/problem=13
Problem Statement:
Work out the first ten digits of the sum of the following one-hundred 50-digit
numbers.
"""
import os
def solution():
"""
Returns the first ten digits of the sum of the array elements
from the file num.txt
>>> solution()
'553... | TheAlgorithms/Python | project_euler/problem_013/sol1.py | Python | mit | 556 |
#!/usr/bin/env python2.7
# Copyright 2015, Google Inc.
# 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 above copyright
# notice, this lis... | bjori/grpc | tools/run_tests/run_tests.py | Python | bsd-3-clause | 27,186 |
class Monitor:
def __init__(self, controller, redis_address):
self.controller = controller
self.redis_address = redis_address
def _schedule(self, gid, nid, domain, name, args={}, cron='@every 1m'):
"""
Schedule the given jumpscript (domain/name) to run on the specified node ac... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/realitycapture/Monitor.py | Python | apache-2.0 | 3,119 |
## @file testDB.py
# @brief test script for database schema and integrity
# @details Run this as a standalone script to troubleshoot your setup,
# or let the testing suite call it as a part of its checks.
#
import sqlite3
import config_obj
import time
labels = ['popularity', 'acousticness', 'danceability', 'energy', '... | SLongofono/448_Project4 | testDB.py | Python | mit | 4,385 |
# Portions Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# formatter.py - generic output formatting for mercurial
#
# Copyright 2012 Matt Mackall <mpm@selenic.com>
#
# This software may be used and ... | facebookexperimental/eden | eden/scm/edenscm/mercurial/formatter.py | Python | gpl-2.0 | 19,482 |
#!/usr/bin/env python
#coding:utf-8
import sys
try:
import MySQLdb
print "MySQL python drivier is ok!"
except Exception, e:
print e
sys.exit(1)
finally:
sys.exit(1)
| hisery/Lepus-1 | python/test_driver_mysql.py | Python | gpl-2.0 | 191 |
#!/usr/bin/env python
#______________________________________#
#Dexacker is an open source tool developed by Abdelmadjd Cherfaoui
#Dexacker is designed for Educational Stuff to do a LEGAL DDOS Test and the developers is
# not responsible for ILLEGAL USES
#Contacting using:@Hexacker | fb.com/Hexacker
#http://www.hackerc... | Hexacker/Dexacker | Dexacker.py | Python | gpl-2.0 | 1,733 |
# Importing function from a module
from topackage.importme import theimportedFunction
# Importing whole module
from topackage.packager import ucanimportme
# Invoking particular function from imported module
print(ucanimportme.anotherimportedfunc("Sekhar"))
# Invoking imported function directly
print(theimportedFuncti... | pk-python/basics | basics/packages/importinghere.py | Python | mit | 332 |
#!/usr/bin/env python3.5
import pexpect
import os
import sys
import subprocess
import shutil
CERT_LOCATION = '/xenon/grid_certificates/rucio_service_cert.pem'
KEY_LOCATION = '/xenon/grid_certificates/rucio_service_key.pem'
PROXY_LOCATION = '/xenon/grid_proxy/xenon_service_proxy'
CERT_PASS = 'o665I995JPLk'
DESTINATION_... | XENON1T/processing | grid_proxy/renew-proxy.py | Python | apache-2.0 | 1,112 |
# pylint: disable=missing-module-docstring,too-many-format-args
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Show a user's roles and permissions."
def add_arguments(self, parser):
parser.add_argument('email_or_us... | msegado/edx-platform | lms/djangoapps/discussion/management/commands/show_permissions.py | Python | agpl-3.0 | 1,192 |
# tests.test_features.test_radviz
# Test the RadViz feature analysis visualizers
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Fri Oct 07 12:19:19 2016 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: test_radviz.py [01d5996] benjamin@beng... | pdamodaran/yellowbrick | tests/test_features/test_radviz.py | Python | apache-2.0 | 6,639 |
# -*- coding: utf-8 -*-
class Signaling:
__signals = {}
def __init__(self):
# nothing to do yet
pass
@classmethod
def on_pre_save(cls, f):
cls.__append_callback('pre_save', f)
@classmethod
def on_post_save(cls, f):
cls.__append_callback('post_save', f)
... | OpenSystemsLab/rethinkengine | rethinkengine/signals.py | Python | bsd-2-clause | 1,818 |
#!/usr/bin/python
import os
import re
regex = re.compile('^\[.*')
with open(os.environ['HOME'] + "/.ossipee/config.ini", "r") as config:
for line in config:
for section in regex.findall(line):
print re.sub('[\[\]]','' ,section)
| vakwetu/ossipee | ossipee-sections.py | Python | apache-2.0 | 254 |
"""Treadmill master process.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import json
import logging
import os
import re
import time
import zlib
from treadmill import scheduler
from treadmil... | Morgan-Stanley/treadmill | lib/python/treadmill/scheduler/master.py | Python | apache-2.0 | 25,347 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-16 11:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('archive', '0013_photo_orientation'),
]
operations = [
migrations.RemoveField(... | chiara-paci/baskerville | baskervilleweb/archive/migrations.preauth/0014_auto_20170516_1359.py | Python | gpl-3.0 | 897 |
"""Tests for missing-function-docstring and the min-length option"""
# pylint: disable=unused-argument, unnecessary-pass, bare-except
def func(tion):
pass
def func_two(tion): # [missing-function-docstring]
pass
pass
def func_three(tion): # [missing-function-docstring]
try:
pass
excep... | PyCQA/pylint | tests/functional/m/missing/missing_function_docstring_min_length.py | Python | gpl-2.0 | 366 |
#!/usr/bin/env python3
# coding=utf-8
"""
This modules contains different parsers for arguments and configuration
"""
| dslab-epfl/bugbase | lib/parsers/__init__.py | Python | bsd-3-clause | 119 |
from __future__ import division, print_function, absolute_import, unicode_literals
import sys
import os
import errno
import subprocess
import platform
import six
from mog_commons.string import to_bytes
from mog_commons.functional import oget
from mog_commons.types import types
# workaround for http://bugs.python.org... | mogproject/mog-commons-python | src/mog_commons/command.py | Python | apache-2.0 | 5,290 |
import logging
import sys
import gym
logger = logging.getLogger(__name__)
root_logger = logging.getLogger()
requests_logger = logging.getLogger('requests')
# Set up the default handler
formatter = logging.Formatter('[%(asctime)s] %(message)s')
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(formatt... | machinaut/gym | gym/configuration.py | Python | mit | 1,186 |
import unittest
import uptide.tidal as ut
import datetime
import math
class TestTidal(unittest.TestCase):
"""Tests the uptide.tidal module (basic astronomical calculations)"""
def setUp(self):
# a random, insignificant date
self.date = datetime.datetime(1975, 10, 24, 1, 2, 3)
# I can s... | stephankramer/uptide | tests/test_tidal.py | Python | lgpl-3.0 | 1,855 |
n = int(input())
print("Weird" if 6<=n<=20 or n % 2 != 0 else "Not Weird")
| clemus90/competitive-programming | hackerRank/30DaysOfCode/day_3_intro_to_conditional_statements.py | Python | mit | 75 |
"""
test_GlobalOperations.py
This file is part of ANNarchy.
Copyright (C) 2021 Helge Uelo Dinkelbach <helge.dinkelbach@gmail.com>
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 Founda... | vitay/ANNarchy | tests/Unittests/test_GlobalOperations.py | Python | gpl-2.0 | 7,962 |
#!/usr/bin/python2.3
# TODO: need to do filter on multiple string TEXT fields
from pyid3v2 import *
from optparse import OptionParser
import sys
import string
FIELDS_TO_CONVERT = ['TIT2','TPE1','TALB', 'TT2', 'TP1', 'TAL']
def quicktext(enc, text):
return (enc, text, [text])
def main():
global FIELDS_TO_CONVERT... | irvingruan/Accordion | mp3conv.py | Python | bsd-2-clause | 6,051 |
"""
Complex Network Experiment with Background Traffic
This experiment will deal with heterogeneous network
that consists of not only PointToPointLink but also
CsmaNetwork, etc
"""
from __future__ import print_function, division
import settings
from core.ns3.NS3Config import BackgroundTrafficConfig
from core.ns3.Topol... | JBonsink/GSOC-2013 | experiments/ComplexNetExperiment.py | Python | gpl-3.0 | 6,182 |
from enigma import eComponentScan, iDVBFrontend
from Components.NimManager import nimmanager as nimmgr
class ServiceScan:
Idle = 1
Running = 2
Done = 3
Error = 4
Errors = {
0: "error starting scanning",
1: "error while scanning",
2: "no resource manager",
3: "no channel list"
}
def scanStatusCha... | libo/Enigma2 | lib/python/Components/ServiceScan.py | Python | gpl-2.0 | 6,502 |
'''tzinfo timezone information for Asia/Dushanbe.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Dushanbe(DstTzInfo):
'''Asia/Dushanbe timezone definition. See datetime.tzinfo for details'''
zone = 'Asia/Dushanbe'
_... | newvem/pytz | pytz/zoneinfo/Asia/Dushanbe.py | Python | mit | 1,449 |
# Copyright [TODO: This year]
| outcoldman/generator-splunkapp | app/templates/splunkapp/django/@appname@/__init__.py | Python | apache-2.0 | 30 |
################################################################################
#
# Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
# The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
#
# This file is part of MadAnalysis 5.
# Official website: <https://launchpad.net/madanalysis5>
#
# MadAnal... | Lana-B/Pheno4T | madanalysis/IOinterface/text_file_writer.py | Python | gpl-3.0 | 1,805 |
import os
from server import app as application, run
if __name__ == '__main__':
ip = os.environ.get('OPENSHIFT_PYTHON_IP', '0.0.0.0')
port = int(os.environ.get('OPENSHIFT_PYTHON_PORT', 8051))
# Para detalhae melhor os Logs no OpenShift
application.config['PROPAGATE_EXCEPTIONS'] = True
run(ip, p... | ButecoOpenSource/openshift-flask | wsgi.py | Python | mit | 324 |
import unittest
import troposphere.ecr as ecr
from troposphere import Tags
class TestECS(unittest.TestCase):
def test_ecr_with_tags(self):
repo = ecr.Repository(
"ECRRepo",
RepositoryName="myrepo",
Tags=Tags(Name="myrepo"),
)
repo.to_dict()
| cloudtools/troposphere | tests/test_ecr.py | Python | bsd-2-clause | 308 |
"""SCons.Tool.pdftex
Tool-specific initialization for pdftex.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation
#
# Permission is hereby granted, f... | bilke/OpenSG-1.8 | SConsLocal/scons-local-0.96.1/SCons/Tool/pdftex.py | Python | lgpl-2.1 | 1,989 |
"""
pybench.py: Test speed of one or more Pythons on a set of simple
code-string benchmarks. A function, to allow stmts to vary.
This system itself runs on both 2.X and 3.X, and may spawn both.
Uses timeit to test either the Python running this script by API
calls, or a set of Pythons by reading spawned command-line... | dreadrel/UWF_2014_spring_COP3990C-2507 | notebooks/scripts/book_code/code/pybench.py | Python | apache-2.0 | 2,640 |
from . import test_account_headquarter
| avanzosc/odoo-addons | account_headquarter/tests/__init__.py | Python | agpl-3.0 | 39 |
from __future__ import absolute_import
import os
import sys
import codecs
import glob
from io import open
base_path = os.path.split(__file__)[0]
if os.path.exists(os.path.join(base_path, u'testdata')):
#release
test_dir = os.path.join(base_path, u'testdata')
else:
#development
test_dir = os.path.abspa... | rcarmo/soup-strainer | html5lib/tests/support.py | Python | mit | 5,137 |
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.forms.models import BaseModelForm, BaseModelFormSet, _get_foreign_key
from django.contrib.admin.utils import get_fields_from_path, NotRelationField
"""
Does basic Model... | simbha/mAngE-Gin | lib/django/contrib/admin/validation.py | Python | mit | 23,889 |
import configparser
import logging
import os
import random
import shutil
import subprocess
import sys
import time
from minecraftd.common import tmux_id
from minecraftd.config import ServiceConfig, ServerConfig
class Service(object):
# Initializes a new service
def __init__(self, minecraftd, service_name):
... | oldmanmike/minecraftd | minecraftd/service.py | Python | gpl-3.0 | 5,121 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) All rights reserved:
# 2013-2014 Servicios Tecnológicos Avanzados (http://serviciosbaeza.com)
# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
#
# This program is f... | rlizana/l10n-spain | __unported__/l10n_es_bank_statement/__openerp__.py | Python | agpl-3.0 | 2,246 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import D... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/transactional_set_add_codec.py | Python | apache-2.0 | 1,225 |
# Copyright (c) 2014 Mirantis 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 writ... | tellesnobrega/storm_plugin | sahara/plugins/vanilla/v2_3_0/versionhandler.py | Python | apache-2.0 | 4,514 |
# -*- coding: utf-8 -*-
# Third Party Stuff
from django.db.models import signals
import re
from . import factories as f
def signals_switch():
pre_save = signals.pre_save.receivers
post_save = signals.post_save.receivers
def disconnect():
signals.pre_save.receivers = []
signals.post_save.... | pythonindia/wye | tests/utils.py | Python | mit | 1,162 |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
"""
Build script for Arduino Framework (based on Wiring).
"""
from os import listdir
from os.path import isfile, join
from SCons.Script import Import, Return
env = None
Import("env")
BOARD_BUILDOPTS = env.get("BOARD_OPTIONS", {}).get("bui... | aphelps/platformio | platformio/builder/scripts/frameworks/arduino.py | Python | mit | 3,406 |
"""
Multi-perspective matching layer
"""
from typing import Tuple, List
import torch
import torch.nn as nn
import torch.nn.functional as F
from allennlp.common.checks import ConfigurationError
from allennlp.common.registrable import FromParams
from allennlp.nn.util import (
get_lengths_from_binary_sequence_mask,... | allenai/allennlp | allennlp/modules/bimpm_matching.py | Python | apache-2.0 | 15,794 |
import numpy as np
import factorial as fct
def sinX():
x = float(input('Choose a x for (x * pi)/ d radians:'))
d = float(input('Choose a d for (x * pi)/ d radians:'))
termI = 1
termEx = 0
y = (x / d) * np.pi
senOfX = 0
while termEx < 50:
senOfX += ((y ** termI) / (fct.f... | SagazBR/Calculo-Numerico | senoCosseno.py | Python | gpl-3.0 | 820 |
from abjad.tools.pitchtools.Vector import Vector
class PitchClassVector(Vector):
'''A pitch-class vector.
.. container:: example
::
>>> vector = pitchtools.PitchClassVector(
... items=[7, 6, -2, -3, -3, 0, 1, 14, 15, 16, 16],
... item_class=pitchtools.Nu... | mscuthbert/abjad | abjad/tools/pitchtools/PitchClassVector.py | Python | gpl-3.0 | 4,027 |
from unittest import TestCase, main
from mock import MagicMock, patch
from rant.serve import Server
SOURCE_DIR = 'tests/test_site'
DEST_DIR = 'tests/test_site/deploy'
class TestGenerate(TestCase):
def setUp(self):
self.server = Server(SOURCE_DIR, DEST_DIR)
def test_build(self):
with patch("r... | lrvick/rant | tests/test_serve.py | Python | apache-2.0 | 695 |
from contextlib import contextmanager
import functools
import operator
import sys
import warnings
import numbers
from collections import namedtuple
import inspect
import math
from typing import (
Optional,
Union,
TYPE_CHECKING,
TypeVar,
)
import numpy as np
IntNumber = Union[int, np.integer]
DecimalNu... | anntzer/scipy | scipy/_lib/_util.py | Python | bsd-3-clause | 18,765 |
def unittest(data_path, temp_path):
import image
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
circles = img.find_circles(threshold = 5000, x_margin = 30, y_margin = 30, r_margin = 30)
return len(circles) == 1 and circles[0][0:] == (118, 56, 22, 5856)
| openmv/openmv | scripts/unittest/script/10-find_circles.py | Python | mit | 285 |
def get_data():
import pickle
with open('data.p', 'rb') as f:
return pickle.load(f)
if __name__ == '__main__':
import praw
import os, os.path
from datetime import datetime, timedelta
# Change the working directory to the script directory
os.chdir(os.path.dirname(os.pat... | chaosking121/best-of-nosleep | script.py | Python | mit | 1,416 |
#!/bin/env python
import os
import sys
import signal
criu_tests_dir = sys.argv[1]
test_list = map(lambda x: x.strip(), open(sys.argv[2]).readlines())
def wup(foo, bar):
pass
signal.signal(signal.SIGTERM, wup)
def getmlist():
return map(lambda x: x.split()[4], open("/proc/self/mountinfo").readlines())
def try_umo... | marcosnils/p.haul | test/zdtm/ct_init.py | Python | lgpl-2.1 | 1,586 |
import asyncio
import aioredis
async def pubsub():
sub = await aioredis.create_redis(
'redis://localhost')
ch1, ch2 = await sub.subscribe('channel:1', 'channel:2')
assert isinstance(ch1, aioredis.Channel)
assert isinstance(ch2, aioredis.Channel)
async def async_reader(channel):
... | ymap/aioredis | examples/pubsub2.py | Python | mit | 1,683 |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 22 10:27:34 2014
@author: s1105
"""
"""
Liest entweder ein Stereo- oder Audio-Signal ein, berechnet daraus mit Hilfe
der FFT die Geschwindigkeit. Diese wird in Form der aktuellen Geschwindigkeit
und als Plot der letzten 20 s auf einem Bildschirm ausgegeben. Der parallel... | codingKilian/radarPython | endversionvollbildGroessereGeschwindigkeitsbereich.py | Python | gpl-3.0 | 14,103 |
# /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2012-7-26
@author: zepheir
'''
from zhyDB import ZhyDB
import config
from config import *
import time
class HistoryConsole(object):
"""docstring for HistoryConsole"""
def __init__(self):
super(HistoryConsole, self).__ini... | zepheir/pySrv_sipai | srv/src/histroyConsole.py | Python | apache-2.0 | 3,263 |
#!/usr/bin/env python2
# -*- encoding:utf-8 -*-
import os
from flask import Flask
from flask.ext.script import Manager
from app import create_app
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
if __name__ == "__main__":
manager.run()
| foundatron/soundatron | manage.py | Python | bsd-2-clause | 274 |
#!/usr/bin/python
# This was originally created to target inclusion in soumith's benchmarks as
# https://github.com/soumith/convnet-benchmarks
# extending this to handle also a couple of clarke and storkey type layers
# and some plausible mnist layers
from __future__ import print_function
import os
import sys
import ... | MiniLight/DeepCL | python/benchmarking/deepcl_benchmark2.py | Python | mpl-2.0 | 11,420 |
# -*- coding: utf-8 -*-
# Scrapy settings for spider_myfirstpjt project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/la... | jinzekid/codehub | python/py3_6venv/spider_myfirstpjt/spider_myfirstpjt/settings.py | Python | gpl-3.0 | 4,140 |
from gi.repository import GObject, Gtk
class PageableListStore (Gtk.ListStore):
"""A ListStore designed to show bits of data at a time.
We show chunks of data from our parent list in pages of a set size.
parent_args and parent_kwargs get handed to setup_parent.
It shouldn't be too hard to expand th... | kirienko/gourmet | src/gourmet/gtk_extras/pageable_store.py | Python | gpl-2.0 | 13,786 |
"""
.. versionadded:: 0.1
.. versionchanged:: 1.2.0
"""
import numpy as np
class AdaptiveFilter():
"""
Base class for adaptive filter classes. It puts together some functions
used by all adaptive filters.
"""
def __init__(self, n, mu, w="random"):
"""
This class represents an gene... | matousc89/padasip | padasip/filters/base_filter.py | Python | mit | 9,726 |
hello = 'hello world'
print(hello)
| Kyrios-1/Pypro | hello.py | Python | gpl-3.0 | 35 |
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class StockPicking(models.Model):
_inherit = 'stock.picking'
deliver = fields.Char(string="Deliver at")
| sandrafig/addons | stock_picking_reports/models/stock_picking.py | Python | agpl-3.0 | 179 |
from django.conf.urls import url
from .views import (
UserCreateAPIView,
UserLoginAPIView
)
urlpatterns = [
url(r'^login/$', UserLoginAPIView.as_view(), name='login'),
url(r'^register/$', UserCreateAPIView.as_view(), name='register'),
]
| jonaqp/heroku | apps/customer/api/urls.py | Python | mit | 255 |
# This file is part of ReText
# Copyright: Dmitry Shachnev 2012
# License: GNU GPL v2 or higher
from ReText import *
from ReText.webpages import wpInit, wpUpdateAll
from ReText.htmldialog import HtmlDialog
from ReText.highlighter import ReTextHighlighter
from ReText.editor import ReTextEdit
class LocaleDialog(QDialog... | fzumstein/retext | ReText/window.py | Python | gpl-3.0 | 45,697 |
import os
import time
import traceback
from couchpotato import get_db
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, addEvent, fireEventAsync
from couchpotato.core.helpers.encoding import sp
from couchpotato.core.helpers.variable import splitString, getTitle, tryInt, getIdentifier... | jeroenj/CouchPotatoServer | couchpotato/core/plugins/manage.py | Python | gpl-3.0 | 12,264 |
# -*- coding: utf-8 -*-
# *********************************************************************
# lewis - a library for creating hardware device simulators
# Copyright (C) 2016-2021 European Spallation Source ERIC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | DMSC-Instrument-Data/plankton | lewis/examples/modbus_device/__init__.py | Python | gpl-3.0 | 1,792 |
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtWidgets import QTableWidgetItem
from .validationinformationui import Ui_Dialog
class ValidationInformation(QtWidgets.QDialog, Ui_Dialog):
def __init__(self, widget, main_app):
super().__init__(widget)
Ui_Dialog.__init__(self)
self.setupUi(s... | luisza/dfva_client | src/client_fva/ui/validationinformation.py | Python | gpl-3.0 | 6,553 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.