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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2010, Jesse Liesch
# 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
# notic... | Sir-Henry-Curtis/XBMC_Remote | XBMC/service.ir.remote/resources/library/db.py | Python | gpl-3.0 | 11,087 |
import os
import pathlib
import urllib.request
from collections import namedtuple
from typing import Optional
from lxml import etree
MATERIALSDBINDEXURL = "http://www.materialsdb.org/download/ProducerIndex.xml"
def get_cache_folder():
cache_dir = pathlib.Path(
os.environ.get("APPDATA")
or os.envi... | CyrilWaechter/pyRevitMEP | lib/materialsdb/cache.py | Python | gpl-3.0 | 2,862 |
#!/usr/bin/python
#
# This file is part of LibQtTracker project
#
# Copyright (C) 2009, Nokia
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at ... | dudochkin-victor/libqttracker | tools/build/detail/service2rdfxml.py | Python | lgpl-2.1 | 6,867 |
_base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
backbone=dict(
type='ResNeSt',
stem_channels=64,
depth=50,
radix=2,
reduction_factor=4,
avg_down_stride=True,
num_stages=4,
out_in... | open-mmlab/mmdetection | configs/resnest/faster_rcnn_s50_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py | Python | apache-2.0 | 1,947 |
# coding=utf-8
# pylint: disable-msg=E1101,W0612
import numpy as np
import pytest
import pandas._libs.lib as lib
import pandas as pd
import pandas.util.testing as tm
from .common import TestData
class TestSeriesReplace(TestData):
def test_replace(self):
N = 100
ser = pd.Series(np.random.randn(... | harisbal/pandas | pandas/tests/series/test_replace.py | Python | bsd-3-clause | 9,775 |
#####################################################################
# Example : perform intrinsic calibration of a connected camera
# Author : Toby Breckon, toby.breckon@durham.ac.uk
# Copyright (c) 2018-2021 Department of Computer Science,
# Durham University, UK
# License : LGPL - http:/... | tobybreckon/python-examples-cv | calibrate_camera.py | Python | lgpl-3.0 | 8,076 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0011_widget_is_raw'),
]
operations = [
migrations.AddField(
model_name='widget',
name='bl... | vesellov/callfeed.net | mainapp/migrations/0012_auto_20150525_1959.py | Python | mit | 2,217 |
import os
import threading
from typing import List
import time
import logging
import requests
from .School import School
from .DispatcherManager import DispatcherManager
class StatusMonitor(threading.Thread):
def __init__(self, dispatcher_manager: DispatcherManager, schools: List[dict]):
super(StatusM... | nint8835/SchoolTracker | SchoolTracker/StatusMonitor.py | Python | mit | 2,247 |
#
# (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 ap... | coreycb/horizon | openstack_dashboard/api/rest/neutron.py | Python | apache-2.0 | 8,279 |
# 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/rollback_discount_effect_props.py | Python | mit | 5,173 |
#!/usr/bin/python
import unittest
import os
import random
import numpy as np
from pymatgen.core.structure import Structure
from pymatgen.core.lattice import Lattice
from pymatgen.core.surface import Slab, SlabGenerator, generate_all_slabs, \
get_symmetrically_distinct_miller_indices
from pymatgen.symmetry.group... | sonium0/pymatgen | pymatgen/core/tests/test_surface.py | Python | mit | 13,101 |
#!/usr/bin/python2.7
# Run this script as user: www-data
import os
import server_path
import squeakspace.server.db_sqlite3 as db
import config
try:
os.remove(config.db_path)
except OSError:
pass
conn = db.connect(config.db_path)
c = db.cursor(conn)
db.make_db(c, config.total_quota)
db.commit(conn)
db.close(c... | eek6/squeakspace | admin/init_server_db.py | Python | gpl-3.0 | 325 |
import sys
from zephyrus.components import ComponentManager
import zephyrus.script as sc
class LogSection(sc.ConfigSection):
parameters = [
sc.Parameter('main_log', 'Main log filename(str)', str),
sc.Parameter('population_log', 'Population log filename (str)', str),
sc.Parameter('final_po... | wairton/zephyrus-mas | zephyrus/examples/vacuum/config_builder.py | Python | mit | 2,589 |
# encoding: utf-8
# module dbm
# from /usr/lib/python2.7/lib-dynload/dbm.x86_64-linux-gnu.so
# by generator 1.135
# no doc
# no imports
# Variables with simple values
library = 'Berkeley DB'
# functions
def open(path, flag=None, mode=None): # real signature unknown; restored from __doc__
"""
open(path[, fla... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/dbm.py | Python | gpl-2.0 | 718 |
from new.fanfoucli.config import cfg
from new.fanfoucli.fan import Fan
import sys
import logging
logging.basicConfig(level=logging.DEBUG)
def test_auth():
f = Fan(cfg)
f.view()
def test_main():
sys.argv[1:] = ['-V']
from new.fanfoucli.cli import main
main()
def test_switch():
fan = Fan(cf... | j178/fanfou-cli | test/__init__.py | Python | mit | 586 |
"""
**************
Graph Matching
**************
Given a graph G = (V,E), a matching M in G is a set of pairwise non-adjacent
edges; that is, no two edges share a common vertex.
`Wikipedia: Matching <https://en.wikipedia.org/wiki/Matching_(graph_theory)>`_
"""
import networkx as nx
__all__ = ["min_maximal_matching"]... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/external/networkx/algorithms/approximation/matching.py | Python | gpl-3.0 | 1,155 |
# Exercise 3
#
# Improve the Who's Your Daddy program by adding a choice that lets the user enter a name and get back a grandfather.
# Your program should still only use one dictionary of son-father pairs. Make sure to include several generations in
# your dictionary so that a match can be found.
#
# We used dictionar... | dmartinezgarcia/Python-Programming | Chapter 5 - Lists and dictionaries/exercise_4.py | Python | gpl-2.0 | 2,754 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'EntrezTerm'
db.create_table(u'entrez_entrezterm', (
(u'id', self.gf('django.db.m... | indexofire/gork | src/gork/application/entrez/migrations/0001_initial.py | Python | mit | 8,146 |
# vim: set fileencoding=utf-8:
# GNU Solfege - free ear training software
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011 Tom Cato Amundsen
#
# 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 Fr... | allancarlos123/Solfege | solfege/application.py | Python | gpl-3.0 | 33,473 |
"""
Functions to study r2 landscapes (equivalent of dispersion spectra) and similar stuff.
"""
import sys, os
import pycs.gen.lc
import pycs.gen.spl
import pycs.gen.util
import pycs.spl.multiopt
import numpy as np
import scipy.optimize as spopt
def explore(lcs, sourcespline, tss):
"""
We explore a volume of t... | COSMOGRAIL/PyCS | pycs/spl/old/multispec.py | Python | gpl-3.0 | 3,019 |
# coding=utf-8
class ImporterUtils():
def __init__(self):
pass
@staticmethod
def program_categories_for_prijepolje():
programs = {
"СКУПШТИНА ОПШТИНЕ- ПРОГРАМ 15-ЛОК.САМОУПРАВА":[
"Програмска активност 0001-Функционисање локалне самоуправе",
],
... | opendatakosovo/data-centar | importer/utils.py | Python | gpl-2.0 | 88,188 |
from django.conf.urls.defaults import *
from encampment.models import Room, TimeSlot, Presentation, Attendee, Sponsor
urlpatterns = patterns('',
url(r'^schedule/$', 'encampment.views.schedule', {}, 'schedule'),
url(r'^schedule/room-(?P<object_id>[0-9]+)/$', 'django.views.generic.list_detail.object_detail', {'... | pombredanne/encampment | urls.py | Python | bsd-3-clause | 994 |
#! /usr/bin/python
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class Example(QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
self.text = "hello world"
self.setGeometry(100,100, 600,600)
self.setWindowTitle('Draw ... | mkhuthir/learnPython | Book_pythonlearn_com/24_pyqt/draw.py | Python | mit | 965 |
#!/usr/bin/python2.4
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following... | yantrabuddhi/nativeclient | site_scons/site_tools/component_builders.py | Python | bsd-3-clause | 22,789 |
###
# Copyright (c) 2013, spline
# All rights reserved.
#
#
###
"""
Add a description of the plugin (to be presented to the user inside the wizard)
here. This should describe *what* the plugin does.
"""
import supybot
import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CV... | avinson/Supybot-Titler | __init__.py | Python | mit | 1,166 |
#structly_with_inspect.py
class Structure:
_fields = []
def __init__(self, *args):
for name, val in zip(self._fields, args):
setattr(self, name, val)
class Stock(Structure):
_fields = ['name', 'shares', 'price']
class Point(Structure):
_fields = ['x', 'y']
class Address(Structure... | kmad1729/python_notes | metaprogramming/start.py | Python | unlicense | 471 |
from project.models.fields.Field import Field
from project.models.fields.exceptions import FieldValidException
THEME_MIN_LENGTH = 0
THEME_MAX_LENGTH = 128
class ThemeField(Field):
def __init__(self, theme):
self.set(theme)
def set(self, theme):
if x = chain_of_conditions()
raise ... | AbramovVitaliy/Abramov-RIS-13 | lab4_5_6/project/models/fields/ThemeField.py | Python | mit | 734 |
# -*- coding: utf-8 -*-
import os
import sys
sys.path.append(os.path.join(os.getcwd(), os.path.pardir))
import unittest
from digraph import digraph
from graph import graph
from graph_algorithms import *
class test_graph(unittest.TestCase):
def setUp(self):
self.gr = graph()
self.gr.add_nodes(["s... | NicovincX2/Python-3.5 | Algorithmique/Algorithme/Algorithme de la théorie des graphes/graph_algorithms_test.py | Python | gpl-3.0 | 5,705 |
# -*- coding: utf-8 -*-
##
## Copyright © 2007, Matthias Urlichs <matthias@urlichs.de>
##
## 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... | smurfix/HomEvenT | modules/bool.py | Python | gpl-3.0 | 2,922 |
from nose.tools import *
from exercises import ex10
def test_overlapping():
'''
Check that we return true when something overlaps
'''
test_overlapping_number = ex10.overlapping([1, 2, 3], [1, 3, 4])
assert_true(test_overlapping_number)
def test_no_overlapping():
'''
Check that we return f... | gravyboat/python-exercises | tests/ex10_tests.py | Python | mit | 467 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------#
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
# Copyright (C) 2005-2009 Skomoroh
#
# This program is free softwar... | shlomif/PySolFC | pysollib/kivy/tktree.py | Python | gpl-3.0 | 13,687 |
"""
Views related to operations on course objects
"""
import json
import random
import string # pylint: disable=W0402
import logging
from django.utils.translation import ugettext as _
import django.utils
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.views.decora... | c0710204/edx-platform | cms/djangoapps/contentstore/views/course.py | Python | agpl-3.0 | 60,590 |
# This file is part of beets.
# Copyright 2015, Fabrice Laporte.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy,... | andremiller/beets | beetsplug/bucket.py | Python | mit | 8,043 |
import webapp2
class Root(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, World!\n')
class Test(webapp2.RequestHandler):
def get(self):
self.response.write('foo was set to %s' % self.request.get("foo"))
app = web... | step15/gae-examples | pytest/test.py | Python | mit | 396 |
#!/usr/bin/env python
'''
this script is a tool to clean and process data from logs from stdout
in order to import it to a matlab variable
and save the data to separate files (death.txt, fitness.txt, etc.)
finds the lowest number of columns within run attributes (death, fitness, population)
and clips other attributes... | ParaPhraseAGH/erlang-emas | scripts/logs_to_matlab.py | Python | mit | 3,200 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 ~ 2013 Deepin, Inc.
# 2011 ~ 2013 Hou ShaoHui
#
# Author: Hou ShaoHui <houshao55@gmail.com>
# Maintainer: Hou ShaoHui <houshao55@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the ter... | lovesnow/weido | src/weido.py | Python | gpl-3.0 | 3,943 |
"""
mbus for python
"""
| Cougar/python-mbus | mbus/__init__.py | Python | bsd-3-clause | 24 |
__author__ = 'Denis Mikhalkin'
from engine.handlers import SQSHandler
from engine import Engine, ResourceCondition, Resource, EventCondition
import logging
from boto import sqs
import threading
from time import sleep
import unittest
class TestSQSRepository(unittest.TestCase):
def test(self):
logging.basi... | denismo/DevOpsGears | tests/testSQSRepository.py | Python | gpl-3.0 | 1,014 |
# -*-coding:utf-8 -*
# Copyright (c) 2011-2015, 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:
#
# 1. Redistributions of source code must retain the above copyright notice, thi... | Makohoek/parameter-framework | test/functional-tests/PfwTestCase/Domains/tDomain_Elements.py | Python | bsd-3-clause | 16,700 |
# POK header
#
# The following file is a part of the POK project. Any modification should
# be made according to the POK licence. You CANNOT use this file or a part
# of a file for your own project.
#
# For more information on the POK licence, please see our LICENCE FILE
#
# Please follow ... | pok-kernel/pok | misc/execution_test.py | Python | bsd-2-clause | 2,197 |
# 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... | metacloud/python-keystoneclient | keystoneclient/fixture/v2.py | Python | apache-2.0 | 4,823 |
'''
Copyright (c) Microsoft. All rights reserved.
This code is licensed under the MIT License (MIT).
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
Developed by Minigraph
... | KevindeQ/DirectX-Graphics-Samples | MiniEngine/Tools/Scripts/CreateNewProject.py | Python | mit | 3,338 |
# -*- coding: utf-8 -*-
from datetime import datetime
from threading import Thread
from .follower import BaseFollower
from .log import logger
class RiceQuantFollower(BaseFollower):
def __init__(self):
super().__init__()
self.client = None
def login(self, user=None, password=None, **kwargs):... | msincenselee/vnpy | vnpy/api/easytrader/ricequant_follower.py | Python | mit | 4,413 |
#!/usr/bin/env python
"""
Script to get data_internal from KPI data_internalbase and render dashboard HTML files.
"""
from __future__ import print_function
import click
from datetime import datetime
from distutils.dir_util import copy_tree
import logging
import jinja2
import json
import os
import urllib
import yaml
... | NationalGenomicsInfrastructure/NGI_dashboards | make_dashboards/make_dashboards.py | Python | mit | 3,999 |
# Copyright 2012 VMware, 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 by... | samsu/neutron | plugins/vmware/api_client/client.py | Python | apache-2.0 | 5,785 |
"""mandelbrot benchmark"""
from time import time
def pprint(arr, w):
x = []
for a in arr:
x.append(a)
if len(x) >= w:
print( [ round(y,2) for y in x] )
x = []
def mandelbrot_numpy(size=512, exit_limit=100):
img_array = numpy.zeros([size, size], int)
for y in range(size):
for x in range(size):
c ... | pombredanne/Rusthon | regtests/bench/mandelbrot.py | Python | bsd-3-clause | 1,215 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Your application """
class Application:
def __init__(self):
self.plugins = {}
self.init_plugins()
def enable_debug(self):
from model.Common import Common
Common.set_debug(True)
def init_plugins(self):
from src.plugi... | kefniark/turnkey-tools | src/app.py | Python | mit | 3,640 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("actstream", "0007_auto__add_field_follow_started"),
)
def forwards(self, orm):
# Removing unique constrai... | AnnalisaS/migration_geonode | geonode/layers/migrations/0008_auto__del_link__del_topiccategory__del_contactrole__del_unique_contact.py | Python | gpl-3.0 | 25,702 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/contrib/keras/python/keras/layers/core.py | Python | bsd-2-clause | 27,677 |
"""
Copyright (c) 2007 Jan-Klaas Kollhof
This file is part of jsonrpc.
jsonrpc 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) any later... | mungerd/latbuilder | web-ui/share/latbuilder/web-ui/services/jsonrpc/proxy.py | Python | gpl-3.0 | 1,711 |
#! /usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2015 creon (creon.nu@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | inuitwallet/plunge | client/exchanges.py | Python | mit | 35,228 |
from tensorflow.keras import backend as K
abs_definitions = [
{'name': 'add_class',
'nargs': '+',
'type': int,
'help': 'flag to add abstention (per task)'},
{'name': 'alpha',
'nargs': '+',
'type': float,
'help': 'abstention penalty coefficient (per task)'},
{'name': 'min_acc',... | ECP-CANDLE/Benchmarks | Pilot1/NT3/abstain_functions.py | Python | mit | 6,278 |
nd<caret>
| siosio/intellij-community | python/testData/completion/className/pythonSkeletonsVariantsNotSuggested/pythonSkeletonsVariantsNotSuggested.py | Python | apache-2.0 | 10 |
import requests
import time
while 1:
r = requests.put("http://localhost:3000/api/4", data={"temperature": 24, "led": 1})
print r.text
time.sleep(1) | phodal/iot-code | chapter5/test-post.py | Python | mit | 160 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
token = client.tokens.creat... | teoreteetik/api-snippets | rest/token/list-post-1-hour-example/list-post-1-hour-example.6.x.py | Python | mit | 354 |
# coding: utf-8
from collections import namedtuple
from pandas.io.msgpack.exceptions import * # noqa
from pandas.io.msgpack._version import version # noqa
class ExtType(namedtuple("ExtType", "code data")):
"""ExtType represents ext type in msgpack."""
def __new__(cls, code, data):
if not isinstan... | toobaz/pandas | pandas/io/msgpack/__init__.py | Python | bsd-3-clause | 1,223 |
from __future__ import absolute_import
import operator
from django.db import models
from django.db.models import Q
from django.db.models.signals import post_delete, post_save
from django.utils import timezone
from sentry.db.models import Model, sane_repr
from sentry.db.models.fields import FlexibleForeignKey, JSONF... | beeftornado/sentry | src/sentry/models/projectownership.py | Python | bsd-3-clause | 6,907 |
"""
Description of the video:
Mimic of Star Wars' opening title. A text with a (false)
perspective effect goes towards the end of space, on a
background made of stars. Slight fading effect on the text.
"""
import numpy as np
from skimage import transform as tf
from moviepy.editor import *
from moviepy.video.tools.dr... | DevinGeo/moviepy | examples/star_worms.py | Python | mit | 4,800 |
# yaranullin/game/tmx_wrapper.py
#
# Copyright (c) 2012 Marco Scopesi <marco.scopesi@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE S... | ciappi/Yaranullin | yaranullin/game/tmx_wrapper.py | Python | isc | 5,096 |
RERUN_ERRORS = [
"can't receive further commands",
'Original error: Error: ESOCKETTIMEDOUT',
"The server didn't respond in time.",
'An unknown server-side error occurred while processing the command.',
'Could not proxy command to remote server. Original error: Error: socket hang up',
'The server... | status-im/status-react | test/appium/support/test_rerun.py | Python | mpl-2.0 | 1,245 |
# wiener.py - functions related to the Wiener index of a graph
#
# Copyright 2015 NetworkX developers.
#
# This file is part of NetworkX.
#
# NetworkX is distributed under a BSD license; see LICENSE.txt for more
# information.
"""Functions related to the Wiener index of a graph."""
from __future__ import division
from... | cmtm/networkx | networkx/algorithms/wiener.py | Python | bsd-3-clause | 2,586 |
from django.conf import settings
from django.conf.urls import patterns, url
from django.core.exceptions import ImproperlyConfigured
from django.db.models.loading import get_models
extra_views_available = True
try:
from extra_views import InlineFormSet
except ImportError:
extra_views_available = False
from .... | dekkers/django-easycrud | easycrud/urls.py | Python | bsd-2-clause | 3,053 |
#! /usr/bin/env python
# -*- coding:Utf8 -*-
# Rechercher l'indice d'un caractère donné dans une chaîne
def trouve(ch, car, deb=0):
"trouve l'indice du caractère car dans la chaîne ch"
i = deb
while i < len(ch):
if ch[i] == car:
return i # le caractère est trouvé -> on termine
... | widowild/messcripts | exercice/python3/solutions_exercices/exercice_10_03.py | Python | gpl-3.0 | 583 |
from django.views.generic.detail import DetailView
from django.views.generic.edit import UpdateView, DeleteView
from catalog.views.base import GenericListView, GenericCreateView
from catalog.models import Astronaut, CrewedMission
from catalog.forms import AstronautForm
from catalog.filters import AstronautFilter
from d... | Hattivat/hypergolic-django | hypergolic/catalog/views/astronaut_views.py | Python | agpl-3.0 | 1,773 |
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
from trytond.model import ModelSQL, ModelView, fields
from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval, Bool
from trytond.transaction import T... | openlabs/trytond-carrier-zone | carrier.py | Python | bsd-3-clause | 4,654 |
"""
This python script adds a new gdb command, "dump-guest-memory". It
should be loaded with "source dump-guest-memory.py" at the (gdb)
prompt.
Copyright (C) 2013, Red Hat, Inc.
Authors:
Laszlo Ersek <lersek@redhat.com>
Janosch Frank <frankja@linux.vnet.ibm.com>
This work is licensed under the terms of the GNU... | afaerber/qemu-cpu | scripts/dump-guest-memory.py | Python | gpl-2.0 | 18,166 |
from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.Image import Image
from pyjamas.ui.HTML import HTML
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas.ui.HorizontalPanel import HorizontalPanel
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.Canvas2D import Canvas, CanvasImage, ImageLoadL... | minghuascode/pyj | examples/addonsgallery/Canvas2DTab.py | Python | apache-2.0 | 9,256 |
from .gsm_action import GsmAction
class CallAction(GsmAction):
def __init__(self, app, id_, serial_url, number, seconds):
super().__init__(app, id_, serial_url)
self.number = number
self.seconds = seconds
async def run(self):
self.logger.info('make_call')
await self.g... | insolite/alarme | alarme/extras/action/gsm/call_action.py | Python | mit | 361 |
from time import time as timestamp
import hashlib
from api.web import APIHandler
from api.exceptions import APIException
from api.server import handle_api_url
from libs import config
from libs import db
@handle_api_url("test/create_anon_tuned_in/(\d+)")
class CreateAnonTunedIn(APIHandler):
description = "Creates a ... | williamjacksn/rainwave | api_requests/admin_web/developer.py | Python | gpl-2.0 | 4,050 |
# 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. You may obtain
# a ... | bgxavier/nova | nova/tests/unit/test_metadata.py | Python | apache-2.0 | 38,119 |
from capstone.game.games import TicTacToe
from capstone.game.players import RandPlayer
from capstone.game.utils import play_series
game = TicTacToe()
players = [RandPlayer(), RandPlayer()]
play_series(game, players)
| davidrobles/mlnd-capstone-code | experiments/play_tic_tac_toe_series.py | Python | mit | 217 |
"""add friendships table
Revision ID: 553bdd8a749f
Revises: 553bdd8a749e
Create Date: 2018-04-19 14:24:33.050913
"""
# revision identifiers, used by Alembic.
revision = '553bdd8a749f'
down_revision = '553bdd8a749e'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
utc_now = sa.... | dgnorth/drift-base | alembic/versions/553bdd8a749f_add_clients_indices.py | Python | mit | 1,137 |
# -*- coding: utf-8 -*-
import os
import struct
from .base import FirmwareObject, BaseObject, StructuredObject
from .utils import *
from .structs.flash_structs import *
class RegionSection(StructuredObject):
size = 20
def __init__(self, data):
self.parse_structure(data, FlashRegionSectionType)
cl... | RafaelRMachado/uefi-firmware-parser | uefi_firmware/flash.py | Python | mit | 5,981 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import os
from lib.core.common import singleTimeWarnMessage
from lib.core.enums import DBMS
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOW
def dependencies... | V11/volcano | server/sqlmap/tamper/space2mysqldash.py | Python | mit | 1,161 |
import numpy as np
# Malisiewicz et al.
def non_max_suppression(boxes, overlapThresh):
# if there are no boxes, return an empty list
if len(boxes) == 0:
return []
# if the bounding boxes integers, convert them to floats --
# this is important since we'll be doing a bunch of divisions
if boxes.dtype.kind == "i... | rawcoder/object-detection | VOCdevkit/nms.py | Python | gpl-2.0 | 1,737 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# Copyright 2012, 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:/... | gorocacher/payload | payload/openstack/common/excutils.py | Python | apache-2.0 | 3,748 |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014-2018 Shi Chi(Mack Stone)
#
# 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 limit... | mackst/glm | glm/detail/func_geometric.py | Python | mit | 3,822 |
# coding=utf-8
"""This module, trading_model.py, represents a trading model used in both training and testing."""
FINANCE_MODEL_TYPE_M0 = 'm0_net_resistance'
class FinanceModel(object):
"""Represents a financial model that can be both trained and tested."""
def __init__(self, model_type, types_of_data_needed):
... | utarsuno/quasar_source | deprecated/finance/finance_simulations/models/trading_model.py | Python | mit | 1,363 |
from flask import Blueprint
users = Blueprint("users", __name__,
template_folder='templates',
static_folder='static',
static_url_path='/static/users')
from views import *
| GautamAnghore/clic-o-matic | apps/users/__init__.py | Python | gpl-2.0 | 227 |
# -*- coding: utf-8 -*-
import _global as g
def foo(a, b, c):
return 2 + (256 + 3 + (444 + 34));
def foo(a, b, c):
return 2 + (256 + 3 + (444 + 34));
def bar(a, b):
return a * b;
g.bar = bar
| niwinz/cobrascript | samples/sample1.py | Python | bsd-3-clause | 210 |
#encoding:utf-8
from Configs.GlobalConfig import Hosts, DataStorages, IsoStorages, ExportStorages
'''
---------------------------------------------------------------------------------------------------
@note: ModuleTestData
--------------------------------------------------------------------------------------------... | faylau/oVirt3.3WebAPITest | src/TestData/Volume/ITC10_SetUp.py | Python | apache-2.0 | 6,407 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/db/migrate/versions/010_fix_column_lengths.py | Python | gpl-3.0 | 2,740 |
"""
Name: Abanoub Milad Nassief
Email: abanoubcs@gmail.com
Description: citation paper analyser
Imports physics citation graph
"""
# general imports
from pylab import *
import math
###################################
# Code for loading citation graph
def load_graph():
"""
Function that loads a graph give... | AbanoubM/Algorithmic-Thinking | citation paper analyser/citation_analyser.py | Python | mit | 2,051 |
import sys; sys.path.append("../")
import unittest
from collections import OrderedDict
from baemo.references import Reference
from baemo.references import References
from baemo.exceptions import ReferencesMalformed
class TestReferences(unittest.TestCase):
# __init__
def test___init___no_params(self):
... | chrisantonellis/pymongo_basemodel | test/test_references.py | Python | mit | 3,808 |
# coding: utf-8
#
# Credit to Jess Teale for original idea
# (c) Igor Smolinski 2017
# (c) Jess Teale 2017
#
from subprocess import call#for importing colour
from time import sleep #For waiting
import random #For randomisation of question
import os #For cls/clear
import sys #???
import site #???
impor... | igor-dot-gz/spfr | version/sp-fr-revision.6.py | Python | mit | 16,167 |
# -*- coding: utf-8 -*-
import os
import json
import requests
import logging
from rest_framework import serializers
from rest_framework.exceptions import APIException
from django.core.files.base import ContentFile
from django.contrib.auth.models import User
from django.utils.translation import ugettext_noop
from djan... | eos87/Booktype | lib/booktype/api/editor/serializers.py | Python | agpl-3.0 | 17,781 |
from itertools import combinations_with_replacement
class Main:
def __init__(self):
self.a, self.n = input().split()
def output(self):
for i in combinations_with_replacement(sorted(self.a), int(self.n)):
print(''.join(i))
if __name__ == '__main__':
obj... | MrinmoiHossain/HackerRank | Python/Itertools/itertools.combinations_with_replacement().py | Python | mit | 347 |
#!/usr/bin/python
# Copyright (c) 2014 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.
import collections
import json
import optparse
import os
import shutil
import subprocess
import sys
import tempfile
import urllib2
S... | 7kbird/chrome | native_client_sdk/src/doc/doxygen/generate_docs.py | Python | bsd-3-clause | 8,799 |
from django.conf import settings
from django.db import migrations, models
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
... | edx/edx-platform | openedx/core/djangoapps/django_comment_common/migrations/0001_initial.py | Python | agpl-3.0 | 1,369 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
import numpy as np
import vtool as vt
from six.moves import zip, map, range
from scipy.spatial import distance
import scipy.cluster.hierarchy
import sklearn.cluster
(print, rrr, profile) = ut.in... | SU-ECE-17-7/ibeis | ibeis/algo/preproc/preproc_occurrence.py | Python | apache-2.0 | 19,943 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'About.ui'
#
# Created: Sun Aug 16 22:14:37 2015
# by: PyQt5 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attribut... | karivatj/MouseAutoClicker | src/AboutUI.py | Python | gpl-2.0 | 3,313 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Martine Lenders <mail@martine-lenders.eu>
#
# Distributed under terms of the MIT license.
from __future__ import print_function
import os
import sys
import random
import subprocess
import time
import types
import pexpect
DEFAULT_TIM... | BytesGalore/RIOT | tests/lwip/tests/01-run.py | Python | lgpl-2.1 | 11,453 |
from jsonschema import validate # type: ignore
from jsonschema.exceptions import ValidationError # type: ignore
from django.test import TestCase
from django.conf import settings
from .api_tests import *
from .test_load_datamodel import *
if settings.TEST_RUNNER == 'selenium_testsuite_runner.SeleniumTestSuiteRunner... | specify/specify7 | specifyweb/specify/tests.py | Python | gpl-2.0 | 638 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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... | matholroyd/electrum | electrum4a.py | Python | gpl-3.0 | 30,081 |
# Copyright (c) 2014 Montavista Software, 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 applic... | ekcs/congress | congress/tests/datasources/test_cinder_driver.py | Python | apache-2.0 | 6,149 |
# -*- coding: utf-8 -*-
"""Providing automated testing functionality
.. module:: yoda.yoda
:platform: Unix
:synopsis: Providing automated testing functionality
.. moduleauthor:: Petr Czaderna <pc@hydratk.org>
"""
"""
Events:
-------
yoda_before_init_tests
yoda_before_append_test_file
yoda_before_process_tests
... | hydratk/hydratk-ext-yoda | src/hydratk/extensions/yoda/yoda.py | Python | bsd-3-clause | 36,383 |
# Mark Recapture Helper Scripts
import json
import DeriveFinalResultSet as DRS, mongod_helper as mh
import DataStructsHelperAPI as DS
import importlib
import pandas as pd
import warnings
import sys, math
importlib.reload(mh)
def PRINT(jsonLike):
print(json.dumps(jsonLike, indent=4))
def genNidMarkRecapDict(mong... | smenon8/AnimalWildlifeEstimator | script/MarkRecapHelper.py | Python | bsd-3-clause | 4,133 |
# coding=utf-8
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
from blueman.Constants import *
from blueman.Functions import dprint
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
class Mana... | yars068/blueman | blueman/gui/manager/ManagerToolbar.py | Python | gpl-3.0 | 4,778 |
import uuid
import requests
import json
import os
import logging
def get_conf_file():
f = open("conf/net/int_service/giles_conf.json", "r")
conf = json.loads(f.read())
f.close()
return conf
def get_giles_base_url():
conf = get_conf_file()
base = conf['giles_base_url']
return base
def get_... | yw374cornell/e-mission-server | emission/net/int_service/giles/archiver.py | Python | bsd-3-clause | 4,541 |
"""Module defining how to handle component settings"""
import asyncio
import json
import locale
import logging
import os
import time
class SettingsHandler(object):
"""Settings handler class"""
def __init__(self, component):
self.component = component
self.key = os.path.join("/config", self.co... | TuxEatPi/common | tuxeatpi_common/settings.py | Python | apache-2.0 | 5,416 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.