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 |
|---|---|---|---|---|---|
class LOCK_KINDS(object):
""" The different kinds of lock which you can use.
WEAK is not guaranteed to be robust, but can be used for situations where avoiding
simultaneous code execution is preferable but not critical.
STRONG is for where preventing simultaneous code execution is *require... | Ali-aqrabawi/ezclinic | lib/djangae/contrib/locking/kinds.py | Python | mit | 373 |
from mock import Mock
from jobrunner.cli.post import post
from tests.testcase import TestCase
class TestPost(TestCase):
def setUp(self):
self.fixture_job = Mock()
self.JOBS = self.set_up_patch(
'jobrunner.cli.post.JOBS', {
'fixture_job': self.fixture_job
}
... | vdloo/jobrunner | tests/unit/jobrunner/cli/post/test_post.py | Python | apache-2.0 | 2,912 |
#
# Copyright 2013 OpenStack Foundation
# 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 re... | ge0rgi/cinder | cinder/tests/unit/api/contrib/test_quotas.py | Python | apache-2.0 | 48,171 |
import os
import re
import discord
import asyncio
import traceback
import random
from discord.ext import commands
from BB.permissions import *
from BB.misc import EmbedFooter
class Uno:
def __init__(self, bot, config, loop, mainbot):
self.bot = bot #commands related
self.config = config
sel... | poco0317/BarinadeBot-Rewrite | BB/unogame.py | Python | mit | 54,181 |
# -*- coding: utf-8 -*-
from ghost import Ghost
from PyQt4 import QtCore
from bs4 import BeautifulSoup
import urllib
import urllib2
import json
class TaipeiBus:
def __init__(self):
self.index_url = "http://pda.5284.com.tw/MQS/businfo1.jsp"
self.bus_url = "http://pda.5284.com.tw/MQS/businfo2.jsp?routename="
de... | st900278/Magic-Bus-API | Taipei_Bus/Taipei_Bus.py | Python | mit | 1,638 |
# Copyright 2015 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/LICENSE-2... | dims/neutron | neutron/tests/api/test_subnetpools.py | Python | apache-2.0 | 14,988 |
import datetime
today = datetime.datetime.now()
print(str(today))
print(repr(today)) | xbash/LabUNAB | 06_funciones/11_MostarLineas.py | Python | gpl-3.0 | 84 |
import json
import os
from django.conf import settings
from django.contrib.gis.geos import Point
def get(api_client, url, data=None):
response = api_client.get(url, data=data, format="json")
assert response.status_code == 200, str(response.content)
return response
def get_test_resource(resource_name):
... | City-of-Helsinki/smbackend | services/tests/utils.py | Python | agpl-3.0 | 840 |
from setuptools import setup, find_packages
import os
setup(
name="geneseekr",
version="0.4.1",
packages=find_packages(),
scripts=[
os.path.join('geneseekr', 'GeneSeekr')
],
author="Adam Koziol",
author_email="adam.koziol@canada.ca",
url="https://github.com/OLC-Bioinformatics/Ge... | OLC-Bioinformatics/GeneSeekr | setup.py | Python | mit | 332 |
import requests
import xml.etree.ElementTree as ET
from utils import *
class Product():
def __init__(self, reference, name, quantity):
"""
Constructor from Product object
:param reference: Article number
:param name: Name of the Shop
:param quantity: Availab... | Gurkengewuerz/prestashop-bot | bot/prestaobjects.py | Python | unlicense | 6,899 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/compute/v2017_03_30/models/usage.py | Python | mit | 1,737 |
from flask import Flask
from flask import request
from flask import render_template
from psutil import disk_partitions
import logging
from src.disks.utils import get_disk_uuid
app = Flask(__name__)
@app.route("/")
def hello():
disk_partitions_ret = disk_partitions(all=True)
all_disk_partitions = []
for di... | sqbing/rasphelper | main.py | Python | lgpl-3.0 | 824 |
import sys
from setuptools import setup, find_packages
setup(
name="tinystats",
version="0.0.0",
description="Command-line tool for fetching message, URL, and subscriber data for the TinyLetter newsletters you own.",
long_description="",
classifiers=[
"Development Status :: 3 - Alpha",
... | jsvine/tinystats | setup.py | Python | mit | 865 |
import unittest
import datetime
from wextractor.extractors import CsvExtractor
from nose.tools import raises
from mock import patch
class TestCsvExtractor(unittest.TestCase):
def setUp(self):
'''
file.csv is a csv file set up as follows:
foo | bar | baz
------|-----|-----
... | codeforamerica/w-drive-extractor | test/unit/extractors/test_csv_extractor.py | Python | mit | 3,363 |
"""
Tests for auto generated schemas and conversion to and from JSON.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import string
import random
import unittest
import avro.schema
import ga4gh.protocol as protocol
import ga4gh.avrotools as avrotools
... | pansapiens/server | tests/unit/test_schemas.py | Python | apache-2.0 | 14,558 |
import numpy as np
from ..base import BaseLibSVM, BaseLibLinear, _get_class_weight
from . import libsvm
from .. import liblinear
class SparseBaseLibSVM(BaseLibSVM):
_kernel_types = ['linear', 'poly', 'rbf', 'sigmoid', 'precomputed']
_svm_types = ['c_svc', 'nu_svc', 'one_class', 'epsilon_svr', 'nu_svr']
... | joshbohde/scikit-learn | sklearn/svm/sparse/base.py | Python | bsd-3-clause | 11,891 |
import json
from combaine.common import ParsingTask, AggregationTask
FIXTURE_PATH = "tests/fixtures/"
def test_parsing_interface():
with open(FIXTURE_PATH + 'fixture_msgpack_parsing_task') as f:
pt = ParsingTask(f.read())
with open(FIXTURE_PATH + '/fixture_json_parsing_task') as f:
etalon... | OmAsana/Combaine | tests/test_parsing_task.py | Python | lgpl-3.0 | 936 |
#!/opt/anaconda2/bin/python
# -*- coding: utf-8 -*-
"""
################################################################################
#
# Copyright (c) 2015 Wojciech Migda
# All rights reserved
# Distributed under the terms of the MIT license
#
####################################################################... | WojciechMigda/TCO-PCFStupskiPrize1 | src/clf_ert.py | Python | mit | 6,083 |
__author__ = 'joh12041'
"""
Gender code largely taken from https://github.com/tapilab/twcounty/blob/master/twcounty/Demographics.ipynb.
A major thanks to Aron Culotta for posting his code and doing a fine job with it in the first place!
"""
# Classify users as male or female based on first names based on Census name ... | ConnorMcMahon/geoinference | python/src/geolocate/utils/generate_user_gender_urban_mappings.py | Python | bsd-3-clause | 7,165 |
# Copyright 2015-2016 David Hadka
#
# This file is part of Platypus, a Python module for designing and using
# evolutionary algorithms (EAs) and multiobjective evolutionary algorithms
# (MOEAs).
#
# Platypus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | joerodd/Platypus | platypus/__init__.py | Python | gpl-3.0 | 1,123 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import textwrap
from PyQt5.Qt import (QWidget, pyqtSignal, QCheckBox, QAbstractSpinBox,
QLineEdit, QComboBox, Qt, QIco... | sharad/calibre | src/calibre/gui2/preferences/__init__.py | Python | gpl-3.0 | 13,946 |
import os
import unittest
from conans.model.ref import ConanFileReference
from conans.paths import EXPORT_SOURCES_DIR_OLD
from conans.test.utils.test_files import temp_folder
from conans.test.utils.tools import TestClient, TestServer
from conans.util.files import tar_extract
class DoNotKeepOldExportSourcesLayoutTest... | memsharded/conan | conans/test/functional/old/remove_old_export_sources_layout_test.py | Python | mit | 2,058 |
#!/usr/bin/python
# -*- coding: utf-8 -*- -
"""dhmanager.py
Library for managing DreamHost DNS Records. See README.md for more details.
Created by: risto.haukioja@gmail.com
"""
import uuid
import requests
import argparse
import urllib
import urlparse
import os
from os.path import expanduser
def get_key():
try:
... | ristoh/dhmanager | dhmanager.py | Python | bsd-3-clause | 4,357 |
#!/usr/bin/env python
import pyttsx
import rospy
import time
import threading
from std_msgs.msg import String
class wm_tts():
def __init__(self,node_name):
# get parameters
rospy.init_node(node_name)
self.engine = pyttsx.init()
self.engine_thread = threading.Thread(target=self.loo... | WalkingMachine/sara_commun | wm_tts/src/wm_tts2_node.py | Python | apache-2.0 | 1,080 |
"""Output formatters using shell syntax.
"""
from .base import SingleFormatter
import six
class ShellFormatter(SingleFormatter):
def add_argument_group(self, parser):
group = parser.add_argument_group(
title='shell formatter',
description='a format a UNIX shell can parse (variab... | ralphwort/chef-repo | build/cliff/cliff/formatters/shell.py | Python | apache-2.0 | 1,357 |
# coding: utf-8
"""
Gmail
Access Gmail mailboxes including sending user email.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import gmail_client
from gmail_client.rest ... | CanopyIQ/gmail_client | test/test_history_message_deleted.py | Python | mit | 829 |
# Copyright 2013 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 logging
import os
from document_parser import ParseDocument
from third_party.json_schema_compiler.model import UnixName
class DocumentRenderer(objec... | ChromiumWebApps/chromium | chrome/common/extensions/docs/server2/document_renderer.py | Python | bsd-3-clause | 3,794 |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... | brianrodri/oppia | scripts/linters/css_linter_test.py | Python | apache-2.0 | 4,271 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-error-reporting | google/cloud/errorreporting_v1beta1/services/error_group_service/client.py | Python | apache-2.0 | 25,457 |
import optical_isomer
def resonance_eff (atoms, bonds, c_atoms, na, rad_atom):
res_eff = 0
atom_str = optical_isomer.string_atoms(bonds,atoms,na)
str_class_arr = optical_isomer.create_string_class(bonds,atoms,atom_str,na)
root1 = rad_atom
for i in range(na):
if (bonds[rad_atom-1][i] == 1):
if (atoms[i+1] == ... | mcsanjay/Program-input-to-THERM | resonance.py | Python | gpl-3.0 | 1,233 |
import pandas as pd
import numpy as np
import re
import bokeh.plotting as bk
from bokeh.palettes import Spectral6
from bokeh.plotting import ColumnDataSource
from bokeh.models import (HoverTool,
BoxZoomTool,
ResetTool,
Slider,
... | louridas/gdp_life_expectancy_gapminder | gdp_life_expectancy_gapminder.py | Python | bsd-2-clause | 4,501 |
"""
This module creates a sysadmin dashboard for managing and viewing
courses.
"""
import csv
import json
import logging
import os
import subprocess
import time
import StringIO
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.decorators import login_required
from d... | pelikanchik/edx-platform | lms/djangoapps/dashboard/sysadmin.py | Python | agpl-3.0 | 26,544 |
from touchandgo.helpers import set_config_dir
def with_config_dir(func):
def _inner(*args, **kwargs):
set_config_dir()
return func(*args, **kwargs)
return _inner
| touchandgo-devs/touchandgo | touchandgo/decorators.py | Python | gpl-3.0 | 189 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Youtubedlg module responsible for handling the log stuff. """
from __future__ import unicode_literals
import os.path
from time import strftime
from .utils import (
get_encoding,
check_path
)
class LogManager(object):
"""Simple log manager for youtube-... | ukazap/youtube-dl-gui | youtube_dl_gui/logmanager.py | Python | unlicense | 2,580 |
"""
Starts a service to scan in intervals for new devices.
Will emit EVENT_PLATFORM_DISCOVERED whenever a new service has been discovered.
Knows which components handle certain types, will make sure they are
loaded before the EVENT_PLATFORM_DISCOVERED is fired.
"""
import asyncio
import json
from datetime import time... | morphis/home-assistant | homeassistant/components/discovery.py | Python | apache-2.0 | 4,127 |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
)
| CMU-Robotics-Club/roboticsclub.org | stock_items/urls.py | Python | mit | 134 |
#!/usr/bin/env python
import argparse
import ConfigParser
import MySQLdb
from novanet2neutron import common
CONF = ConfigParser.ConfigParser()
CREATE_TABLE_SQL = """
CREATE TABLE `network_migration_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uuid` varchar(36) DEFAULT NULL,
`network_name` varchar(255) DEFA... | NeCTAR-RC/novanet2neutron | generate-network-data.py | Python | apache-2.0 | 3,201 |
#!/usr/bin/python
# Copyright (c) 2006 XenSource Inc.
# Author: Ewan Mellor <ewan@xensource.com>
import time
from XmTestLib import *
from acm import *
import xen.util.blkif
__all__ = [ "block_attach", "block_detach" ]
def get_state(domain, devname):
(path, number) = xen.util.blkif.blkdev_name_to_number(devn... | jamesbulpin/xcp-xen-4.1 | tools/xm-test/lib/XmTestLib/block_utils.py | Python | gpl-2.0 | 1,454 |
import math
# determines if prime using trial division
def is_prime(n):
d = {}
u = math.floor(math.sqrt(n))
i = 2
# trial division: works pretty well for determining 600 billion
while (i <= u):
if (n % i == 0):
return False
i += 1
return True
print "Problem 7"
i = 0
j = 2
wh... | juoni/project-euler | 7.py | Python | gpl-3.0 | 395 |
{
'name' : 'Debt notebook for POS',
'version' : '1.0.0',
'author' : 'Ivan Yelizariev',
'category' : 'Point Of Sale',
'website' : 'https://yelizariev.github.io',
'depends' : ['pos_debt_notebook', 'point_of_sale'],
'images': ['images/screenshot-2.png', 'images/screenshot-3.png', 'images/screen... | akretion/pos-addons | tg_pos_debt_notebook/__openerp__.py | Python | lgpl-3.0 | 491 |
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""This script is meant to update your home folder with the latest MDT models."""
import argparse
import textwrap
import mdt
from mdt.lib.shell_utils import BasicShellApplication
__author__ = 'Robbert Harms'
__date__ = "2015-08-18"
__maintainer__ = "Robbert Harms"
__email_... | cbclab/MDT | mdt/cli_scripts/mdt_init_user_settings.py | Python | lgpl-3.0 | 1,410 |
import datetime
from django.test import TestCase
from django.utils import timezone
from schedule.models import Event, Rule, Calendar
from schedule.utils import EventListManager
class TestEventListManager(TestCase):
def setUp(self):
weekly = Rule.objects.create(frequency="WEEKLY")
daily = Rule.ob... | GrahamDigital/django-scheduler | tests/test_utils.py | Python | bsd-3-clause | 2,204 |
#!/usr/bin/python
# Common python helper functions used for OpenStack charms.
from collections import OrderedDict
import apt_pkg as apt
import subprocess
import os
import socket
import sys
from charmhelpers.core.hookenv import (
config,
log as juju_log,
charm_dir,
)
from charmhelpers.core.host import (
... | CiscoSystems/jujucharm-n1k | charms/precise/vem/hooks/charmhelpers/contrib/openstack/utils.py | Python | apache-2.0 | 10,802 |
"""party_affiliation table
Revision ID: 443b3b630b0f
Revises: df3415c2347
Create Date: 2014-05-31 02:22:34.753596
"""
# revision identifiers, used by Alembic.
revision = '443b3b630b0f'
down_revision = 'df3415c2347'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('party_affiliatio... | teampopong/pokr.kr | alembic/versions/443b3b630b0f_party_affiliation_table.py | Python | apache-2.0 | 1,341 |
from functools import partial
import torch
from torch import Tensor
import math
import torch.nn.functional as F
from . import register_monotonic_attention
from .monotonic_multihead_attention import (
MonotonicAttention,
MonotonicInfiniteLookbackAttention,
WaitKAttention
)
from typing import Dict, Optional... | pytorch/fairseq | examples/simultaneous_translation/modules/fixed_pre_decision.py | Python | mit | 7,370 |
from .vector3 import Vector3
from .matrix4 import Matrix4
import numpy
def normalize_v3(arr):
''' Normalize a numpy array of 3 component vectors shape=(n,3) '''
lens = numpy.sqrt( arr[:,0]**2 + arr[:,1]**2 + arr[:,2]**2 )
arr[:,0] /= lens
arr[:,1] /= lens
arr[:,2] /= lens
retur... | cinepost/Copperfield_FX | copper/core/vmath/__init__.py | Python | unlicense | 325 |
#!/usr/bin/env python
import sys, rospy, math
from pimouse_ros.msg import MotorFreqs
from geometry_msgs.msg import Twist
from std_srvs.srv import Trigger, TriggerResponse
class Motor():
def __init__(self):
if not self.set_power(False): sys.exit(1)
rospy.on_shutdown(self.set_power)
self.sub_raw = rospy.Subsc... | Sourpomelo-Y6/pimouse_ros | scripts/motors2.py | Python | gpl-3.0 | 2,168 |
class Type(object):
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
def __eq__(self, other):
return self.name == other.name
def __ne__(self, other):
return not (self == other)
def change(self, new_name):
if new_name !... | helgefmi/Easy | src/easy/type.py | Python | mit | 669 |
import pytest
from eruditarticle.utils import normalize_whitespace
@pytest.mark.parametrize(
"s1, s2",
[
("foo bar", "foo bar"),
(" foo bar ", "foo bar"),
("foo\nbar", "foo bar"),
("foo\n\t bar", "foo bar"),
# Line breaks and following spaces between tags shoud be re... | erudit/liberuditarticle | eruditarticle/tests/test_utils.py | Python | gpl-3.0 | 688 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Testing for basic usage.
"""
import unittest
import macaron
DB_FILE = ":memory:"
SQL_TEAM = """CREATE TABLE IF NOT EXISTS team (
id INTEGER PRIMARY KEY,
name TEXT
)"""
SQL_MEMBER = """CREATE TABLE IF NOT EXISTS member (
id INTEGER ... | nobrin/macaron | test/before_0.4.0-pre/test_basic.py | Python | mit | 5,559 |
# Copyright (c) 2017 Microsoft Corporation.
#
# 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, modify, merge, publis... | village-people/flying-pig | malmopy/model/model.py | Python | mit | 2,230 |
import pydpx_meta
# High level class DpxHeaderEx sample
#dpx = pydpx_meta.DpxHeaderEx("/root/V14_37_26_01_v001.0186.dpx")
dpx = pydpx_meta.DpxHeaderEx()
print(dpx.describe())
| plinecom/pydpx_meta | sample2_ex.py | Python | mit | 176 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
try:
from django.db.models import UUIDField
except ImportError:
from uuidfield import UUIDField
class Migration(migrations.Migration):
dependencies = [
('fir_... | gcrahay/fir_irma_plugin | fir_irma/migrations/0004_auto_20150524_0842.py | Python | apache-2.0 | 1,881 |
#!/usr/bin/env python
"""
Copyright 2010-2019 University Of Southern California
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 appli... | SCECcode/BBP | bbp/comps/run_bbp.py | Python | apache-2.0 | 10,810 |
'''Test warnings replacement in PyShell.py and run.py.
This file could be expanded to include traceback overrides
(in same two modules). If so, change name.
Revise if output destination changes (http://bugs.python.org/issue18318).
Make sure warnings module is left unaltered (http://bugs.python.org/issue18081).
'... | nmercier/linux-cross-gcc | win32/bin/Lib/idlelib/idle_test/test_warning.py | Python | bsd-3-clause | 3,217 |
# Copyright (c) 2018 PaddlePaddle 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 app... | putcn/Paddle | python/paddle/fluid/layers/metric.py | Python | apache-2.0 | 2,939 |
#!/usr/bin/env python3
# encoding: utf-8
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
#
# Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... | maui-packages/calamares | src/modules/mount/main.py | Python | gpl-3.0 | 2,037 |
from distutils.core import setup
from glob import glob
import py2exe
setup(
windows = [
{
'script': 'autoprint.py',
'icon_resources': [(1, 'printer.ico')]
}
],
options = {
"py2exe" : {
"includes" : ['sys', 'PySide', 'PySide.QtNetwork']
}
... | charlieman/autoprint | setup.py | Python | mit | 327 |
'''
General Contract:
contract for pdb files io tests:
1. 1ATM.pdb: a pdb with one atom only
2. 1ATM-1to2.pdb: a pdb of two frames based on the above 1ATM.pdb
3. 2AAD.pdb: a pdb with 2 amino acids
4. 2AAD-1to3.pdb: a pdb of three frames based on the above 2AAD.pdb
5. rna.pdb: a pdb of rna molecule
6. rna-1to10.pdb: ... | madscatt/sasmol | src/python/test_sasmol/test_sasio/__init__.py | Python | gpl-3.0 | 1,186 |
from subprocess import call
from os import path
import hitchpostgres
import hitchselenium
import hitchpython
import hitchserve
import hitchredis
import hitchtest
import hitchsmtp
# Get directory above this file
PROJECT_DIRECTORY = path.abspath(path.join(path.dirname(__file__), '..'))
class ExecutionEngine(hitchtest... | lightning18/rcj-leaderboards | tests/engine.py | Python | mit | 5,761 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Uninstall a module"""
import xmlrpclib
import argparse
import getpass
parser = argparse.ArgumentParser()
# Connection args
parser.add_argument('-d', '--database', help="Use DB as the database name",
action='store', metavar='DB', default=getpass.ge... | e-COSI/odoo-tools | module_uninstall/odoo_module_uninstall.py | Python | agpl-3.0 | 1,809 |
{
'name': "Fix gaps in Repair order numbering",
'version': '1.0.0',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'category': 'Custom',
'website': 'https://yelizariev.github.io',
'depends': ['mrp_repair'],
'data': [
'views.xml',
],
'installable': True
}
| raycarnes/addons-yelizariev | mrp_repair_default_name/__openerp__.py | Python | lgpl-3.0 | 302 |
from datetime import timedelta
from rest_framework import status as http_status
from django.utils import timezone
from nose.tools import * # noqa (PEP8 asserts)
from framework.auth import campaigns, views as auth_views, cas
from website.util import web_url_for
from website.util.metrics import provider_source_tag
fro... | Johnetordoff/osf.io | tests/test_campaigns.py | Python | apache-2.0 | 10,309 |
# -*- coding: utf-8 -*-
"""
Forms of programmeletter are ..
"""
from ajax_select import make_ajax_field
from django import forms
from librehatti.programmeletter.models import StaffInTeam
class StaffInTeamForm(forms.ModelForm):
"""
Form for selecting staff for team.
"""
# staff = forms.ModelChoiceFiel... | GreatDevelopers/LibreHatti | src/librehatti/programmeletter/forms.py | Python | gpl-2.0 | 893 |
#! /usr/bin/python
# perform analysis on problem instances and store results in a database
# avoiding multiple invocations of the same instance
import sys
import string
import shelve
import os
import time
datadir = '../data/'
if len(sys.argv)>=2:
datafilesname = sys.argv[1]
else:
datafilesname = datadir + 'da... | examachine/bitdrill | perf/serial-time.py | Python | agpl-3.0 | 2,187 |
# encoding: utf-8
# -*- test-case-name: IPython.kernel.tests.test_task -*-
"""Task farming representation of the ControllerService."""
__docformat__ = "restructuredtext en"
#-----------------------------------------------------------------------------
# Copyright (C) 2008 The IPython Development Team
#
# Distribu... | toomoresuch/pysonengine | eggs/ipython-0.10.1-py2.6.egg/IPython/kernel/task.py | Python | mit | 40,436 |
from typing import Any
from django.conf.urls import include
from django.urls import path
from django.views.generic import TemplateView
from corporate.views import (
billing_home,
initial_upgrade,
replace_payment_source,
sponsorship,
update_plan,
upgrade,
)
from zerver.lib.rest import rest_path... | punchagan/zulip | corporate/urls.py | Python | apache-2.0 | 1,241 |
"""Container for filesystem resource informations.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import typing
from typing import cast
from copy import deepcopy
import six
from .path import join
from .enums import ResourceType
from .errors i... | PyFilesystem/pyfilesystem2 | fs/info.py | Python | mit | 13,500 |
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009-2010, James Vega
# 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 c... | prashantpawar/supybot-rothbot | plugins/ChannelLogger/plugin.py | Python | bsd-3-clause | 10,218 |
# Copyright (C) 2013-2014 The Debsources developers <info@sources.debian.net>.
# See the AUTHORS file at the top-level directory of this distribution and at
# https://anonscm.debian.org/gitweb/?p=qa/debsources.git;a=blob;f=AUTHORS;hb=HEAD
#
# This file is part of Debsources. Debsources is free software: you can
# redi... | zacchiro/debsources | debsources/consts.py | Python | agpl-3.0 | 5,503 |
# -*- coding: utf-8 -*-
# Copyright 2008 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''Test cases for the zim.templates module.'''
import tests
import os
import zim
from zim.errors import Error
from zim.templates import *
from zim.templates import GenericTemplate, \
TemplateParam, TemplateDict, TemplateFunctio... | gdw2/zim | tests/templates.py | Python | gpl-2.0 | 8,515 |
from .viewbase import *
from models.clipboardmodel import ClipBoardModel
__author__ = "C. Wilhelm"
___license___ = "GPL v3"
class ComboBoxDelegate(QStyledItemDelegate):
def __init__(self, clipboard_view, clipboard_model):
QStyledItemDelegate.__init__(self, clipboard_view)
self._model = clipboard_model
def cre... | valmynd/MediaFetcher | src/views/clipboardview.py | Python | gpl-3.0 | 4,552 |
# ***************************************************************************
# * Copyright (c) 2013 Yorik van Havre <yorik@uncreated.net> *
# * Copyright (c) 2019 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * *
# * Th... | sanguinariojoe/FreeCAD | src/Mod/Draft/drafttests/test_dwg.py | Python | lgpl-2.1 | 4,171 |
from PyQt4.QtGui import QApplication, QGraphicsView, QGraphicsScene, QColor, QPainter
from robot import Robot
import sys
app = QApplication(sys.argv)
scene = QGraphicsScene(-200, -200, 400, 400)
robot = Robot()
robot.scale(1.2, 1.2)
robot.setPos(0, -20)
scene.addItem(robot)
view = QGraphicsView(scene)
view.setRender... | mike-perdide/gitbuster | graphics_sandbox/main.py | Python | gpl-3.0 | 533 |
__author__ = 'jmoran'
import pygame
import sys
from pygame.locals import *
from Asteroids import *
pygame.init()
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption("Asteroids(ish)")
pygame.key.set_repeat(30, 30)
clock = pygame.time.Clock()
ship = Ship(screen, pygame)
bullet = None
level = ... | waddedMeat/asteroids-ish | main.py | Python | mit | 1,405 |
import sys
from typing import Callable, Optional, TypeVar
import reactivex
from reactivex import Observable
from reactivex.internal.utils import infinite
_T = TypeVar("_T")
def repeat_(
repeat_count: Optional[int] = None,
) -> Callable[[Observable[_T]], Observable[_T]]:
if repeat_count is None:
repe... | ReactiveX/RxPY | reactivex/operators/_repeat.py | Python | mit | 1,145 |
"""
A latent build slave that runs on Rackspace Cloud.
"""
import sys
import time
import cloudservers
from buildbot.buildslave import AbstractLatentBuildSlave
from buildbot.interfaces import LatentBuildSlaveFailedToSubstantiate
from twisted.internet import defer, threads
from twisted.python import log
class Cloudserv... | hochanh/django-buildmaster | djangobotcfg/rsc_slave.py | Python | bsd-3-clause | 7,405 |
# -*- coding: utf-8 -*-
#
# djstripe_dev documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values h... | avimeir/djstripe_dev | docs/conf.py | Python | bsd-3-clause | 7,799 |
"""superlists URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | walkerSong/superlists | superlists/urls.py | Python | gpl-2.0 | 859 |
# -*- coding: Latin-1 -*-
"""Little Interactive Cryptogram Solving tool
Ange Albertini, 2010, public domain"""
import sys
from operator import itemgetter
def getCryptogram():
"""return the text content of the file in the 1st argument"""
f = open(sys.argv[1], "rt")
s = f.read()
f.clo... | angea/corkami | misc/challenges/lics.py | Python | bsd-2-clause | 3,264 |
#!/usr/bin/env python3
"""BattMan Pi test configuration GUI"""
#
# Copyright 2007 Capable Computing, Inc. (CCI)
# Copyright 2017 Andrew Errington
#
# This file is part of BattMan Pi.
#
# BattMan Pi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... | andrewerrington/battmanpi | battmanpi/start.py | Python | gpl-3.0 | 9,010 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from terrible.version import __version__ # NOQA | RobotsAndPencils/terrible | terrible/__init__.py | Python | bsd-3-clause | 95 |
"""
:codeauthor: Nicole Thomas <nicole@saltstack.com>
"""
import logging
import pytest # pylint: disable=unused-import
import salt.state
log = logging.getLogger(__name__)
@pytest.fixture
def root_dir(tmp_path):
return tmp_path / "root_dir"
@pytest.fixture
def state_tree_dir(root_dir):
return root_di... | saltstack/salt | tests/pytests/unit/state/test_state_highstate.py | Python | apache-2.0 | 5,975 |
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2015-2019 by Inteos Sp. z o.o.
# All rights reserved. See LICENSE file for details.
#
from __future__ import unicode_literals
import copy
from django import forms
from django.forms import fields
INTERVALS = (
('seconds', 'Seconds'),
('minutes', 'Minutes'),
('ho... | inteos/IBAdmin | libs/forms.py | Python | agpl-3.0 | 5,342 |
from django.db.models import CharField, ForeignKey, IntegerField, PositiveSmallIntegerField, DateTimeField, URLField, Model, UUIDField
from django.contrib.auth.models import User
from cas.models import cas,ImmutableFile
from util import make_thumbnail_ref, deterministic_colour, MP3
import unicodedata
import re
# TODO... | naggie/crates | index/models.py | Python | mit | 9,891 |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import graphviz
import graphviz.backend
from numpy.distutils.system_info import f2py_info
from sklearn import tree
from sklearn.datasets import load_boston, load_iris, load_wine, load_digits, \
load_breast_cancer, load_diabetes, fetch_mldata
from matplo... | parrt/dtreeviz | testing/cancer.py | Python | mit | 1,754 |
import logging
from time import strftime
def closed():
logging.info('Headlights process stopped')
def criterr(errortext):
logging.critical('A fatal error occured :: ' + errortext)
exit()
def err(errortext):
logging.error('An error occured :: ' + errortext)
def warn(errortext):
logging.warning(er... | mashedkeyboard/Headlights | handlers.py | Python | gpl-3.0 | 429 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 by Pablo Martín <goinnn@gmail.com>
#
# This program 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 3 of the License, or
# (at your option) an... | gtrdotmcs/django-multiselectfield | multiselectfield/utils.py | Python | lgpl-3.0 | 1,125 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
import os
from pip._internal.cache import WheelCache
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import RequirementCommand
from pip._internal.exceptions import CommandError, PreviousBuildDirError
from pip._i... | HiSPARC/station-software | user/python/Lib/site-packages/pip/_internal/commands/wheel.py | Python | gpl-3.0 | 7,020 |
import discord
from utils import config
from utils import reboot
async def run(client, message, object_list=None):
if not str(message.author) == 'SynLogic#5410':
return
await client.send_message(message.channel, 'Rebooting client! Please be patient.')
voice = client.voice_client_in(message.... | synlogic/kohaibot-for-discord | internal_commands/reboot.py | Python | gpl-3.0 | 617 |
"""
The entry point of the application
"""
| Dannnno/Quasar | main.py | Python | mit | 43 |
import networkx as nx
from datetime import datetime
from nose.tools import assert_true, assert_equal
from .event_context import extract_event_context
from .test_util import load_meta_graph_necessities
from .interactions import InteractionsUtil as IU
def load_example():
_, _, interactions = load_meta_graph_necess... | xiaohan2012/lst | test_event_context.py | Python | mit | 1,488 |
# -*- coding: utf-8 -*-
{
"name" : "Automatical email to customer",
"version" : "1.0",
"author" : "DTBS",
"description": """
Sends automatic when customer created
""",
"website" : "http://dtbsindo.web.id",
"category" : "",
# 'depends': ['base','csmart_base','sale_stock'],
'de... | charismab45515t/dtbs-carrent | customer_auto_email/__openerp__.py | Python | gpl-2.0 | 624 |
from fabric.api import run
def uname():
run('uname -a')
def install(build, comment):
uname()
print("We should install the build %s!" % build)
| tildedave/deploybot | example_fabfile.py | Python | mit | 156 |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
from chainer.utils import type_check
@testing.parameterize(
{'dtype': ... | rezoo/chainer | tests/chainer_tests/functions_tests/loss_tests/test_mean_squared_error.py | Python | mit | 3,876 |
from contextlib import contextmanager
from datetime import datetime, timedelta
from queue import Queue
from typing import IO, TYPE_CHECKING, Dict, Generator, List, Optional, Set, Tuple, Union
import sys
import timeit
import simpy
from desmod.config import ConfigDict
from desmod.timescale import TimeValue, parse_time,... | SanDisk-Open-Source/desmod | desmod/progress.py | Python | mit | 12,418 |
from __future__ import absolute_import
import logging
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from . import geocode
logger = logging.getLogger(__name__)
class Address(models.Model):
address = models.CharField(_('Address'), max_length... | Gonzasestopal/django-easy-maps | easy_maps/models.py | Python | mit | 1,693 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | neumerance/deploy | .venv/lib/python2.7/site-packages/ceilometerclient/common/http.py | Python | apache-2.0 | 9,901 |
"""elena URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | secretariats/elena | elenadev/mysite/urls.py | Python | apache-2.0 | 876 |
# encoding: UTF-8
from __future__ import division
from collections import OrderedDict
from vnpy.trader.vtConstant import (DIRECTION_LONG, DIRECTION_SHORT,
OFFSET_OPEN, OFFSET_CLOSE,
PRICETYPE_LIMITPRICE, PRICETYPE_MARKETPRICE,
... | rrrrrr8/vnpy | vnpy/trader/app/algoTrading/algo/dmaAlgo.py | Python | mit | 6,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.