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 |
|---|---|---|---|---|---|
import dataset
class DataConfig(object):
# TODO USE THIS ONE
ORIGIN_LABEL_PATH = dataset.DATA_PATH + '/label.md'
CUT_DATASET_PATH = dataset.DATA_PATH + '/cut_dataset_2/'
NEMO_DATASET_PATH = dataset.DATA_PATH + '/nemo_dataset/'
GENERATED_LABEL_PATH = dataset.DATA_PATH + '/label2/'
SUB_REGION_... | Lukeeeeee/PatternRecognitionCourseFinalProject | src/data/dataConfig.py | Python | mit | 1,009 |
#!/usr/bin/python
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with... | jdob/okaara | setup.py | Python | gpl-2.0 | 1,032 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | skuda/client-python | kubernetes/test/test_version_api.py | Python | apache-2.0 | 832 |
from routersploit.modules.creds.routers.thomson.telnet_default_creds import Exploit
def test_check_success(generic_target):
""" Test scenario - testing against Telnet server """
exploit = Exploit()
assert exploit.target == ""
assert exploit.port == 23
assert exploit.threads == 1
assert explo... | dasseclab/dasseclab | clones/routersploit/tests/creds/routers/thomson/test_telnet_default_creds.py | Python | gpl-2.0 | 646 |
# Copyright 2020 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 applicable law or agreed to in writing, so... | GoogleCloudPlatform/python-docs-samples | firestore/cloud-async-client/snippets.py | Python | apache-2.0 | 25,866 |
#!/usr/bin/env python
"""
This example explores how best to catenate strings in python.
The results are surprising.
- It seems the + operator is the quickest
- Join and %s%s come next.
- Formatting is last.
References:
- http://blog.lerner.co.il/speedy-string-concatenation-python/
"""
import timeit
x = 'abc'
y = '... | veltzer/demos-python | src/examples/short/strings/catenate_strings_performance.py | Python | gpl-3.0 | 1,014 |
import os
from base64 import b64encode
from ssh2.knownhost import LIBSSH2_KNOWNHOST_TYPE_PLAIN, \
LIBSSH2_KNOWNHOST_KEYENC_RAW, LIBSSH2_KNOWNHOST_KEY_SSHRSA, \
LIBSSH2_KNOWNHOST_KEYENC_BASE64, LIBSSH2_KNOWNHOST_TYPE_SHA1, \
LIBSSH2_KNOWNHOST_KEY_SSHDSS
from ssh2.session import LIBSSH2_HOSTKEY_HASH_SHA1, LI... | ParallelSSH/ssh2-python | tests/test_knownhost.py | Python | lgpl-2.1 | 6,543 |
# coding=utf-8
import subprocess
from flask_babel import lazy_gettext
from mycodo.config_translations import TRANSLATIONS
from mycodo.config import INSTALL_DIRECTORY
from mycodo.databases.models import Actions
from mycodo.function_actions.base_function_action import AbstractFunctionAction
from mycodo.utils.database im... | kizniche/Mycodo | mycodo/function_actions/system_restart.py | Python | gpl-3.0 | 1,806 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014 CERN.
##
## Invenio 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) a... | egabancho/invenio | invenio/modules/oaiharvester/tasks/harvesting.py | Python | gpl-2.0 | 8,026 |
#-
# Copyright (c) 2011 Robert N. M. Watson
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# License... | 8l/beri | cheritest/trunk/tests/cp2/test_cp2_csbr_priv.py | Python | apache-2.0 | 2,073 |
#!/usr/bin/env python
#
# Copyright (c) 2017 Naoto Yokoyama
#
# Modifications applied to the original work.
#
#
# Original copyright notice:
#
# Copyright 2015 Robb Wagoner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... | builtinnya/aws-sns-slack-terraform | sns-to-slack/lambda_function.py | Python | apache-2.0 | 10,274 |
import eventlet
from github import Github
from st2reactor.sensor.base import PollingSensor
eventlet.monkey_patch(
os=True,
select=True,
socket=True,
thread=True,
time=True)
DATE_FORMAT_STRING = '%Y-%m-%d %H:%M:%S'
class GithubRepositorySensor(PollingSensor):
def __init__(self, sensor_servic... | armab/st2contrib | packs/github/sensors/github_repository_sensor.py | Python | apache-2.0 | 5,448 |
from __future__ import unicode_literals
import frappe
def execute():
frappe.db.sql("""update `tabPurchase Order Item` set billed_amt = 0
where delivered_by_supplier=1 and docstatus=1""")
drop_ship_pos = frappe.db.sql("""select distinct parent from `tabPurchase Order Item`
where delivered_by_supplier=1 and ... | MartinEnder/erpnext-de | erpnext/patches/v6_10/fix_billed_amount_in_drop_ship_po.py | Python | agpl-3.0 | 720 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2020 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net>
#
# This file is part of qutebrowser.
#
# qutebrowser 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... | The-Compiler/qutebrowser | qutebrowser/misc/keyhintwidget.py | Python | gpl-3.0 | 4,942 |
# -*- coding: UTF-8 -*-
import wx
from wx.glcanvas import *
import wx
import wx.lib.scrolledpanel as scrolled
from geometry import geometry
from caid.cad_geometry import cad_geometry
from numpy import pi, linspace
import numpy as np
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import sys... | ratnania/caid | caid-gui/fields.py | Python | mit | 16,389 |
#!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test blockfilterindex in conjunction with prune."""
from test_framework.test_framework import BitcoinTestFra... | dscotese/bitcoin | test/functional/feature_blockfilterindex_prune.py | Python | mit | 3,254 |
from sqlalchemy import create_engine, func, cast, desc, distinct, exists, Column, String, INT, DATETIME, TEXT
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import xlwt
import re
Base = declarative_base()
connection = ''
ENGINE = create_engine(connection,
connect_... | rwecho/fflask_blog | five8/five8/mydb/export_phones.py | Python | apache-2.0 | 1,651 |
"""user permissions management
Revision ID: bd67c88713b8
Revises: 10023013f155
Create Date: 2021-03-31 21:31:47.278834
"""
# revision identifiers, used by Alembic.
import datetime
from sqlalchemy import orm, text
from sqlalchemy.engine.reflection import Inspector
revision = "bd67c88713b8"
down_revision = "1002301... | hasadna/anyway | alembic/versions/bd67c88713b8_user_permissions_management.py | Python | mit | 3,369 |
class RedisBackend(object):
"""
Redis backend.
Requires redis-py library (https://github.com/andymccurdy/redis-py)
Redis database should contain key-value pairs, where key follow the following pattern: "[PREFIX][TAGKEY]:[LANGUAGE]".
E.g. for "hello_world" tag key in English it should be "pyslate_... | attomir/pystlate | pyslate/backends/redis_backend.py | Python | mit | 1,872 |
"""
Utilities for reading comprehension dataset readers.
"""
from collections import Counter, defaultdict
import logging
import string
from typing import Any, Dict, List, Tuple
from allennlp.data.fields import Field, TextField, IndexField, MetadataField
from allennlp.data.instance import Instance
from allennlp.data.t... | nafitzgerald/allennlp | allennlp/data/dataset_readers/reading_comprehension/util.py | Python | apache-2.0 | 11,589 |
print '... Importing simuvex/plugins/cgc.py ...'
from angr.state_plugins.cgc import *
| Ruide/angr-dev | simuvex/simuvex/plugins/cgc.py | Python | bsd-2-clause | 86 |
""" Functionality on top of QApplication.
"""
import sys, traceback, Queue
from PyQt4.QtGui import *
import warnings
import srllib.threading
from srllib.signal import Signal
from _common import *
from srllib.qtgui import _signal
__all__ = ["Application", "get_app"]
class _AsyncEvent(QEvent):
EventType = QEvent.U... | aknuds1/srl-python-lib | srllib/qtgui/_application.py | Python | mit | 5,695 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import frappe, unittest
class TestAddressTemplate(unittest.TestCase):
def setUp(self):
self.make_default_address_template()
def test_default_is_unset(self):
a = frappe.get_doc("Address Template", "Indi... | frappe/frappe | frappe/contacts/doctype/address_template/test_address_template.py | Python | mit | 1,417 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Dimitrios Tydeas Mengidis <tydeas.dr@gmail.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... | mscherer/ansible-modules-extras | packaging/language/composer.py | Python | gpl-3.0 | 6,165 |
# coding: utf-8
from django import forms
from app.kanboard.models import Card, PHASE_CHOICES
from app.founder.models import Founder
from django.utils.translation import ugettext_lazy as _
class CardForm(forms.ModelForm):
class Meta:
model = Card
fields = [
'phase',
'titl... | CentechMTL/TableauDeBord | app/kanboard/forms.py | Python | gpl-3.0 | 1,921 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src/solutions/common/job/module_statistics.py | Python | apache-2.0 | 6,018 |
"""
Tests for miscellaneous models
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import pandas as pd
import os
import re
import warnings
from statsmodels.tsa.statespace import mlemodel
from statsmodels import datasets
from numpy.te... | yl565/statsmodels | statsmodels/tsa/statespace/tests/test_models.py | Python | bsd-3-clause | 6,374 |
###############################################################################
# Copyright 2017-2021 - Climate Research Division
# Environment and Climate Change Canada
#
# This file is part of the "fstd2nc" package.
#
# "fstd2nc" is free software: you can redistribute it and/or modify
# it under... | neishm/fstd2nc | fstd2nc/mixins/series.py | Python | lgpl-3.0 | 14,870 |
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) 2009, 2010, 2011 by Eric Brochu
#
# 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 t... | misterwindupbird/IBO | ego/acquisition/prefutil.py | Python | mit | 2,203 |
# Runtime labels
from .namespace import NAMESPACE
class DataRestoreLabels:
READ = f"{NAMESPACE}.__READ"
RESTORE = f"{NAMESPACE}.__RESTORE"
REQUIRED_MODULES = {
DataRestoreLabels.READ: "read_restore.asm",
DataRestoreLabels.RESTORE: "read_restore.asm",
}
| boriel/zxbasic | src/arch/z80/backend/runtime/datarestore.py | Python | gpl-3.0 | 274 |
import liboctave
print liboctave.primes(10000)
| victorlei/smop | smop/test_primes.py | Python | mit | 48 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import re, tem... | sharad/calibre | src/calibre/ebooks/conversion/plugins/html_input.py | Python | gpl-3.0 | 12,296 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Gaël Lambert (gaelL) <gael.lambert@netwiki.fr>
#
# 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
# (a... | shaftmx/passkeeper | passkeeper/tests/units/test_passkeeper.py | Python | unlicense | 9,533 |
"""
Python implementation of the LiNGAM algorithms.
The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam
"""
import itertools
import numbers
import warnings
import numpy as np
from scipy.stats.distributions import chi2
from sklearn.utils import check_array, resample
from .bootstrap import BootstrapRes... | cdt15/lingam | lingam/bottom_up_parce_lingam.py | Python | mit | 18,658 |
#!/usr/bin/env python
""" lk_tracker.py - Version 1.0 2012-02-11
Based on the OpenCV lk_track.py demo code
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2011 Patrick Goebel. All rights reserved.
This program is free software; you can redistribute it and/or modify
it... | dan-git/outdoor_bot | vision/nodes/lk_tracker.py | Python | bsd-2-clause | 5,980 |
# This file is part of the myhdl library, a Python package for using
# Python as a Hardware Description Language.
#
# Copyright (C) 2003-2012 Jan Decaluwe
#
# The myhdl 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 t... | juhasch/myhdl | myhdl/conversion/_toVerilog.py | Python | lgpl-2.1 | 52,023 |
# encoding: utf-8
# for use with globals() when reading table
nan=float('nan')
from math import *
from minieigen import *
import warnings
import sys
from wooMain import options as wooOptions
py3k=(sys.version_info[0]==3)
try:
from lockfile import FileLock
except ImportError:
class FileLock:
'Dummy class if th... | gladk/woodem | py/batch.py | Python | gpl-2.0 | 43,047 |
default_app_config = "webquills.theme_bs4_2021.apps.ThemeBs42021Config"
| veselosky/webquills | webquills/theme_bs4_2021/__init__.py | Python | apache-2.0 | 72 |
"""
Unittests for the rpc.ini module
"""
import ConfigParser
import StringIO
import sys
import unittest
if sys.version_info < (2, 7):
import unittest2 as unittest
from mock import MagicMock
from rpc import ini
SAMPLEINI = """
[section]
option=foo
goo=3
"""
class ConfigTestCase(unittest.TestCase):
def setUp(... | davidmiller/rpc | test/test_ini.py | Python | lgpl-3.0 | 1,478 |
# -*- coding: utf-8 -*-
"""
Pygments basic API tests
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function
import random
import unittest
from pygments import lexers, formatters, le... | willemneal/Docky | lib/pygments/tests/test_basic_api.py | Python | mit | 11,926 |
import os
import collections
posDict = {
0: "No.",
1: "Rarity",
2: "ShipName",
3: "World1-1",
4: "World1-2",
5: "World1-3",
6: "World1-4",
7: "World1-5",
8: "World2-1",
9: "World2-2",
10:"World2-3",
11:"World2-4",
12:"World2-5",
13:"World3-1",
14:"World3-2",
15:"World3-3",
16:"Worl... | remiscarlet/RandomKCWikiScripts | kcwiki-web/kcwiki/Python Scripts/mw-scripts/kcwiki-droplist-importToLua.py | Python | gpl-2.0 | 3,097 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | sridevikoushik31/nova | nova/scheduler/rpcapi.py | Python | apache-2.0 | 4,921 |
# 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 the hope that it will be useful,
# bu... | Hao-Liu/avocado | avocado/core/output.py | Python | gpl-2.0 | 17,935 |
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Rackspace Hosting
# Copyright 2013 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 co... | CMSS-BCRDB/RDS | trove/datastore/models.py | Python | apache-2.0 | 16,041 |
# Copyright 2014: Mirantis Inc.
# Copyright 2014: Catalyst IT Ltd.
# 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/L... | afaheem88/rally | tests/functional/test_task_samples.py | Python | apache-2.0 | 3,377 |
import os
import json
import random
import HTMLParser
from crpapi import CRP, CRPError
from congress import Congress, CongressError
try:
from config import secrets
except ImportError:
secrets = {
"OPENSECRETS_API_KEY" : os.environ['OPENSECRETS_API_KEY'],
"PROPUBLICA_API_KEY" : os.environ['PROPU... | robrem/whoserep | tweettext.py | Python | mit | 9,446 |
from django.contrib import admin
from . import models
| sachinkum/Bal-Aveksha | WebServer/Authentications/admin.py | Python | gpl-3.0 | 54 |
import logging
import os
import re
from django.template import loader_tags, defaulttags, defaultfilters, TextNode
# don't pyflakes this out; it monkey-patches django's Template.
from vacuum import template as _template
from vacuum import utils
registered_rules = []
class RuleMeta(type):
"""
Automatically re... | craigds/django-vacuum | vacuum/rules.py | Python | mit | 7,469 |
"""
Establishing referral routes
"""
from django.conf import settings
from opal.utils import stringport, camelcase_to_underscore, _itersubclasses
from opal.core.schemas import serialize_model
# So we only do it once
IMPORTED_FROM_APPS = False
def import_from_apps():
"""
Iterate through installed apps attemp... | openhealthcare/opal-referral | referral/routes.py | Python | agpl-3.0 | 2,456 |
from bs4 import BeautifulSoup as BS
import requests
liste=[]
#Get for each H (topic)
for x in range(1,12):
liste.append("http://www.statistik-bw.de/SRDB/home.asp?H="+str(x)+"&E=GE")
liste2=[]
found =[]
for x in liste:
soup = BS(requests.get(x).text)
for y in soup.find(attrs={"name":"U"}).children:
if y == u... | UlmApi/bw-srdb-parser | lib/getall.py | Python | mit | 736 |
import os
import Queue
import serial
import settings
import sys
import time
import threading
import traceback
import zmq
#BASE_PATH = os.path.dirname(os.path.realpath(__file__))
#UPPER_PATH = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
#DEVICES_PATH = "%s/Hosts/" % (BASE_PATH )
#THIRTYBIRDS_PATH = "... | andycavatorta/oratio | Roles/avl-visual/main.py | Python | mit | 19,809 |
from __future__ import absolute_import
from .base_command import BaseCommand
| brantje/telegram-github-bot | captain_hook/services/telegram/commands/base/__init__.py | Python | apache-2.0 | 77 |
from collections import OrderedDict
from multiprocess.pool import ApplyResult
from pathos.pools import ProcessPool
from itertools import izip
import numpy as np
class FeedArray(object):
def __init__(self, arr):
self.arr = arr
def get_num_examples(self):
return self.arr.shape[0]
def get_e... | jakesnell/myshkin | myshkin/util/feeder.py | Python | mit | 8,023 |
import unittest
from annoy import AnnoyIndex
class TestAnnoy(unittest.TestCase):
def test_tree(self):
t = AnnoyIndex(5, 'angular')
t.add_item(1, [1,2,3,4,5])
self.assertTrue(t.build(1))
| Kaggle/docker-python | tests/test_annoy.py | Python | apache-2.0 | 218 |
# Copyright (c) 2005-2007 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this ... | dpac-vlsi/SynchroTrace | util/src/dev/DiskImage.py | Python | bsd-3-clause | 2,106 |
import sqlite3
import time
import queue
from message import Message
from pluginmanager import PluginManager
def run_plushie(config, outputs, inputs):
try:
blacklist = config['plugin_blacklist']
except:
blacklist = []
# TODO: Make PluginManager use a different approach for sending message... | Etzos/PlushieBot | plushiecore.py | Python | gpl-3.0 | 2,958 |
# Copyright 2014 Mirantis 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... | stackforge/osprofiler | osprofiler/cmd/commands.py | Python | apache-2.0 | 7,853 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
print "Hello, world!"
print "你好,世界!"
| weizhenwei/tech-docs-2016 | python/basis/1-helloworld.py | Python | bsd-2-clause | 95 |
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import re
import warnings
from datetime import datetime, timedelta
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
import haystack
from haystack.... | celerityweb/django-haystack | haystack/backends/elasticsearch_backend.py | Python | bsd-3-clause | 37,978 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask_script import Manager, Shell, Server
from flask_script.commands import Clean, ShowUrls
from flask_migrate import MigrateCommand
from flask.ext.login import login_required, make_secure_token, get_auth_token
from ccflasktest.app import create_app
from cc... | chrcoe/ccflasktest | manage.py | Python | bsd-3-clause | 1,813 |
#!/usr/bin/env python
# ***************************************************************************
#
# Copyright (c) 2015 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#... | Xyrotechnology/Project-Anthrax | SD/libraries/Scripts/Pixhawk/Firmware-master/integrationtests/demo_tests/px4_test_helper.py | Python | apache-2.0 | 4,195 |
#
# mldb_logging_stream_handler.py
# Mich, 2016-04-11
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
# How to build a logging StreamHandler that will output to MLDB since the
# regular stream handler won't work.
#
# Tow things can be done.
# 1 - Redirect sys.stdout and sys.stderr to mld... | mldbai/mldb | testing/cookbook/mldb_logging_stream_handler.py | Python | apache-2.0 | 778 |
#!/usr/bin/env python
import os;
import shutil;
os.system("ndk-build");
shutil.copy("obj/local/armeabi/libGK.a", "../../bin/android/libGK.a");
os.system("mkdir " + os.getenv('NDK_ROOT') + "\\sources\\third_party\\LibGK");
os.system("xcopy module\\* " + os.getenv('NDK_ROOT') + "\\sources\\third_party\\LibGK /e /D"); | amineas/libGK | build/android/build.py | Python | mit | 318 |
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016 Cortney T. Buffington, N0MJS <n0mjs@me.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
... | n0mjs710/DMRlink | Retired/play_group.py | Python | gpl-3.0 | 8,655 |
# proxy module
from traitsui.qt4.editor import *
| enthought/etsproxy | enthought/traits/ui/qt4/editor.py | Python | bsd-3-clause | 49 |
#!/usr/bin/env python
import usb.core
import usb.util
import sys
import time
from array import array
#import cv2
# check if initialized device already exists
dev = usb.core.find(idVendor=0x05a9, idProduct=0x058a)
if dev is None:
print 'PS4 camera not initialized'
sys.exit()
# already configured from v4l
#dev... | SavantCat/ofxPS4Eye | sh/ps4eye_cmd.py | Python | gpl-2.0 | 3,332 |
# -*- python -*-
# test_host_specific_configuration.py - Unit tests for
# swift_build_support.host_specific_configuration
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exc... | jckarter/swift | utils/swift_build_support/tests/test_host_specific_configuration.py | Python | apache-2.0 | 27,447 |
"""
This script demonstrates using the crab client directly or through the
:func:`crabpy.client.crab_request` function.
"""
from crabpy.client import crab_factory, crab_request
crab = crab_factory()
res = crab.service.ListGemeentenByGewestId(1)
print(res)
res = crab.service.ListPostkantonsByGemeenteId(71)
print(res... | OnroerendErfgoed/crabpy | examples/crab.py | Python | mit | 561 |
import serial
import requests
import time
# URL = 'http://localhost:5000/piano/get'
URL = "https://powerful-mountain-8361.herokuapp.com/piano/get"
ser = serial.Serial('/dev/ttyACM0', 9600)
# http://goo.gl/ZPjLOZ
notes = [131, 139, 147, 156, 165, 175, 185, 196, 207, 220, 233, 247, # small C-B
262, 277, 293, 311, 3... | deamoon/arduino_piano | sound.py | Python | mit | 760 |
# Python test set -- part 5, built-in exceptions
import copy
import os
import sys
import unittest
import pickle
import weakref
import errno
from test.support import (TESTFN, captured_stderr, check_impl_detail,
check_warnings, cpython_only, gc_collect, run_unittest,
... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/test/test_exceptions.py | Python | gpl-2.0 | 48,623 |
# -*- coding: utf-8 -*-
#
# Natural Language Toolkit: ClassifierBasedGermanTagger
#
# URL: <http://www.experimentallabor.de/>
#
# Copyright 2011 Philipp Nolte
#
# 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... | Dalphi/service-ner_iterate | lib/ClassifierBasedGermanTagger/ClassifierBasedGermanTagger.py | Python | apache-2.0 | 3,365 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | V155/qutebrowser | qutebrowser/browser/history.py | Python | gpl-3.0 | 13,712 |
import abc
class AddonNodeLogger(object):
"""Helper class for adding correctly-formatted addon logs to nodes.
:param Node node: The node to add logs to
:param Auth auth: Authorization of the person who did the action.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractproperty
def addon_short_n... | doublebits/osf.io | website/addons/base/logger.py | Python | apache-2.0 | 2,120 |
# coding=utf-8
import unittest
"""553. Optimal Division
https://leetcode.com/problems/optimal-division/description/
Given a list of **positive integers** , the adjacent integers will perform the
float division. For example, [2,3,4] -> 2 / 3 / 4.
However, you can add any number of parenthesis at any position to chang... | openqt/algorithms | leetcode/python/lc553-optimal-division.py | Python | gpl-3.0 | 1,460 |
import sys
import compileall
import importlib.util
import os
import pathlib
import py_compile
import shutil
import struct
import tempfile
import time
import unittest
import io
from unittest import mock, skipUnless
try:
from concurrent.futures import ProcessPoolExecutor
_have_multiprocessing = True
except Impor... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_compileall.py | Python | gpl-3.0 | 21,417 |
#!/usr/bin/env python2.7
# encoding: utf-8
'''
extract_id_title.py
Created by Hallvord R. M. Steen on 2014-10-25.
Modified by Karl
Mozilla Public License, version 2.0
see LICENSE
Dumps data from webcompat.com bug tracker
by default creates one CSV file (webcompatdata.csv)
and one JSON file (webcompatdata-bzlike.json)... | hallvors/mobilewebcompat | preproc/webcompat_data_exporter.py | Python | mpl-2.0 | 6,094 |
# A very crude plugin system that suits our needs.
# Copyright (C) 2010 Francis Markham
# 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) ... | thegooglecodearchive/geolocate-cli | plugins.py | Python | gpl-3.0 | 4,000 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2014 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | browseinfo/odoo_saas3_nicolas | openerp/workflow/instance.py | Python | agpl-3.0 | 5,575 |
from typing import TypeVar, Type, Dict, Union, List
import logging
import importlib
import inspect
import copy
from datapipelines import DataPipeline, DataSink, DataSource, CompositeDataTransformer, DataTransformer
from ..data import Region, Platform
T = TypeVar("T")
logging.basicConfig(format='%(asctime)s: %(messa... | 10se1ucgo/cassiopeia | cassiopeia/_configuration/settings.py | Python | mit | 12,349 |
#!/user/bin/env python
import telnetlib
import time
import socket
import sys
TELNET_PORT = 23
TELNET_TIMEOUT = 6
def send_command(remote_conn, cmd):
cmd = cmd.rstrip()
remote_conn.write(cmd + '\n')
time.sleep(1)
return remote_conn.read_very_eager()
def login(remote_conn, username, password):
ou... | hbenaouich/Learning-Python | class-2/test_telnet.py | Python | apache-2.0 | 1,188 |
from zerver.lib.test_classes import WebhookTestCase
class OpsGenieHookTests(WebhookTestCase):
STREAM_NAME = "opsgenie"
URL_TEMPLATE = "/api/v1/external/opsgenie?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "opsgenie"
def test_acknowledge_alert(self) -> None:
expected_topic = "Integr... | rht/zulip | zerver/webhooks/opsgenie/tests.py | Python | apache-2.0 | 7,350 |
class Solution(object):
def lengthOfLongestSubstringKDistinct(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
s_len = len(s)
if s_len <= k: return s_len
dic = {}
for i in range(k):
dic[s[i]] = dic.get(s[i], 0) + ... | YiqunPeng/Leetcode-pyq | solutions/340LongestSubstringWithAtMostKDistinctCharacters.py | Python | gpl-3.0 | 979 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.project_info.rules import dependencies, source_file_validator
from pants.backend.project_info.tasks.dependencies import Dependencies
from pants.backend.project_info.task... | wisechengyi/pants | src/python/pants/backend/project_info/register.py | Python | apache-2.0 | 1,050 |
import pytest
import maps
import __builtin__
from tendrl.commons.objects.node.atoms.cmd import Cmd
import mock
from tendrl.commons.utils.cmd_utils import UnsupportedCommandException,Command
from mock import patch
from tendrl.commons.objects import AtomExecutionFailedError
def run(*args):
return "out", "No_Error",... | rishubhjain/commons | tendrl/commons/tests/objects/node/atoms/cmd/test_cmd_init.py | Python | lgpl-2.1 | 1,287 |
#!/usr/bin/python -u
import database
import errno
import httplib
import os
import re
import rfc822
import socket
import SocketServer
import sslca
import sys
import tempfile
import threading
import urllib
import urlparse
import zlib
if sys.version_info >= (2, 7, 9):
import ssl
else:
import backports.ssl as ssl... | RedHatEMEA/webproxycache | cache.py | Python | gpl-3.0 | 14,161 |
from voter import *
from paillier import *
from candidate import *
from singleton import Singleton
from election_board import *
import random
@Singleton
class CountingAuthority():
"""docstring for ClassName"""
def __init__(self):
self.eb = ElectionBoard.Instance()
self.validVotes = []
def... | kelleyb/CryptoProject | counting_authority.py | Python | mit | 1,683 |
import pytest
from api.base.settings.defaults import API_BASE
from osf_tests.factories import (
ProjectFactory,
AuthUserFactory,
PrivateLinkFactory,
NodeFactory
)
from osf.utils import permissions
@pytest.fixture()
def user():
return AuthUserFactory()
@pytest.fixture()
def read_contrib():
r... | chennan47/osf.io | api_tests/nodes/views/test_node_view_only_links_detail.py | Python | apache-2.0 | 7,315 |
# -*- coding: utf-8 -*-
import dyconnmap
import numpy as np
import sklearn
if __name__ == "__main__":
rng = np.random.RandomState(seed=0)
data, _ = sklearn.datasets.make_moons(
n_samples=1024, noise=0.125, random_state=rng)
ng = dyconnmap.cluster.NeuralGas(rng=rng).fit(data)
encoding, symbo... | makism/dyfunconn | examples/cluster_ng.py | Python | bsd-3-clause | 361 |
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
import sqlite3
from invoices.models import InvoiceHeading
from accounts.models import UserProfile
from django.contrib.auth.models import User
class Command(BaseCommand):
"""
Create first user p... | denever/discipline_terra | invoices/management/commands/import_invoice_headings.py | Python | gpl-2.0 | 1,311 |
#!/usr/bin/python
# Puppet Wrapper to make sure it runs as expected
import subprocess
import logging
import logging.handlers
import os
import random
import time
import datetime
import argparse
import sys
import plistlib
import ConfigParser
run_lock_file = '/opt/puppetlabs/puppet/cache/state/agent_catalog_run.lock'
di... | grahamgilbert/puppet-puppet_run | files/puppet_run.py | Python | apache-2.0 | 6,660 |
#
# 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... | spektom/incubator-airflow | airflow/providers/microsoft/azure/hooks/azure_data_lake.py | Python | apache-2.0 | 7,112 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.data import logger
from lib.core.settings import IS_WIN
from lib.core.settings import PLATFORM
_readline = None
try:
from readline import *
import read... | V11/volcano | server/sqlmap/lib/core/readlineng.py | Python | mit | 1,850 |
import time
from scram_modules.dna import DNA
from termcolor import colored
class RefSeq(object):
"""
A class for reference sequences - stores header:seq pairs in a dictionary
{header:seq}
"""
def __init__(self):
self._internal_dict = {} # internal dictionary for class
def __setit... | Carroll-Lab/scram | scram_modules/refseq.py | Python | mit | 2,511 |
#
# (C) Copyright 2011 Jacek Konieczny <jajcus@jajcus.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful... | Jajcus/pyxmpp2 | pyxmpp2/interfaces.py | Python | lgpl-2.1 | 18,498 |
# Copyright 2017 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... | yanchen036/tensorflow | tensorflow/contrib/autograph/pyct/static_analysis/annos.py | Python | apache-2.0 | 2,179 |
# Generated by Django 2.2.5 on 2019-09-29 16:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0008_cloudinaryimage'),
]
operations = [
migrations.RemoveField(
model_name='homepagegalleryimage',
name='image',
... | ckcollab/tpaka | home/migrations/0009_auto_20190929_1604.py | Python | mit | 446 |
import glob
import os
from django.conf import settings
from django.utils.functional import cached_property
class Node(object):
def __init__(self, path, parent=None, count=1):
self.parent = parent
if self.parent:
self.id = parent.id * 100 + count
else:
self.id = co... | hirokazumiyaji/django-jsonlistviewer | viewer/apps/viewer/models.py | Python | mit | 1,032 |
#!python
#############################################################################
# cubit2specfem3d.py #
# this file is part of GEOCUBIT #
# #... | QuLogic/specfem3d | CUBIT_GEOCUBIT/geocubitlib/cubit2specfem3d.py | Python | gpl-2.0 | 50,447 |
#!/usr/bin/env python
"""
Copyright 2014 Novartis Institutes for Biomedical Research
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 ... | Novartis/yap | bin/yap_comparison.py | Python | apache-2.0 | 21,506 |
# coding: utf-8
#
# Copyright 2016 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... | himanshu-dixit/oppia | core/domain/classifier_registry.py | Python | apache-2.0 | 3,169 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.