code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from marshmallow import Schema, fields
class ScrapeItem(Schema):
keyword = fields.String(required=True)
number = fields.Int(required=True)
domain = fields.String(required=False)
proxy = fields.String(required=False)
language = fields.String(required=False)
| EdmundMartin/SearchScraperAPI | searchscrapeserver/schemas/schemas.py | Python | gpl-3.0 | 279 |
# Copyright (C) 2009-2013, Sugar Labs
# Copyright (C) 2009, Tomeu Vizoso
#
# 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 versio... | tchx84/sugar | src/jarabe/model/update/__init__.py | Python | gpl-2.0 | 1,009 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, publish... | rwl/PyCIM | CIM14/IEC61970/Wires/SwitchSchedule.py | Python | mit | 2,341 |
# (c) 2017, Dag Wieers <dag@wieers.com>
#
# This file is part of Ansible
#
# Ansible 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.
#
... | andreaso/ansible | lib/ansible/plugins/action/wait_for_connection.py | Python | gpl-3.0 | 4,468 |
# Copyright 2018 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... | asimshankar/tensorflow | tensorflow/python/data/experimental/ops/optimization.py | Python | apache-2.0 | 4,697 |
import json
import pathlib
from contextlib import contextmanager
import pytest
from ert_shared.asyncio import get_event_loop
from integration_utils import (
assert_distribution,
assert_export,
assert_sensitivity_export,
)
import ert
import ert3
from unittest.mock import patch
_EXPERIMENTS_BASE = ert3.wo... | joakim-hove/ert | tests/ert_tests/ert3/engine/integration/test_engine.py | Python | gpl-3.0 | 23,008 |
from __future__ import unicode_literals
from bravado.client import SwaggerClient, CONFIG_DEFAULTS
from bravado import requests_client
from bravado.swagger_model import Loader
from bravado.http_future import HttpFuture
from bravado_core.spec import Spec
from esi.errors import TokenExpiredError
from esi import app_settin... | Adarnof/adarnauth-esi | esi/clients.py | Python | gpl-3.0 | 9,459 |
# Copyright 2019 Fortinet, Inc.
#
# 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 the... | resmo/ansible | test/units/modules/network/fortios/test_fortios_system_auto_install.py | Python | gpl-3.0 | 6,598 |
# 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... | benoitsteiner/tensorflow-xsmm | tensorflow/python/ops/linalg_ops.py | Python | apache-2.0 | 23,635 |
import find_mxnet
import mxnet as mx
import logging
import os
import numpy as np
from mxconsole.summary import summary
from mxconsole.summary import FileWriter
def fit(args, network, data_loader, batch_end_callback=None):
# kvstore
kv = mx.kvstore.create(args.kv_store)
# logging
head = '%(asctime)-15s... | bravomikekilo/mxconsole | demo/mnist/train_model.py | Python | apache-2.0 | 4,498 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^urlfactory/', include('mini_url.urls')),
url(r'^grappelli/', include('grappelli.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| Tosta-Mixta/urlreductor | urlreductor/urls.py | Python | apache-2.0 | 288 |
from test.integration.base import DBTIntegrationTest, use_profile
class BaseTestSimpleDependencyWithConfigs(DBTIntegrationTest):
def setUp(self):
DBTIntegrationTest.setUp(self)
self.run_sql_file("seed.sql")
@property
def schema(self):
return "simple_dependency_006"
@property... | analyst-collective/dbt | test/integration/006_simple_dependency_tests/test_simple_dependency_with_configs.py | Python | apache-2.0 | 2,554 |
# -*- coding: utf-8 -*-
"""
This generate diagram in .png and .svg from neo.core
Author: sgarcia
"""
from datetime import datetime
import numpy as np
import quantities as pq
from matplotlib import pyplot
from matplotlib.patches import Rectangle, ArrowStyle, FancyArrowPatch
from matplotlib.font_manager import FontP... | CINPLA/expipe-dev | python-neo/doc/source/images/generate_diagram.py | Python | gpl-3.0 | 7,653 |
# Generated by Django 2.2.5 on 2019-09-25 17:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('testproducts', '0001_initial'),
]
operations = [
migrations.CreateModel(
na... | JamesRamm/longclaw | longclaw/contrib/productrequests/migrations/0001_initial.py | Python | mit | 886 |
#
# 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
# ... | cwolferh/heat-scratch | contrib/rackspace/rackspace/resources/cloud_loadbalancer.py | Python | apache-2.0 | 43,087 |
"""
This is the template for extracting the solution for the computation problem of computing
real solution of a polynomial system of equations RR from the output of the computer
algebra system Z3.
.. moduleauthor:: Albert Heinle <albert.heinle@uwaterloo.ca>
"""
import xml.dom.minidom as dom
import re
#-------------... | symbolicdata/code | src/sdeval/classes/templates/comp/SOL_R_poly_sys/Z3/template_sol.py | Python | gpl-3.0 | 2,437 |
import os
from typing import List
import click
from valohai_yaml.lint import lint_file
from valohai_cli.ctx import get_project
from valohai_cli.exceptions import CLIException
from valohai_cli.messages import success, warn
from valohai_cli.utils import get_project_directory
def validate_file(filename: str) -> int:
... | valohai/valohai-cli | valohai_cli/commands/lint.py | Python | mit | 1,886 |
"""
A harvester for the DoE's SciTech Connect Database. Makes use of SciTech's XML Querying Service. Parses the resulting XML for information and outputs the result as Json in a format that works with the OSF scrapi (scraper API).
Example API query: http://www.osti.gov/scitech/scitechxml?EntryDateFrom=02%2F02%2F2015&p... | icereval/scrapi | scrapi/harvesters/scitech.py | Python | apache-2.0 | 2,619 |
status = {'thief': True, 'wizard': True, 'warrior': True, 'priest': True}
permadeath = {'wizard': False, 'warrior': False}
survivor_goblins = 0
for room in range(1, 101):
reanimated = False
goblins = room
while True:
if status['thief']:
goblins -= 1
if status['wizard']:
... | matslindh/codingchallenges | knowit2016/knowit10.py | Python | mit | 1,694 |
import sys
import cStringIO
import py
from rpython.tool.udir import udir
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.translator.platform import CompilationError
from rpython.tool.gcc_cache import (
cache_file_path, build_executable_cache, try_compile_cache)
localudir = udir.join... | jptomo/rpython-lang-scheme | rpython/tool/test/test_gcc_cache.py | Python | mit | 3,171 |
# -*- coding: UTF-8 -*-
# TcosMonitor version __VERSION__
#
# Copyright (c) 2006-2011 Mario Izquierdo <mariodebian@gmail.com>
#
# This package 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 ... | mariodebian/tcosmonitor | tcosmonitor/extensions/sendfiles.py | Python | gpl-2.0 | 12,245 |
#!/usr/bin/env python
"""A script to generate FileCheck statements for mlir unit tests.
This script is a utility to add FileCheck patterns to an mlir file.
NOTE: The input .mlir is expected to be the output from the parser, not a
stripped down variant.
Example usage:
$ generate-test-checks.py foo.mlir
$ mlir-opt foo... | DavidNorman/tensorflow | third_party/mlir/utils/generate-test-checks.py | Python | apache-2.0 | 7,021 |
import optparse
if __name__ == "__main__":
parser = optparse.OptionParser()
parser.add_option("-f", "--file", action="store", type="string", dest="filename",
help="Filename")
parser.add_option("-p", "--path", action="store", type="string", dest="path",
help="Path")
parser... | scottkirkwood/wxoptparse | tests/noDefaultsTest.py | Python | gpl-2.0 | 1,519 |
#!/usr/bin/env python
#
#-----------------------------------------------------------------------
# A test suite for the table interface built on bsddb.db
#-----------------------------------------------------------------------
#
# Copyright (C) 2000, 2001 by Autonomous Zone Industries
# Copyright (C) 2002 Gregory P. Sm... | xxd3vin/spp-sdk | opt/Python27/Lib/bsddb/test/test_dbtables.py | Python | mit | 15,425 |
import unittest
from t2db_buffer.communicator import Webservice
from t2db_buffer.communicator import WebserviceDb
from t2db_objects.objects import Tweet
from t2db_objects.objects import User
from t2db_objects.objects import Streaming
from t2db_objects.objects import Search
from t2db_objects.objects import TweetStreami... | ptorrestr/t2db_buffer | t2db_buffer/tests/test_communicator.py | Python | gpl-2.0 | 6,000 |
"""
For convenience, all names are exported from itertools. This is so you don't
have to remember whether or not a particular function needs to be imported
from itertools since this library is very similar.
"""
from functools import partial
from itertools import (
count, cycle, repeat, chain, compress, dropwhile,... | carymrobbins/python-blocks | src/blocks.py | Python | mit | 7,294 |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class UserProfile(models.Model):
user = models.ForeignKey(User,on_delete=models.CASCADE)
job = models.CharField(max_length=50)
description = models.TextField(max_length=500,null=True)
| MMKnight/d-logger | user/models.py | Python | mit | 296 |
# Copyright (c) 2014 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... | yanheven/ceilometer | ceilometer/tests/compute/virt/vmware/test_inspector.py | Python | apache-2.0 | 6,575 |
import click
import time
import traceback
import moment
from datetime import datetime, date, timedelta
from collections import defaultdict
from timetrack import TTFileDriver, load_config, human_time, day_remainder, day_spent, parse_time
from progressbar import ProgressBar, Timer
from matplotlib import pyplot
def live_... | ravenscroftj/timetrack | timetrack/cli.py | Python | mit | 9,782 |
import pygame as pg
import sys
import random
from settings import *
from ship import *
class Game:
def __init__(self):
pg.init()
pg.font.init()
pg.mixer.init()
self.screen = pg.display.set_mode((width, height))
pg.display.set_caption(Title)
self.clock = pg.time.Cloc... | goru47/INF1L-PRJ-2 | v2/we_made_it.py | Python | mit | 12,631 |
ff_conf = [
['MemUsage', '>', 200, 'alarm@qq.com'],
['LoadAvg', '>', 1.0, 'pc@qq.com'],
]
| 51reboot/homework-arch-4 | 7/huangweiyi/conf.py | Python | apache-2.0 | 98 |
from xdrdef.nfs4_const import *
import nfs_ops
op = nfs_ops.NFS4ops()
from environment import check, fail, get_invalid_utf8strings
from xdrdef.nfs4_type import *
from rpc import RPCAcceptError, GARBAGE_ARGS, RPCTimeout
from nfs4lib import NFS4Error, hash_oids, encrypt_oids, FancyNFS4Packer
def _simple_ops(t, env):
... | srimalik/pynfs | nfs4.1/server41tests/st_compound.py | Python | gpl-2.0 | 4,093 |
# -*- coding: utf-8 -*-
' 检查扩展名是否合法 '
__author__ = 'Ellery'
from app import app
import datetime, random
from PIL import Image
import os
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1] in app.config.get('ALLOWED_EXTENSIONS')
def unique_name():
now_time = dateti... | allotory/basilinna | app/main/upload_file.py | Python | mit | 1,433 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | dhuang/incubator-airflow | airflow/operators/python.py | Python | apache-2.0 | 18,540 |
# -*- coding: utf-8 -*-
# FIXME: This test module randomly passes/fails even if all tests are skipped.
# Something fishy is going on with the Test fixtures. Behavior seen on CI on
# both Linux and Windows
# TODO: Remove delay of class creations. Adding SetUp/TearDown may help
"""Test sub-classing managed types"""
imp... | yagweb/pythonnet | src/tests/test_subclass.py | Python | mit | 8,421 |
#!/usr/bin/env python
# coding=utf-8
"""
Copyright (C) 2010-2013, Ryan Fan <ryan.fan@oracle.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your opti... | rfancn/wxgigo | wxgigo/wxmp/plugins/forward2wp/transfer.py | Python | mit | 3,204 |
from copy import deepcopy
from datetime import datetime
from django.test import TestCase
from django.core.exceptions import MultipleObjectsReturned
from models import Article, Reporter
class ManyToOneTests(TestCase):
def setUp(self):
# Create a few Reporters.
self.r = Reporter(first_name='John',... | disqus/django-old | tests/modeltests/many_to_one/tests.py | Python | bsd-3-clause | 19,811 |
# -*- coding: cp1252 -*-
"""
Reverse a String - Enter a string and the program
will reverse it and print it out.
"""
string = raw_input("Whatchu wanna say to me? ")
print "You say %s, I say %s" % (string, string[::-1])
| Mitali-Sodhi/CodeLingo | Dataset/python/reverse.py | Python | mit | 220 |
# Copyright 2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | vasiliykochergin/euca2ools | euca2ools/commands/cloudformation/argtypes.py | Python | bsd-2-clause | 2,195 |
#/usr/bin/env python
#
# script to automatically gpg sign a message, upload it to paste.pocoo.org,
# and spit out the raw paste url. very effort-saving!
#
# usage:
# python gpgsigner.py yourchallengestringgoeshere
#
# original code by nanotube, python 3 port by PLATO
from xmlrpc.client import ServerProxy
import sub... | tecan/xchat-rt | plugins/scripts/encryption/supybot-bitcoin-marketmonitor-master/GPG/helperscripts/gpgsigner.py3.py | Python | gpl-2.0 | 703 |
#!/usr/bin/env python
import fnmatch
import glob
import os
import sys
from setuptools import setup
with open("requirements.txt") as f:
required = f.read().splitlines()
VERSION = "1.2.4"
setup(
name='shmooze',
version=VERSION,
description='Framework for processed-backed web applications',
author... | zbanks/shmooze | setup.py | Python | mit | 1,029 |
"""Format() and parse() provide a simple interface to:
1. format a model element to text
2. Update model element contents based on text
"""
from functools import singledispatch
from gaphor.core.modeling import Diagram, Element
@singledispatch
def format(el: Element) -> str:
"""Format an element."""
raise T... | amolenaar/gaphor | gaphor/core/format.py | Python | lgpl-2.1 | 770 |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Rupesh Tare <rupesht@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
# Im... | stephane-martin/salt-debian-packaging | salt-2016.3.3/tests/unit/modules/influx_test.py | Python | apache-2.0 | 12,291 |
# coding: utf-8
import datetime
from django.core.validators import RegexValidator
from django.db import models
from django.urls import reverse
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from . import managers
from spec... | philgyford/django-spectator | spectator/events/models.py | Python | mit | 26,125 |
import itertools
import json
import time
from collections import defaultdict
from jsonschema import validate
from cloudshell.cp.aws.domain.common.CheckCancellationThread import CheckCancellationThread
from cloudshell.cp.aws.domain.conncetivity.operations.traffic_mirror_cleaner import TrafficMirrorCleaner
from cloudsh... | QualiSystems/AWS-Shell | package/cloudshell/cp/aws/domain/conncetivity/operations/traffic_mirroring_operation.py | Python | isc | 21,454 |
"""Support for Spider Smart devices."""
import asyncio
import logging
from spiderpy.spiderapi import SpiderApi, SpiderApiException, UnauthorizedException
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
fro... | tboyce021/home-assistant | homeassistant/components/spider/__init__.py | Python | apache-2.0 | 2,492 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import template
from django.contrib.humanize.templatetags.humanize import intcomma
from django.template.defaultfilters import floatformat
import six
from django.utils.html import format_html
register = template.Library()
@r... | texastribune/scuole | scuole/stats/templatetags/stats_tags.py | Python | mit | 1,929 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from shutil import which
from unittest.mock import patch
from urllib... | thumbor/thumbor | tests/handlers/test_base_handler_with_auto_webp.py | Python | mit | 7,701 |
import copy
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django_countries import countries
import accounts
import third_party_auth
from edxmako.shortcuts import marketing_li... | angelapper/edx-platform | openedx/core/djangoapps/user_api/api.py | Python | agpl-3.0 | 35,762 |
#!/usr/bin/env python3
import bf as bf
print(bf.interprete("+.+")) # output: 1
print(bf.interprete(",.", "2")) # output: 2 | Rob-Alexander/BrainfuckInterpreter | BrainfuckInterpreterTest.py | Python | mit | 125 |
from flask import *
from core.util import removeIf, filesInDateOrder
from models import image
def route(app, config):
assert app is not None
@app.route('/upload', methods=['POST'])
def upload():
""" File upload handler """
f = request.files['pic']
if f:
... | MatthewJWalls/memebin | handlers/upload.py | Python | mit | 631 |
# JointBox - Your DIY smart home. Simplified.
# Copyright (C) 2017 Dmitry Berezovsky
#
# JointBox 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... | JointBox/jointbox | src/common/validators.py | Python | gpl-3.0 | 913 |
import maya.cmds as cm
import maya.mel as mm
import pymel.core as pm
try:
from PySide2 import QtWidgets, QtCore, QtGui
except ImportError:
from PySide import QtCore, QtGui
QtWidgets = QtGui
# Get Maya Main Window
mayaMainWindow = pm.ui.Window('MayaWindow').asQtObject()
# Wrapper
SIGNAL = QtCore.Signal
# UI... | josephkirk/PipelineTools | main/qtui.py | Python | bsd-2-clause | 2,163 |
# -*- coding: ascii -*-
"""
#==============================================================================
#title :log.py
#description :This class represents an OpenSesame Log statement
#author :OpenSesame group of GipHouse 2014, Radboud University
#programmers :Ben Bruecker, Laurens van Ber... | sakisbl/OpenSesameOnline | webapp/os_online/translator/os_modules/log.py | Python | gpl-3.0 | 1,559 |
import wiringpi
import argparse
global impulses1
global impulses2
global impulses3
def gpio_callback1():
global impulses1
impulses1 += 1
print("pump1 %d" % impulses1)
def gpio_callback2():
global impulses2
impulses2 += 1
print("pump2 %d" % impulses2)
def gpio_callback3... | iproduct/course-social-robotics | image-recognition-python/coctail.py | Python | gpl-2.0 | 2,580 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-17 22:07
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | tipsy-team/beacon-back | beaconapp/api/migrations/0001_initial.py | Python | apache-2.0 | 820 |
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | HybridF5/jacket | jacket/api/compute/openstack/compute/legacy_v2/contrib/admin_actions.py | Python | apache-2.0 | 17,106 |
# Principal Component Analysis Code :
from numpy import mean,cov,double,cumsum,dot,linalg,array,rank,size,flipud
from pylab import *
import numpy as np
import matplotlib.pyplot as pp
#from enthought.mayavi import mlab
import scipy.ndimage as ni
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import ro... | tapomayukh/projects_in_python | classification/Classification_with_kNN/Single_Contact_Classification/Scaled_Features/best_kNN_PCA/2_categories/test11_cross_validate_categories_mov_fixed_1200ms_scaled_method_iii.py | Python | mit | 5,012 |
"""
Validate if a given string is numeric.
Some examples:
"0" => true
" 0.1 " => true
"abc" => false
"1 a" => false
"2e10" => true
Note: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing one.
"""
class Solution:
def isNumber(self, s):
... | ecotner/Learning-to-fly | Leetcode/Python/65 Valid Number.py | Python | mit | 753 |
r"""
This model provides the form factor for a pearl necklace composed of two
elements: *N* pearls (homogeneous spheres of radius *R*) freely jointed by *M*
rods (like strings - with a total mass *Mw* = *M* \* *m*\ :sub:`r` + *N* \* *m*\
:sub:`s`, and the string segment length (or edge separation) *l*
(= *A* - 2\ *R*))... | SasView/sasmodels | sasmodels/models/pearl_necklace.py | Python | bsd-3-clause | 4,769 |
# Copyright 2015, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.com>
#
# 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... | jangsutsr/tower-cli | lib/tower_cli/resources/organization.py | Python | apache-2.0 | 3,417 |
import argparse
import sys
import rospy
from geometry_msgs.msg import (
PoseStamped,
Pose,
Point,
Quaternion,
)
from std_msgs.msg import Header
from baxter_core_msgs.srv import (
SolvePositionIK,
SolvePositionIKRequest,
)
def ik_solve(limb, pos, orient):
#~ rospy.init_node("rsdk_ik_serv... | calumk/ROS-Blocks | ros_blocks/scripts/ik_solver.py | Python | mit | 1,346 |
#-*- coding: utf-8 -*-
"""
#---------------------------------------------
filename: ex_runTFconstant.py
- tensorflow의 기본 계산 그래프를 생성하고 평가해본다
- tf.constant()을 사용해 본다
Written by Jaewook Kang
2017 Aug.
#-------------------------------------------
"""
import tensorflow as tf
import numpy as np
import pandas as p... | jwkanggist/EveryBodyTensorFlow | tf_basic/ex_runTFconstant.py | Python | unlicense | 644 |
# Copyright 2013 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 a... | vijayendrabvs/hap | neutron/plugins/vmware/dbexts/networkgw_db.py | Python | apache-2.0 | 23,165 |
"""Unit test for appwatch.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import kazoo
import kazoo.client
import mock
from treadmill import discovery
from treadmill import zknamespace as z
fro... | Morgan-Stanley/treadmill | lib/python/treadmill/tests/discovery_test.py | Python | apache-2.0 | 6,687 |
#!/usr/bin/python3
""" Weather web access """
import json
from Web import proxy
from Interface import strings, utils
TEMP_MIN = -273
class OpenWeatherMap:
def __init__(self, log_file):
self.temperature = TEMP_MIN
self.temperature_str = '0'
self.temperature_spk = '0'
self.de... | mevellea/GoodMorning | Web/weather.py | Python | gpl-2.0 | 1,635 |
def extractWillfulCasual(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Chu Wang Fei' in item['tags']:
return buildReleaseMessageWithType(item, 'Chu Wang Fei', vol, chp, frag=frag, postfix=post... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWillfulCasual.py | Python | bsd-3-clause | 339 |
schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"player": {
"type": "object",
"properties": {
"faction": {
"type": "string"
},
"caster": {
"type": "str... | elwinar/chronicler | chronicler/schema.py | Python | unlicense | 1,174 |
# downloaded sources handling
from __future__ import with_statement
import json
import os
import re
import shutil
import stat
import subprocess
import sys
import tarfile
import tempfile
import time
from distutils.version import LooseVersion
from six import print_
from ccmlib.common import (ArgumentError, CCMError, g... | unusedPhD/ccm | ccmlib/repository.py | Python | apache-2.0 | 17,797 |
#!/usr/bin/python
# Use with 2 arguments:
# 1 (read): Input RasOrb file
# 2 (read/write): Input molden file
import sys
import os
import re
import math
import fileinput
#=============================
# Get input files
try:
rasorb_input = sys.argv[1]
except IndexError:
sys.exit("Missing input rasorb file"... | Jellby/ASEP-MD | Tests/scripts/rasorb2molden.py | Python | gpl-3.0 | 8,426 |
def diff21(n):
"""Given an int n, return the absolute difference between n and 21, except return double the absolute difference if n is over 21."""
diff = abs(n-21)
if n > 21:
diff = diff*2
return diff | m-debnath/bat-python | warmup-1/diff21.py | Python | gpl-3.0 | 225 |
#!/usr/bin/env python3
import fsb5
from setuptools import setup, find_packages
CLASSIFIERS = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python ... | HearthSim/python-fsb5 | setup.py | Python | mit | 843 |
"""
Manage and query memcache server(s).
"""
from __future__ import print_function
def setup_parser(parser, completions=False):
parser.add_argument(
"--flush", action="store_true",
help="flush all cache entries")
parser.add_argument(
"--stats", action="store_true",
help="list s... | fnaum/rez | src/rez/cli/memcache.py | Python | lgpl-3.0 | 6,057 |
# coding: utf-8
import os
import atx
__basename = os.path.basename(os.path.splitext(__file__)[0])
d = atx.connect(platform="android")
d.image_path = [".", "images", os.path.join("images", __basename)]
d.screenshot('screen.png')
if 0 == 0:
print('你好')
for count in range(1):
print('Hello world')
print('Hello w... | codeskyblue/AutomatorX | tests/testcase_examples/blockly.py | Python | apache-2.0 | 330 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Openldap(AutotoolsPackage):
"""
OpenLDAP Software is an open source implementation of ... | LLNL/spack | var/spack/repos/builtin/packages/openldap/package.py | Python | lgpl-2.1 | 4,600 |
#!/usr/bin/env python
import json
import os
import platform
import select
import signal
import time
import subprocess
import unittest
import sys
import re
from threading import Thread
BASE_TIMEOUT = 10
TEST_ROOT = os.path.abspath(os.path.dirname(__file__))
CASPERJS_ROOT = os.path.abspath(os.path.join(TEST_ROOT, '..'... | soundyogi/casperjs | tests/clitests/runtests.py | Python | mit | 18,588 |
# -*- coding: utf-8 -*-
"""
zang.inboundxml.elements.play
~~~~~~~~~~~~~~~~~~~
Module containing `Play` inbound xml element
"""
from zang.inboundxml.elements.base_node import BaseNode
class Play(BaseNode):
_allowedContentClass = ()
def __init__(self, url, loop=None):
if url is None:
rai... | jaymin-panchal/zang-python | zang/inboundxml/elements/play.py | Python | mit | 599 |
from __future__ import unicode_literals, absolute_import
import hashlib
from django.conf import settings
from django.core.cache import caches
import waffle
from waffle import defaults
def get_setting(name, default=None):
try:
return getattr(settings, 'WAFFLE_' + name)
except AttributeError:
... | willkg/django-waffle | waffle/utils.py | Python | bsd-3-clause | 680 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Kbproto(AutotoolsPackage, XorgPackage):
"""X Keyboard Extension.
This extension defin... | LLNL/spack | var/spack/repos/builtin/packages/kbproto/package.py | Python | lgpl-2.1 | 715 |
# encoding: 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 'Place'
db.create_table('location_place', (
('id', self.gf('django.db.models.fi... | uq-eresearch/uqam | location/migrations/0001_initial.py | Python | bsd-3-clause | 3,434 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps.registry import Apps
from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
class CustomModelBase(models.base.ModelBase):
pass
class ModelWithCustomBase... | yephper/django | tests/migrations/models.py | Python | bsd-3-clause | 1,854 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
# /home/*/hama_dbとかが返ってくる
exec_path = os.path.abspath(os.path.dirname(__file__)).rsplit("/",1)[0]
conf_path = exec_path+"/common/config.json"
sys.path.insert(0,exec_path)
from common import auth_api, model
import simplejson
import datetime
from sql... | showyou/hama_db | crawler/crawler.py | Python | mit | 1,984 |
from base64 import b64decode, b64encode
from hashlib import sha256
from Crypto import Random
from Crypto.Cipher import AES
from frontstage import app
class Cryptographer:
"""Manage the encryption and decryption of random byte strings"""
def __init__(self):
"""
Set up the encryption key, thi... | ONSdigital/ras-frontstage | frontstage/common/cryptographer.py | Python | mit | 2,059 |
import operator
from django.conf import settings
from django.forms import TextInput, Select, MultiWidget
from moneyed import CURRENCIES, DEFAULT_CURRENCY_CODE
__all__ = ('MoneyWidget', )
PROJECT_CURRENCIES = getattr(settings, 'CURRENCIES', None)
if PROJECT_CURRENCIES:
CURRENCY_CHOICES = [(code, CURRENCIES[code]... | tsouvarev/django-money | djmoney/forms/widgets.py | Python | bsd-3-clause | 1,723 |
# __init__.py - collection of Belarusian numbers
# coding: utf-8
#
# Copyright (C) 2020 Arthur de Jong
#
# This library 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 Licens... | arthurdejong/python-stdnum | stdnum/by/__init__.py | Python | lgpl-2.1 | 940 |
"""
Read in files transport_lines.txt.
Handle these cases carefully:
More or less than 8 lines
"""
import blinkt
import colours
import multiprocessing
import requests
import time
REFRESH_TIME = 5 * 60
def typo_correct(input):
subs = {
'hamm': 'hammersmith-city',
'over': 'london-overgroun... | noelevans/sandpit | rpi/blinkt/transport_state.py | Python | mit | 2,931 |
import numpy as np
from nipy.neurospin.utils.simul_2d_multisubject_fmri_dataset import \
make_surrogate_array
from nipy.neurospin.utils.threshold import threshold_array, threshold_z_array
def make_surrogate_data():
"""
"""
dimx = 40
dimy = 40
pos = np.array([[ 2, 10],
... | yarikoptic/NiPy-OLD | nipy/neurospin/utils/tests/test_threshold.py | Python | bsd-3-clause | 2,177 |
# -*- coding: utf-8 -*-
# +---------------------------------------------------------------------------+
# | 01001110 01100101 01110100 01111010 01101111 01100010 |
# | |
# | Netzob : Inferring communication prot... | lootr/netzob | netzob/src/netzob/Model/Vocabulary/Domain/Variables/Nodes/Agg.py | Python | gpl-3.0 | 10,679 |
from django.conf.urls import url
from . import views
from classroom.views import create_classroom_view, delete_block_view, randomize
app_name = "classroom"
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^submitted', views.submitted, name='submitted'),
url(r'^classup/$', create_classroom_view, na... | shmish/core-assess | classroom/urls.py | Python | mpl-2.0 | 656 |
# coding: utf-8
from quokka.core.models import Channel, Config, CustomValue
def configure(app):
@app.before_first_request
def initialize():
print("Called only once, when the first request comes in")
if not Channel.objects.count():
# Create homepage if it does not exists
... | eltonsantos/quokka | quokka/ext/before_request.py | Python | mit | 1,044 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 22 15:52:24 2014
Script to analyse the seismograms generated by SPECFEM.
The arguments must be correct paths to existing seismogram files or
an existing option (--hold, --grid)
@author: Alexis Bottero (alexis.bottero@gmail.com)
"""
from __future__ import ... | geodynamics/specfem2d | utils/Visualization/plot.py | Python | gpl-3.0 | 21,898 |
""" Solution to the second puzzle of Day 23 on adventofcode.com
"""
import os
import re
def main():
""" This is a very advanced machine
"""
basedir = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(basedir, 'input')
insts = []
with open(file_path, 'r') as input_file:
... | JPinSPACE/AdventOfCode | day23/02_vm_new_registers/solution.py | Python | mit | 1,674 |
###########################################################################
#
# Copyright 2020 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
#
# https://www.apache.org/l... | google/starthinker | starthinker/tool/cm.py | Python | apache-2.0 | 6,569 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""Miscellaneous events."""
from .event import Event
__author__ = 'fyabc'
class LoseDivineShield(Event):
def _repr(self):
return super()._repr(owner=self.owner)
def do(self):
return []
class LoseStealth(Event):
def _repr(self):
retur... | fyabc/MiniGames | HearthStone2/MyHearthStone/game/events/misc.py | Python | mit | 781 |
"""Tests for `cookiecutter.hooks` module."""
import os
import errno
import stat
import sys
import textwrap
import pytest
from cookiecutter import hooks, utils, exceptions
def make_test_repo(name, multiple_hooks=False):
"""Create test repository for test setup methods."""
hook_dir = os.path.join(name, 'hooks... | pjbull/cookiecutter | tests/test_hooks.py | Python | bsd-3-clause | 10,560 |
from xml.dom import minidom
import sys
class Mirror (object):
def __init__(self):
self.types = []
def dumpattr(self, what, dest):
dest.write("# ")
for i in range(len(what)+4):
dest.write("-")
dest.write("\n")
dest.write("# - %s -\n" % what.upper())
dest.write("# ")
for i in range(len(self.country)+4... | frugalware/pacman-g2 | scripts/mirrors.py | Python | gpl-2.0 | 1,836 |
# This file is part of xrayutilities.
#
# xrayutilities 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... | dkriegner/xrayutilities | lib/xrayutilities/math/__init__.py | Python | gpl-2.0 | 1,879 |
from re import findall
# Set indexing of word
def get_index(word):
word = list(word)
return [word.index(x) for x in word]
def remap(plainword, cipherword):
for p, c in zip(plainword, cipherword):
if az[c] is None:
az[c] = p
# Setup list of words
with open('dictionary.lst', 'r') as f:
... | LaughDonor/hackerrank | Python2/basic-cryptanalysis.py | Python | apache-2.0 | 1,953 |
# Copyright (c) 2012, the Mozilla Foundation. All rights reserved.
# Use of this source code is governed by the Simplified BSD License which can
# be found in the LICENSE file.
import ctypes
from ctypes import POINTER, WinError, sizeof, byref
from ctypes.wintypes import DWORD, HANDLE, BOOL
LPDWORD = POINTER(DWORD)
G... | Kameecoding/conv2mp4-py | ntfsutils/fs.py | Python | gpl-3.0 | 4,838 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A Morse Binary CLI sound generator
Copyright (C) 2015 by
Sébastien Celles <s.celles@gmail.com>
All rights reserved.
Usage:
$ msound -m "MORSE CODE"
"""
import argparse
import sys
from morse_talk.utils import (FRAMERATE, AMPLITUDE, FREQUENCY, WORD)
from morse_talk.u... | morse-talk/morse-talk | morse_talk/cli_msound.py | Python | gpl-2.0 | 3,098 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.