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/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" List translatable projects """
from __future__ import absolute_import
from __future__ import unicode_literals
from __fu... | aldebaran/qibuild | python/qilinguist/actions/list.py | Python | bsd-3-clause | 1,170 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class UnitDialogue:
"""
Dialogue object for Units
"""
def __init__(self, **kwargs):
dialogue = kwargs["dialogue"]
self.id = dialogue["id"]
self.dialogue = dialogue["dialogue"]
self.context = dialogue["context"]
"... | butterscotchstallion/SpiffyRPG | SpiffyRPG/SpiffyWorld/unit_dialogue.py | Python | mit | 473 |
import chainer
import chainer.testing
import chainer.testing.attr
import chainermn
from chainermn.iterators.multi_node_iterator import _build_ctrl_msg
from chainermn.iterators.multi_node_iterator import _parse_ctrl_msg
import numpy as np
import platform
import pytest
from six.moves import range
import unittest
class ... | rezoo/chainer | tests/chainermn_tests/iterators_tests/test_multi_node_iterator.py | Python | mit | 7,672 |
import random
import sys
neighbourSynonyms = ('neighbours', 'neighbors', 'neighbour', 'neighbor')
class Cell:
def __getattr__(self, key):
if key in neighbourSynonyms:
pts = [self.world.getPointInDirection(
self.x, self.y, dir) for dir in range(self.world.directions)]... | vmayoral/basic_reinforcement_learning | extra/egoallocentric/cellular.py | Python | gpl-3.0 | 19,839 |
# pylint: disable=wrong-or-nonexistent-copyright-notice
from typing import Tuple, Any, List, Union, Dict
import pytest
import cirq
from pyquil import Program
import numpy as np
from cirq_rigetti import circuit_sweep_executors as executors, circuit_transformers
def test_with_quilc_compilation_and_cirq_parameter_resolu... | quantumlib/Cirq | cirq-rigetti/cirq_rigetti/circuit_sweep_executors_test.py | Python | apache-2.0 | 6,417 |
from django.db import models
class customer(models.Model):
username = models.CharField(primary_key=True, max_length=20)
password = models.CharField(max_length=20)
fname=models.CharField(max_length=100)
lname = models.CharField(max_length=100)
age = models.IntegerField()
email = models.EmailFiel... | mpiplani/Online-Pharmacy | online_pharmacy/online_pharmacy/customer/models.py | Python | apache-2.0 | 1,010 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Wed Mar 12 00:03:50 2014
# by: The Resource Compiler for PyQt (Qt v4.8.4)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x16\x49\
\x00\
\x00\x75\x41\x78\x9c\xb5\x5d\x5b\x93\xdc\xb6\x95\x... | raelgc/ubuntu_snakefire | snakefire-1.0.6/snakefire/resources.py | Python | mit | 219,455 |
#!/usr/bin/env python3
"""
>>> baralho = Baralho()
>>> len(baralho)
52
>>> baralho[0]
Carta(valor='2', naipe='paus')
>>> baralho[-1]
Carta(valor='A', naipe='espadas')
>>> from random import choice
>>> choice(baralho) #doctest:+SKIP
Carta(valor='4', naipe='paus')
... | pythonprobr/notmagic | pt-br/baralho.py | Python | mit | 4,006 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Selected(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatter"
_path_str = "scatter.selected"
_valid_props = {"marker", "textfont"}
# marke... | plotly/python-api | packages/python/plotly/plotly/graph_objs/scatter/_selected.py | Python | mit | 4,402 |
# -*- coding: utf-8 -*-
#
# freezer-api documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 5 14:50:55 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... | szaher/freezer-api | doc/source/conf.py | Python | apache-2.0 | 8,524 |
from south.db import db
from django.db import models
from cmsplugin_filer_file.models import *
class Migration:
depends_on = (
("filer", "0008_polymorphic__del_field_file__file_type_plugin_name"),
("cms", "0039_auto__del_field_page_moderator_state"),
)
def forwards(self, orm):
... | Venturi/oldcms | env/lib/python2.7/site-packages/cmsplugin_filer_file/migrations/0001_initial.py | Python | apache-2.0 | 12,020 |
import unittest
from dnfpy.model.fieldMap import FieldMap
class TestFieldMap(unittest.TestCase):
def setUp(self):
self.uut = FieldMap("uut",size=1,dt=0.1,lat=1,aff=1,tau=0.8,h=0,
th=0.64,model='cnft')
def test_update(self):
self.uut.... | bchappet/dnfpy | src/test_dnfpy/model/testFieldMap.py | Python | gpl-2.0 | 1,305 |
#!/usr/bin/env python
from keystoneauth1 import identity
from keystoneauth1 import session
from neutronclient.v2_0 import client
from subprocess import call
from os import environ
import sys
""" Remove all neutron network components """
class Networks():
def __init__(self, neutron):
self.neutron = neutro... | nuriel77/py-utils | clean-neutron-environment.py | Python | unlicense | 5,592 |
#!/usr/bin/python
"""Simple message bus implemented on top of a shared sqlite3 database.
We use a single, shared table for messages. Each message has a unique,
incrementing id. When a program connects to the message bus, it reads the
highest id that's in the table - after that it'll "receive" messages that's been
sen... | ActiveState/code | recipes/Python/577001_sqlite_message_bus/recipe-577001.py | Python | mit | 3,981 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import itertools
import os
import re
from importlib import import_module
from django.apps import apps
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.contrib.auth import REDIRECT_FIELD_NAME, S... | techdragon/django | tests/auth_tests/test_views.py | Python | bsd-3-clause | 46,400 |
#!/usr/bin/env python3
import os
import sys
import glob
import json
import argparse
import collections
import xwalk
def get_missing_cordova_tc(configuration,
xwalk_branch,
xwalk_version,
mode,
arch,
... | qiuzhong/xwalk-test-suite-build | scripts/complete_cordova_tc.py | Python | gpl-3.0 | 6,655 |
import requests
from selinon import StoragePool
from sqlalchemy.exc import SQLAlchemyError
import urllib.parse
from f8a_worker.base import BaseTask
class GitHubManifestMetadataResultCollector(BaseTask):
"""
Collect all results that were computed, upload them to S3 and store version
reference to results i... | fridex/fabric8-analytics-worker | f8a_worker/workers/gh_metadata_result_collector.py | Python | gpl-3.0 | 2,744 |
#!/usr/bin/env python2.7
# Copyright 2017 gRPC authors.
#
# 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 la... | firebase/grpc-SwiftPM | tools/interop_matrix/client_matrix.py | Python | apache-2.0 | 18,396 |
'''
Econometrics for a Datarich Environment
=======================================
Introduction
------------
In many cases we are performing statistical analysis when many observed variables are
available, when we are in a data rich environment. Machine learning has a wide variety
of tools for dimension reduction an... | bashtage/statsmodels | statsmodels/sandbox/datarich/__init__.py | Python | bsd-3-clause | 6,356 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, unittest, pdb
if '../lib' not in sys.path: sys.path.append ('../lib')
import jdb, jellex, ply, unittest_extensions
__unittest = 1
def main():
globalSetup()
unittest.main()
def setup (_):
global Lexer, Tokens
_.lexer, _.tokens... | tatsuhirosatou/JMdictDB | python/tests/test_jellex.py | Python | gpl-2.0 | 10,696 |
# 058. Length of Last Word
import unittest
class Solution(object):
def lengthOfLastWord(self, s):
"""
:type s: str
:rtype: int
"""
terminate = False
ret = 0
for c in s[::-1]:
if c == ' ':
if terminate:
break
... | hanlin-he/UTD | leetcode/py/058.py | Python | mit | 688 |
import os
import re
import subprocess
import sys
try:
from cStringIO import StringIO
except ImportError: # pragma: PY3
from io import StringIO
import pytest
import requests
import requests_cache
import ghcloneall
class MockResponse:
def __init__(self, status_code=200, json=None, links={}):
a... | mgedmin/cloneall | tests.py | Python | mit | 43,851 |
#!/usr/bin/env python
"""
fs.tests: testcases for the fs module
"""
from __future__ import with_statement
# Send any output from the logging module to stdout, so it will
# be captured by nose and reported appropriately
import sys
import logging
logging.basicConfig(level=logging.ERROR, stream=sys.stdout)
from ... | adamlwgriffiths/pyfilesystem | fs/tests/__init__.py | Python | bsd-3-clause | 46,401 |
""" A universal module with functions / classes without dependencies. """
import sys
import contextlib
import functools
import re
from ast import literal_eval
from jedi._compatibility import unicode, next, reraise
from jedi import settings
class UncaughtAttributeError(Exception):
"""
Important, because `__ge... | tianzhihen/SublimeJEDI | jedi/common.py | Python | mit | 4,941 |
import structlog
import lxml.etree as et
from .repository import api
from .objects import JournalDigitalObject
from eruditarticle.utils import remove_xml_namespaces
logger = structlog.getLogger(__name__)
def get_pids(query):
""" Returns the PIDS corresponding to a given Fedora query. """
ns_type = {"type":... | erudit/eruditorg | eruditorg/erudit/fedora/utils.py | Python | gpl-3.0 | 3,560 |
# XXX This is completely outdated file, kept here only for bootstrapping
# reasons. If you touch it, try removing it
import py
import os
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.tool.udir import udir
from rpython.rlib import rarithmetic
from rpython.rtyper.lltypesystem impor... | jptomo/rpython-lang-scheme | rpython/rtyper/tool/rfficache.py | Python | mit | 3,436 |
from bs4 import BeautifulSoup
import urllib2
import csv
import pandas as pd
import time
import lxml
import datetime
import pickle
import requests
import re
import sys
import os
import pymongo
from retry import retry as _retry
from endpoints import Search_Business, Search_Amish, Category_Amish, Best_Amish
from asins im... | gabelev/MISMI | debug/AMZ_tracker_mongo.py | Python | mit | 10,181 |
from datetime import datetime, timedelta
import uuid
import warnings
from geoalchemy2 import Geometry
from pyramid.exceptions import Forbidden
from pytz import utc
from sqlalchemy import (
Column,
Unicode,
Integer,
Float,
DateTime,
ForeignKey,
UniqueConstraint,
)
from sqlalchemy.ext.declarat... | NLeSC/eEcology-SMS-reciever | eecologysmsreciever/models.py | Python | apache-2.0 | 7,556 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2018 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed ... | mattdm/dnf | tests/cli/commands/test_group.py | Python | gpl-2.0 | 4,276 |
from scrapy import Spider
from scrapy.selector import Selector
from hackernews.items import HackerNewsItem
class HNSpider(Spider):
name = 'hnspider'
allowed_domains = ["https://news.ycombinator.com/"]
start_urls = ["https://news.ycombinator.com/"]
def parse(self, response):
posts = Selector... | noisebridge/PythonClass | instructors/lessons/web_scraping/examples/hackernews/hackernews/spiders/hn_spider.py | Python | mit | 551 |
# Copyright (C) 2008 Martin Dengler
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in... | gusDuarte/sugar | extensions/deviceicon/speaker.py | Python | gpl-2.0 | 7,385 |
import pytest
from io import BytesIO
from thefuck.types import Command
from thefuck.rules.docker_not_command import get_new_command, match
_DOCKER_SWARM_OUTPUT = '''
Usage: docker swarm COMMAND
Manage Swarm
Commands:
ca Display and rotate the root CA
init Initialize a swarm
join Join a ... | SimenB/thefuck | tests/rules/test_docker_not_command.py | Python | mit | 13,012 |
"""
Created on Jan 25, 2012
@author: Trung Dong Huynh
"""
import unittest
from prov.model import ProvBundle, ProvRecord, ProvExceptionCannotUnifyAttribute
import logging
import json
import examples
import os
logger = logging.getLogger(__name__)
class Test(unittest.TestCase):
def setUp(self):
pass
def... | pymonger/prov-0.5.4 | prov/model/test/testModel.py | Python | mit | 10,000 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bork_webui.settings")
sys.path.insert(1, os.path.abspath('./'))
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Fiware/ops.Validator | validator_webui/manage.py | Python | apache-2.0 | 298 |
import json
from datetime import datetime
from django.test import TestCase, Client
from authentication.models import Account
from recipies.models import Recipe, RecipeSteps
from recipies.serializers import RecipeSerializer, RecipeStepsSerializer
class Utility(TestCase):
"""Utility class para testing"""
@s... | moonboy13/brew-journal | brew_journal/recipies/tests.py | Python | apache-2.0 | 21,233 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
########################################################################
# ScreenLocker an simply screensaver displaying animations, #
# with password protection and music file playing possiblities. #
# Copyright (C) 2014 Bruggemann Eddie. ... | mrcyberfighter/ScreenLocker | ScreenLocker/Files/ScreenLocker_Balls_class.py | Python | gpl-3.0 | 13,578 |
#
# Copyright 2012 Sonya Huang
#
# 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... | sonya/eea | py/parsers/shp.py | Python | apache-2.0 | 8,098 |
"""Reproduce an Switch state."""
import asyncio
import logging
from typing import Iterable, Optional
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import Context, State
from homeassistant.helpers.typing import Hom... | leppa/home-assistant | homeassistant/components/switch/reproduce_state.py | Python | apache-2.0 | 1,612 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-25 03:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contacts', '0013_auto_20160722_1413'),
]
operations = [
migrations.AddField(... | phildini/logtacts | contacts/migrations/0014_auto_20160725_0354.py | Python | mit | 2,610 |
# -*- coding: utf-8 -*-
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# Copyright (C) 2018-2019 OzzieIsaacs, pwr
#
# 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 ... | Kyosfonica/calibre-web | cps/services/goodreads_support.py | Python | gpl-3.0 | 3,685 |
import sys
sys.path.insert(0, "../")
import unittest
from dip.typesystem import DNull, DBool, DInteger, DString, DList
from dip.compiler import BytecodeCompiler
from dip.interpreter import VirtualMachine
from dip.namespace import Namespace
class TestInterpreter(unittest.TestCase):
def _execute_simple(... | juddc/Dipper | dip/tests/test_interpreter.py | Python | mit | 5,801 |
conditions = [ "05", "15", "25", "35", "5" ]
num_stars = [ "25", "50", "100", "150" ]
for cond in conditions:
for num in num_stars:
#clusteringCondition + "-" + numStarCondition + "-hiScore.txt";
f = open("{0}-{1}-hiScore.txt".format(cond, num), 'w')
f.write("BEK 1\nBEK 1\nBEK 1\nBEK 1\nBEK 1\nBEK 1\nBEK 1\nBEK... | bkerster/turkForage | scoreFileMaker.py | Python | gpl-2.0 | 350 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models import ModelName".
# Use orm.... | okfn/spendingstories | webapp/core/migrations/0007_stories_type.py | Python | gpl-3.0 | 3,578 |
"""
General Object-oriented Abstraction of Rankine Cycle
cycle Package
"""
import sys
sys.path.append('../')
| PySEE/PyRankine | sim-oop/rankinecycle/__init__.py | Python | mit | 126 |
"""Execute shell commands via os.popen() and return status, output.
Interface summary:
import commands
outtext = commands.getoutput(cmd)
(exitstatus, outtext) = commands.getstatusoutput(cmd)
outtext = commands.getstatus(file) # returns output of "ls -ld file"
A trailing newlin... | nmercier/linux-cross-gcc | win32/bin/Lib/commands.py | Python | bsd-3-clause | 2,635 |
# Sebastian Raschka 2014
# Script that extracts atoms within a radius from a PDB file
def grab_radius(file, radius, coordinates, include='ATOM,HETATM'):
"""
Grabs those atoms that are within a specified
radius of a provided 3d-coordinate.
Keyword arguments:
file: path to a PDB file
ra... | rasbt/protein-science | scripts-and-tools/grab_atom_radius/grab_atom_radius.py | Python | gpl-3.0 | 2,978 |
'''
Copyright (C) 2015 Constantin Tschuertz
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
any later version.
This program is distributed in the hope that it wil... | ConstantinT/jAEk | crawler/models/urlstructure.py | Python | gpl-3.0 | 1,991 |
# -*- coding: utf-8 -*-
"""
Spanish-specific Form helpers
"""
from django.forms import ValidationError
from django.forms.fields import RegexField, Select, EMPTY_VALUES
from django.utils.translation import ugettext_lazy as _
import re
class ESPostalCodeField(RegexField):
"""
A form field that validates its inp... | CollabQ/CollabQ | vendor/django/contrib/localflavor/es/forms.py | Python | apache-2.0 | 7,503 |
# encoding: utf-8
from base import Base
class Organization(Base):
resource = "organizations"
__str__ = lambda x: "{} - {}".format(x.id, x.name)
def __init__(self, **kwargs):
super(Organization, self).__init__('organizations', **kwargs)
def create_ticket(self):
pass
def get_tick... | RafaelPortugal/ZendeskIntegration | zendesk/objects/organization.py | Python | mit | 539 |
# -*- coding: utf-8 -*-
###############################################################################
# python-xen-api - XenServer XMLRPC API Library
# Copyright (C) 2012 Stephan Adig <sh@sourcecode.de>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Gen... | sadig/xenserver-api | xen/api/properties.py | Python | lgpl-2.1 | 1,184 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the serializer object implementation using JSON."""
import collections
import json
import time
import unittest
import uuid
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.path import fake_path_spec
from dfvfs.path import factory as path_spec_fac... | dc3-plaso/plaso | tests/serializer/json_serializer.py | Python | apache-2.0 | 17,101 |
import math
import random
from unittest import TestCase
from hamcrest import *
from array_util import get_random_array
from chapter15.textbook15_5 import optimal_bst
from util import between
def get_probabilities_for_optimal_bst():
n = random.randint(1, 10)
p, _ = get_random_array(min_size=n, max_size=n)
... | wojtask/CormenPy | test/test_chapter15/test_textbook15_5.py | Python | gpl-3.0 | 2,098 |
#!/usr/bin/env python
# coding: utf-8
from pyscsi.pyscsi.scsi import SCSI
from mock_device import MockDevice
from pyscsi.utils.converter import scsi_int_to_ba
from pyscsi.pyscsi.scsi_enum_command import sbc
from pyscsi.pyscsi import scsi_enum_inquiry as INQUIRY
from pyscsi.pyscsi.scsi_cdb_inquiry import Inquiry
clas... | AHelper/python-scsi | tests/test_unmarshall_inquiry.py | Python | lgpl-2.1 | 9,119 |
"""Define tests for the PlayStation 4 config flow."""
from unittest.mock import patch
from homeassistant import data_entry_flow
from homeassistant.components import ps4
from homeassistant.components.ps4.const import (
DEFAULT_NAME, DEFAULT_REGION)
from homeassistant.const import (
CONF_CODE, CONF_HOST, CONF_IP... | jnewland/home-assistant | tests/components/ps4/test_config_flow.py | Python | apache-2.0 | 14,315 |
# coding: utf-8
import datetime
import json
import netCDF4
import pandas
import numpy as np
import dateutil.parser
def load_timeseries(filename='data/id1-DELFZL.nc'):
"""load a station series from netCDF"""
ds = netCDF4.Dataset(filename)
dates = netCDF4.num2date(
ds.variables['time'][:],
... | SiggyF/ts | server/tsindex.py | Python | gpl-3.0 | 2,680 |
#------------------------------------------------------------------------------
# Name: pychrono example
# Purpose:
#
# Author: Alessandro Tasora
#
# Created: 1/01/2019
# Copyright: (c) ProjectChrono 2019
#------------------------------------------------------------------------------
print ("Example:... | dariomangoni/chrono | src/demos/python/cascade/demo_CAS_cascade.py | Python | bsd-3-clause | 4,204 |
#!/usr/bin/env python
#signif reference to http://pastebin.com/k87sfiEf
import sys
import math
import signal
import time
import os
import math, random
import numpy as np
from numpy import linalg
from threading import Lock
#interface stuff
from PyQt4 import QtCore, QtGui, QtOpenGL
import pyqtgraph as pg
#comms st... | MITHyperloopTeam/software_core | software/UI/low_speed_driver.py | Python | lgpl-3.0 | 35,803 |
import _plotly_utils.basevalidators
class TemplateitemnameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="templateitemname",
parent_name="parcats.line.colorbar.tickformatstop",
**kwargs
):
super(TemplateitemnameValidator, self).... | plotly/python-api | packages/python/plotly/plotly/validators/parcats/line/colorbar/tickformatstop/_templateitemname.py | Python | mit | 540 |
from test_support import *
prove_all(opt=["--ide-progress-bar"])
| ptroja/spark2014 | testsuite/gnatprove/tests/N515-042__ipstack_aggregate/test.py | Python | gpl-3.0 | 66 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | rdo-management/heat | heat/openstack/common/loopingcall.py | Python | apache-2.0 | 4,759 |
import csv
import logging
import ntpath
import re
import sys
from uuid import UUID
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.core.exceptions import ValidationError
from django.core.management.base import CommandError
from django.utils import translation
from dja... | indirectlylit/kolibri | kolibri/core/auth/management/commands/bulkimportusers.py | Python | mit | 35,248 |
from math import hypot, sqrt, ceil, pi, sin, cos
from random import random, randint
import warnings
from operator import itemgetter
import time
from random import shuffle
from itertools import chain
from datetime import datetime
from collections import defaultdict
import logging
# try:
# from predicates import ori... | bitsawer/renpy-shader | ShaderDemo/game/shader/delaunay.py | Python | mit | 67,623 |
from presetManager import PresetManager
__all__ = ['PresetManager']
| leophys/libreant | presets/__init__.py | Python | agpl-3.0 | 70 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
T... | mrquim/repository.mrquim | repo/plugin.video.salts/scrapers/xmovies8_scraper.py | Python | gpl-2.0 | 5,433 |
# Lint as: python3
# Copyright 2019 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
#
# ... | deepmind/optax | optax/_src/lookahead_test.py | Python | apache-2.0 | 5,384 |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... | rgrover/mbed | tools/toolchains/arm.py | Python | apache-2.0 | 10,409 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... | mikehulluk/morphforge | src/morphforgecontrib/indev/chaco_dev/chaco/testMike3.py | Python | bsd-2-clause | 14,250 |
default_app_config = 'judge.apps.JudgeAppConfig' | monouno/site | judge/__init__.py | Python | agpl-3.0 | 48 |
from flask import jsonify, Blueprint, request, json
from werkzeug.datastructures import MultiDict
from projectp import socketio
from projectp import db
from projectp.auth import requires_auth
from projectp.visits.forms import DateForm
from projectp.visits.models import Visit
from .models import Location
locations = ... | Proj-P/project-p-api | projectp/locations/views.py | Python | mit | 2,614 |
import json
import subprocess
import copy
import sys
import os
try:
import yaml
hasYaml = True
except ImportError:
hasYaml = False
OFTR = '../oftr'
MAX_VERSION = 5
STR16 = '.' * 16
STR32 = '.' * 32
STR256 = '.' * 256
def _getType(elem):
if elem == None:
return 'null'
elif isinstance(elem,... | byllyfish/libofp | tools/oftr/test/annotate.py | Python | mit | 10,789 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
class TestBot(unittest.TestCase):
pass
| frappe/frappe | frappe/tests/test_bot.py | Python | mit | 181 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/enums/tutorial_state.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.proto... | bellowsj/aiopogo | aiopogo/pogoprotos/enums/tutorial_state_pb2.py | Python | mit | 3,203 |
# coding=utf-8
"""
Test unit, using simple graph made in BPMNEditor editor for import/export operation
"""
import os
import unittest
import bpmn_python.bpmn_diagram_visualizer as visualizer
import bpmn_python.bpmn_diagram_rep as diagram
class BPMNEditorTests(unittest.TestCase):
"""
This class contains test f... | KrzyHonk/bpmn-python | tests/xml_import_export/bpmn_editor_import_test.py | Python | gpl-3.0 | 2,225 |
from flask import Flask
from .view_classes import InheritanceView, DecoratedInheritanceView
from nose.tools import *
app = Flask('inheritance')
InheritanceView.register(app)
DecoratedInheritanceView.register(app)
client = app.test_client()
def test_index():
resp = client.get('/inheritance/')
eq_(b"Index", r... | apiguy/flask-classy | test_classy/test_inheritance.py | Python | bsd-3-clause | 1,181 |
#!/usr/bin/python2.7
# encoding: utf-8
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | namanjain236/personfinder | tests/server_test_cases/person_note_tests.py | Python | apache-2.0 | 229,314 |
from django.conf.urls import url, patterns
urlpatterns = patterns('',
url(r'^$', 'websettings.views.list_view', name='list'),
url(r'^edit/$', 'websettings.views.edit_view', name='edit'),
)
| hirokiky/django-websettings | websettings/urls.py | Python | mit | 199 |
# 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... | promptworks/horizon | openstack_dashboard/test/settings.py | Python | apache-2.0 | 6,022 |
from rest_framework import viewsets
from liberator import serializers
class MediaViewSet(viewsets.ModelViewSet):
serializer_class = serializers.MediaSerializer
queryset = serializer_class.Meta.model.objects.all()
| libreoss/liberator-api | liberator/views/media.py | Python | gpl-2.0 | 226 |
from model.group import Group
import random
import pytest
def test_delete_some_group(app, db, check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(name="test"))
with pytest.allure.step('Given a random group from the list'):
old_groups = db.get_group_list()
group = random... | PaulRumyantsev/python_QA | test/test_del_group.py | Python | apache-2.0 | 876 |
from .named import namedtuple
from .invoke import Symbol
@namedtuple
def ReturnValue(value):
pass
def Return():
return ReturnValue(Nil())
@namedtuple
def Assign(name, assign, value):
pass
@namedtuple
def For(namelist, iterable, body):
pass
@namedtuple
def Do(body):
pass
#@namedtuple
#def Class... | gvx/isle | ast.py | Python | isc | 1,388 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#####################################################################
# 轮询服务器 - webserver3a.py #
# #
# 使用 Python 2.7.9 或 3.4 #
... | weiqiangdragonite/blog_tmp | python/build_web_server/webserver3a.py | Python | gpl-2.0 | 1,302 |
import testtools
from spoonybard.core.jobs import JobLoader
from spoonybard.core.executors import LocalExecutor
JOB_YAML="""
name: test job
steps:
- shell: |
#!/bin/bash
echo I AM JOB HEAR ME RUN
"""
class LoadJobAndRunLocallyTestCase(testtools.TestCase):
def test_local_job_run(self):
loader = JobL... | notnownikki/spoonybard | tests/test_integration.py | Python | apache-2.0 | 524 |
import argparse
import errno
import os
def mkdir_p(path):
"""
http://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python
"""
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
... | COMBINE-lab/salmon | scripts/test_sim_corr.py | Python | gpl-3.0 | 1,305 |
# -*- 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-monitoring | samples/generated_samples/monitoring_v3_generated_metric_service_get_monitored_resource_descriptor_async.py | Python | apache-2.0 | 1,583 |
class Point():
# px: 點的 x 座標
# py: 點的 y 座標
# pn: 點的名稱
# A: 來源點物件
# name, x, y are the attributes of the class
# name, x, y 為點類別的物件屬性
# x, y, name are global variables, x, y are float and name is string
def __init__(self, px=0, py=0, pn="", A=None):
# A is a Point, pn is a String,... | 2014c2g5/2014cadp | wsgi/local_data/brython_programs/oop2.py | Python | gpl-3.0 | 1,756 |
"""
mod_customized Models
===================
In this module, we are trying to maintain database regarding tests run
by users.
List of models corresponding to mysql tables: ['TestFork' => 'test_fork',
'CustomizedTest' => 'customized_test']
"""
from sqlalchemy import Column... | satyammittal/sample-platform | mod_customized/models.py | Python | isc | 2,323 |
"""
LibNix
Copyright (C) 2017 Mark Biciunas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in th... | mbiciunas/libnix | src/libnix/config/tag/create_tag.py | Python | gpl-3.0 | 1,149 |
from setuptools import setup
version_path = 'relevanced_client/version.py'
exec(open(version_path).read())
setup(
name="relevanced-client",
zip_safe=True,
version=VERSION,
description="Python client for relevanced-server.",
url="http://www.relevanced.org",
maintainer="Scott Ivey",
maintai... | scivey/relevanced | clients/python/client/setup.py | Python | mit | 565 |
data = {
"msg_id": "387b8515-0c1d-42a9-aa80-e68b66b66c27",
"_text": "how many people between Tuesday and Friday",
"entities": {
"intent": "open_appliance",
"device": "air conditioner"
}
}
data2 ={
"msg_id": "387b8515-0c1d-42a9-aa80-e68b66b66c27",
"_text": "how many people between ... | ilab-tongji/raas | nlp/mockdata.py | Python | mit | 652 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('coredata', '0012_auto_20160126_1416'),
]
operations = [
migrations.AlterField(
model_name='combinedoffering',
name='instr_mode',
... | sfu-fas/coursys | coredata/migrations/0013_auto_20160531_1320.py | Python | gpl-3.0 | 3,072 |
#!/usr/bin/env python
# SConsBuildFramework - Copyright (C) 2013, 2014, Nicolas Papier.
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation.
# Author Nicolas Papier
version = '3-0-2'
versionDot = version.replace('-', '.')
if platform == 'wi... | npapier/sbf | pak/mkdb/swig.py | Python | gpl-3.0 | 1,365 |
from fabric.api import task
from fabric.operations import local
@task
def runserver():
local('python runserver.py')
@task
def runapp(appname):
local('PYTHONPATH=. python example_apps/'+appname+'.py')
@task
def babel(command):
# Generate the .pot file from source code files
if command=='extract':
... | lingthio/Flask-User | fabfile.py | Python | mit | 2,688 |
from __future__ import print_function
#! /usr/bin/env python
""" This test script will test the set of optimization algorithms.
It tests
- the conformity of interface
- the behavior on simple functions
- the behavior on FitnessEvaluators
- the behavior when optimizing a list or an array
- the behavior when optim... | comepradz/pybrain | pybrain/tests/optimizationtest.py | Python | bsd-3-clause | 8,268 |
# Copyright 2019 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... | petewarden/tensorflow | tensorflow/python/keras/engine/compile_utils_test.py | Python | apache-2.0 | 32,114 |
import scanpy as sc
import scanpy.external as sce
def test_scanorama_integrate():
"""
Test that Scanorama integration works.
This is a very simple test that just checks to see if the Scanorama
integrate wrapper succesfully added a new field to ``adata.obsm``
and makes sure it has the same dimensi... | theislab/scanpy | scanpy/tests/external/test_scanorama_integrate.py | Python | bsd-3-clause | 606 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013, 2014
# Author(s):
# Panu Lahtinen <panu.lahtinen@fmi.fi>
# Martin Raspaud <martin.raspaud@smhi.se>
# 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
# t... | TAlonglong/trollduction-test | trollduction/listener.py | Python | gpl-3.0 | 3,658 |
"""
These are utility functions that are similar to calls to Keras' backend. Some of these are here
because a current function in keras.backend is broken, some are things that just haven't been
implemented.
"""
import keras.backend as K
VERY_LARGE_NUMBER = 1e30
VERY_SMALL_NUMBER = 1e-30
VERY_NEGATIVE_NUMBER = -VERY_L... | RTHMaK/RPGOne | deep_qa-master/deep_qa/tensors/backend.py | Python | apache-2.0 | 9,992 |
'''comtypes.client - High level client level COM support package.
'''
################################################################
#
# TODO:
#
# - refactor some code into modules
#
################################################################
import sys, os
import ctypes
import comtypes
from comtypes.hresult ... | tinkerinestudio/Tinkerine-Suite | TinkerineSuite/python/Lib/comtypes/client/__init__.py | Python | agpl-3.0 | 9,971 |
# Copyright (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
invento... | sgerhart/ansible | lib/ansible/plugins/inventory/script.py | Python | mit | 8,479 |
# -*- coding: utf-8 -*-
import keyboard
import fileinput
import json
import sys
def print_event_json(event):
print(event.to_json(ensure_ascii=sys.stdout.encoding != 'utf-8'))
sys.stdout.flush()
keyboard.hook(print_event_json)
parse_event_json = lambda line: keyboard.KeyboardEvent(**json.loads(line))
keyboard.... | glitchassassin/keyboard | keyboard/__main__.py | Python | mit | 378 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.