text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""Command line interface for echo server."""
import fnmatch
import asyncio
import argparse
from aioconsole import AsynchronousCli, start_interactive_server
from aioconsole.server import parse_server, print_server
from . import echo
async def get_history(reader, writer, pattern=None):
history = asyncio.get_eve... | vxgmichel/aioconsole | example/cli.py | Python | gpl-3.0 | 2,320 | 0.000862 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2022 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | psi4/psi4 | psi4/driver/molutil.py | Python | lgpl-3.0 | 9,885 | 0.004856 |
#!/usr/bin/env python
#
# vector3 and rotation matrix classes
# This follows the conventions in the ArduPilot code,
# and is essentially a python version of the AP_Math library
#
# Andrew Tridgell, March 2012
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser... | owenson/ardupilot-sdk-python | pymavlink/rotmat.py | Python | lgpl-3.0 | 12,026 | 0.004906 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetInstance
# Retrieves information about the specified Instance.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may n... | jordanemedlock/psychtruths | temboo/core/Library/Google/ComputeEngine/Instances/GetInstance.py | Python | apache-2.0 | 5,317 | 0.005266 |
# -*- coding: utf-8 -*-
# crunchyfrog - a database schema browser and query tool
# Copyright (C) 2008 Andi Albrecht <albrecht.andi@gmail.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, e... | angvp/angelvelasquez-crunchyfrog | cf/config/__init__.py | Python | gpl-3.0 | 4,652 | 0.001505 |
#!/usr/bin/env python
from __future__ import print_function
import sys
import numpy
import pni.io.nx.h5 as nexus
f = nexus.create_file("test_string2.nxs",True);
d = f.root().create_group("scan_1","NXentry").\
create_group("detector","NXdetector")
sa= d.create_field("ListofStrings","string",shap... | pni-libraries/python-pni | doc/examples/old_examples/test_string2.py | Python | gpl-2.0 | 494 | 0.036437 |
"""Drafts as required folder
Revision ID: 41a7e825d108
Revises: 269247bc37d3
Create Date: 2014-03-13 21:14:25.652333
"""
# revision identifiers, used by Alembic.
revision = '41a7e825d108'
down_revision = '269247bc37d3'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('imapaccount', ... | nylas/sync-engine | migrations/versions/004_drafts_as_required_folder.py | Python | agpl-3.0 | 459 | 0.006536 |
#!/usr/bin/python
#
# Copyright 2008-2010 WebDriver committers
# Copyright 2008-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... | gx1997/chrome-loongson | third_party/webdriver/python/test/selenium/webdriver/firefox/test_ff_api.py | Python | bsd-3-clause | 1,189 | 0.001682 |
from application import app as application
from gevent import monkey
from socketio.server import SocketIOServer
monkey.patch_all()
if __name__ == '__main__':
# SocketIOServer(
# ('', application.config['PORT']),
# application,
# resource="socket.io").serve_forever()
socketio.run(appli... | PhoenixRacing/PhoenixRacingWebApp-noregrets | run_server.py | Python | bsd-3-clause | 327 | 0.003058 |
# browsershots.org - Test your web design in different browsers
# Copyright (C) 2007 Johann C. Rocholl <johann@browsershots.org>
#
# Browsershots 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 ... | foligny/browsershots-psycopg2 | shotserver/shotserver04/accounts/urls.py | Python | gpl-3.0 | 1,222 | 0.000818 |
from django.shortcuts import render, redirect, get_object_or_404
from django.core.urlresolvers import reverse
from openiv.settings import *
# Create your views here.
def index(request):
return redirect(reverse('public:event'))
# Comment the above to have an independent home page.
context = {
'imagesource': ... | amoschou/openiv | public/views.py | Python | mpl-2.0 | 3,942 | 0.011935 |
import neovim
# TODO figure out the python way to do these imports, this is probably wrong
import pygments
import pygments.lexers
import pygments.token
@neovim.plugin
class Neosyntax(object):
def __init__(self, nvim):
self.nvim = nvim
# swap src_ids. from brefdl: allocate two ids, and swap, a... | jebaum/neosyntax | rplugin/python3/neosyntax.py | Python | gpl-3.0 | 8,728 | 0.007218 |
import unittest
import logging
from harmoniccontext.harmonic_context import HarmonicContext
from harmoniccontext.harmonic_context_track import HarmonicContextTrack
from harmonicmodel.secondary_chord_template import SecondaryChordTemplate
from harmonicmodel.tertian_chord_template import TertianChordTemplate
from struc... | dpazel/music_rep | tests/transformation_tests/reflection_tests/test_t_chromatic_reflection.py | Python | mit | 7,963 | 0.003014 |
# generated from catkin/cmake/template/__init__.py.in
# keep symbol table as clean as possible by deleting all unnecessary symbols
from os import path as os_path
from sys import path as sys_path
from pkgutil import extend_path
__extended_path = "/home/rss-student/rss-2014-team-3/src/robotbrain/src".split(";")
for p ... | WeirdCoder/rss-2014-team-3 | devel/lib/python2.7/dist-packages/robotbrain/__init__.py | Python | mit | 1,010 | 0.00099 |
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
#
# 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, m... | twchad/Adafruit_Python_SSD1351 | Adafruit_SSD1351/SSD1351.py | Python | mit | 11,355 | 0.026244 |
# util.py
# -------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# Attri... | omardroubi/Artificial-Intelligence | Projects/Project4/bayesNets/util.py | Python | apache-2.0 | 25,733 | 0.014728 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | inovtec-solutions/OpenERP | openerp/addons/hr_attendance/__openerp__.py | Python | agpl-3.0 | 2,163 | 0.001849 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'replace_with_ref_dialog_ui.ui'
#
# Created: Fri Nov 18 22:58:33 2016
# by: pyside2-uic running on PySide2 2.0.0~alpha0
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui, QtWidgets
class Ui_Dia... | theetcher/fxpt | fxpt/fx_refsystem/replace_with_ref_dialog_ui2.py | Python | mit | 4,622 | 0.004976 |
# $Id: 201_codec_l16_16000.py 369517 2012-07-01 17:28:57Z file $
#
from inc_cfg import *
# Call with L16/16000/1 codec
test_param = TestParam(
"PESQ codec L16/16000/1 (RX side uses snd dev)",
[
InstanceParam("UA1", "--max-calls=1 --add-codec L16/16000/1 --clock-rate 16000 --play-file wavs/input.16.wav --null-au... | fluentstream/asterisk-p2p | res/pjproject/tests/pjsua/scripts-pesq/201_codec_l16_16000.py | Python | gpl-2.0 | 537 | 0.01676 |
# ==============================================================================
# Copyright 2019 - Philip Paquette
#
# NOTICE: 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 rest... | diplomacy/research | diplomacy_research/scripts/dataset/dataset_010_redis.py | Python | mit | 3,931 | 0.00407 |
#!/usr/bin/env python3
# vim: tw=76
import kxg
import random
import pyglet
LOWER_BOUND, UPPER_BOUND = 0, 5000
class World(kxg.World):
"""
Keep track of the secret number, the range of numbers that haven't been
eliminated yet, and the winner (if there is one).
"""
def __init__(self):
sup... | kxgames/kxg | demos/guess_my_number.py | Python | mit | 5,672 | 0.001587 |
from selenium_test_case import SeleniumTestCase
class DocsTest(SeleniumTestCase):
def test_links_between_pages(self):
self.open_path('/help')
self.assert_text_present('Frequently Asked Questions')
self.click_and_wait('link=Terms of Service')
self.assert_text_present('Terms of Serv... | Princessgladys/googleresourcefinder | tests/docs_test.py | Python | apache-2.0 | 2,824 | 0 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys, time, os, hashlib, atexit
import ftplib
import traceback
from PyQt5.QtWidgets import QApplication, QWidget, QFileDialog
from PyQt5.QtWidgets import QPushButton, QHBoxLayout, QVBoxLayout, \
QScrollArea, QLineEdit, QCheckBox, QMessageBox,... | lisitsky/one-button-ftp | pyftp1.py | Python | mit | 15,763 | 0.004916 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from collections import defaultdict
from enum import Enum
import logging
from pathlib import Path
import re
import sys
import warnings
try:
from collections import O... | hashamali/pyScss | scss/compiler.py | Python | mit | 59,822 | 0.000953 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/mt_isn/neighbors/neighbor/subTLVs/subTLVs_/adjacency_sid/sid/state/__init__.py | Python | apache-2.0 | 30,567 | 0.001374 |
import sys
import unittest
from django.conf import settings
from django.contrib.admindocs import utils, views
from django.contrib.admindocs.views import get_return_data_type, simplify_regex
from django.contrib.sites.models import Site
from django.db import models
from django.db.models import fields
from django.test im... | auready/django | tests/admin_docs/test_views.py | Python | bsd-3-clause | 14,791 | 0.003042 |
"""
RAR parser
Status: can only read higher-level attructures
Author: Christophe Gisquet
"""
from hachoir_parser import Parser
from hachoir_core.field import (StaticFieldSet, FieldSet,
Bit, Bits, Enum,
UInt8, UInt16, UInt32, UInt64,
String, TimeDateMSDOS32,
NullBytes, NullBits, RawBytes)
from hachoir_... | kreatorkodi/repository.torrentbr | plugin.video.yatp/site-packages/hachoir_parser/archive/rar.py | Python | gpl-2.0 | 14,384 | 0.005284 |
# -*- coding:utf-8 -*-
import copy
from zope.interface import implementer
from .interfaces import (
IExecutor,
ISchemaValidation,
IDataValidation,
ICreate,
IDelete,
IEdit
)
from alchemyjsonschema.dictify import (
normalize,
validate_all,
ErrorFound
)
from jsonschema import FormatChec... | podhmo/komet | komet/executors.py | Python | mit | 3,149 | 0.000318 |
# -*- coding: utf-8 -*-
# Copyright © 2014-2016 Digital Catapult and The Copyright Hub Foundation
# (together the Open Permissions Platform Coalition)
#
# 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 Found... | openpermissions/accounts-srv | accounts/controllers/roles_handler.py | Python | gpl-3.0 | 1,354 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-05 10:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0003_auto_20170705_0958'),
]
operations = [
migrations.RenameField(
... | BdEINSALyon/resa | account/migrations/0004_auto_20170705_1003.py | Python | gpl-3.0 | 620 | 0 |
import logging
import sys
from cliff.app import App
from cliff.commandmanager import CommandManager
# from .utils import ColorLogFormatter
from nicelog.formatters import ColorLineFormatter
class HarvesterApp(App):
logger = logging.getLogger(__name__)
def __init__(self):
super(HarvesterApp, self).__... | opendatatrentino/opendata-harvester | harvester/cli.py | Python | bsd-2-clause | 1,858 | 0 |
# -*- coding: utf-8 -*- vim:fileencoding=utf-8:
# vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
# Copyright © 2010-2012 Greek Research and Technology Network (GRNET S.A.)
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that th... | apoikos/servermon | hwdoc/vendor/dummy.py | Python | isc | 2,909 | 0.005846 |
hiddenimports = ['decimal']
| ryandoherty/RaceCapture_App | install/hooks/hook-autosportlabs.racecapture.views.configuration.rcp.scriptview.py | Python | gpl-3.0 | 28 | 0 |
#Problem 1:
#Python provides a built-in function called len that returns the length of a string
#so the value of len('allen') is 5.
#Write a function named right_justify that takes a string named s as a parameter and prints
#the string with enough leading spaces so that the last letter of the string is in column 70
#o... | hollylemos/think-python | chapter-03/3.py | Python | mit | 1,541 | 0.035042 |
import pytest
from punch import vcs_configuration as vc
@pytest.fixture
def global_variables():
return {
'serializer': '{{ major }}.{{ minor }}.{{ patch }}',
'mark': 'just a mark'
}
@pytest.fixture
def vcs_config_dict():
return {
'name': 'git',
'commit_message': "Version... | lgiordani/punch | tests/test_vcs_configuration.py | Python | isc | 7,655 | 0 |
from django.conf.urls.defaults import patterns # noqa
from django.conf.urls.defaults import url # noqa
from openstack_dashboard.dashboards.fogbow.usage import views
from openstack_dashboard.dashboards.fogbow.usage.views import IndexView
urlpatterns = patterns('',
url(r'^$', IndexView.as_view(), name='index'),
... | fogbow/fogbow-dashboard | openstack_dashboard/dashboards/fogbow/usage/urls.py | Python | apache-2.0 | 404 | 0.00495 |
from rest_framework import generics, permissions as drf_permissions
from rest_framework.exceptions import NotFound, ValidationError, PermissionDenied
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from api.base.exceptions import Gone
from api.base import permissions as base_permissions
from... | asanfilippo7/osf.io | api/comments/views.py | Python | apache-2.0 | 12,700 | 0.003622 |
from vsg.vhdlFile.extract import tokens
def get_n_token_after_tokens(iToken, lTokens, lAllTokens, oTokenMap):
lReturn = []
lIndexes = []
for oToken in lTokens:
lTemp = oTokenMap.get_token_indexes(oToken)
for iTemp in lTemp:
iTokenIndex = iTemp
for iCount in range(0... | jeremiah-c-leary/vhdl-style-guide | vsg/vhdlFile/extract/get_n_token_after_tokens.py | Python | gpl-3.0 | 688 | 0.001453 |
#!/usr/bin/env python3
number = 23
guess = int(input('Enter an integer : '))
if guess == number:
# 新块从这里开始
print('Congratulations, you guessed it.')
print('(but you do not win any pizzas!)')
# 新块在这里结束
elif guess < number:
# 另一代码块
print('No, it is a little higher than that')
# 你可以在此做任何你希望在该代码块内进行的事情
else:
prin... | pam-phy/python-notes | byte-of-python/if.py | Python | gpl-2.0 | 600 | 0.020833 |
import os
import re
from conans.model import Generator
from conans.paths import BUILD_INFO_VISUAL_STUDIO
from conans.client.tools.files import VALID_LIB_EXTENSIONS
class VisualStudioGenerator(Generator):
template = '''<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.micro... | conan-io/conan | conans/client/generators/visualstudio.py | Python | mit | 5,803 | 0.00224 |
import argparse
import github3
import toml
import json
import re
from . import utils
import logging
from threading import Thread, Lock
import time
import traceback
import sqlite3
import requests
from contextlib import contextmanager
from itertools import chain
from queue import Queue
import os
import subprocess
from .g... | barosl/homu | homu/main.py | Python | mit | 37,593 | 0.003937 |
__author__ = 'Fabrizio Lungo<fab@lungo.co.uk>'
import os
import yaml
from __exceptions__.FileNotFound import FileNotFound
from section import ConfigurationSection
class Configuration(ConfigurationSection):
def __init__(self, fn='config.yml', name=None, create=False):
self._fn = fn
self._create ... | flungo/python-yaml-config | lib/yamlconfig/config.py | Python | mit | 821 | 0.002436 |
class Solution(object):
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
xor = len(nums)
for i, n in enumerate(nums):
xor ^= n
xor ^= i
return xor
inputs = [
[0],
[1],
[3,0,1],
[9,6,4,2,3,5,7,0... | daicang/Leetcode-solutions | 268-missing-number.py | Python | mit | 388 | 0.028351 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2008 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## 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 Foundati... | andrebellafronte/stoq | stoqlib/gui/test/test_search.py | Python | gpl-2.0 | 12,901 | 0.001783 |
# -*- coding: utf-8 -*-
"""
Production settings file for project 'project'
"""
from project.settings import *
DEBUG = False
SITE_DOMAIN = 'sveetch.github.io/Sveetoy'
# Directory where all stuff will be builded
PUBLISH_DIR = os.path.join(PROJECT_DIR, '../docs')
# Path where will be moved all the static files, usually... | sveetch/Sveetoy | project/githubpages_settings.py | Python | mit | 428 | 0 |
from pudzu.charts import *
df = pd.read_csv("datasets/flagstriband.csv")
df = pd.concat([pd.DataFrame(df.colours.apply(list).tolist(), columns=list("TMB")), df], axis=1).set_index("colours")
FONT, SIZE = calibri, 24
fg, bg = "black", "#EEEEEE"
default_img = "https://s-media-cache-ak0.pinimg.com/736x/0d/36/e7/0d36e7a4... | Udzu/pudzu | dataviz/flagstriband.py | Python | mit | 3,039 | 0.014149 |
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2014 Thomas Perl and the gPodder Team
#
# gPodder 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... | somini/gpodder | src/gpodder/escapist_videos.py | Python | gpl-3.0 | 4,242 | 0.003772 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 The ProteinDF development team.
# see also AUTHORS and README if provided.
#
# This file is a part of the ProteinDF software package.
#
# The ProteinDF is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Publ... | ProteinDF/ProteinDF_bridge | proteindf_bridge/modeling.py | Python | gpl-3.0 | 24,765 | 0.000371 |
from django.test import TestCase
from django.contrib.gis.geos import (LineString, Polygon, MultiPolygon,
MultiLineString, MultiPoint, Point)
from django.core.exceptions import ValidationError
from django.conf import settings
from django.test.utils import override_settings
from unit... | GeotrekCE/Geotrek-admin | geotrek/trekking/tests/test_models.py | Python | bsd-2-clause | 21,282 | 0.001786 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-20 23:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('authentication', '0003_auto_20160620_2027'),
('feed'... | winstein27/social | social/feed/migrations/0006_post_author.py | Python | agpl-3.0 | 660 | 0.001515 |
import datetime
import decimal
from django.test import TestCase
from django.core.cache import cache
from httmock import HTTMock
from django_dynamic_fixture import G, N
from postnl_checkout.contrib.django_postnl_checkout.models import Order
from .base import PostNLTestMixin
class OrderTests(PostNLTestMixin, TestC... | dokterbob/python-postnl-checkout | tests/test_django.py | Python | agpl-3.0 | 13,320 | 0 |
# bibliography.py
r'''
Defines the BibItem() and Bibliography() classes (both sub-classed from Node)
The Bibliography() object is initialized directly from
a .bib file using the `bibtexparser` package.
We use registry.ClassFactory for unlisted fields
'''
import os
import logging
log = logging.getLogger(__name__)
i... | dimbyd/latextree | latextree/parser/bibliography.py | Python | mit | 6,260 | 0.005591 |
import yaml
header="""
<?xml version="1.0" encoding="UTF-8"?>
<MemInfo Version="1" Minor="0">
<Processor Endianness="Little" InstPath="design/cortex">
<AddressSpace
Name="design_1_i_microblaze_0.design_1_i_microblaze_0_local_memory_dlmb_bram_if_cntlr" Begin="0" End="8191">
<BusBloc... | rbarzic/arty-cm0-designstart | synt/yaml2mmi.py | Python | gpl-2.0 | 1,294 | 0.017002 |
import pytest
import salt.states.openvswitch_port as openvswitch_port
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {openvswitch_port: {"__opts__": {"test": False}}}
def test_present():
"""
Test to verify that the named port exists on bridge, even... | saltstack/salt | tests/pytests/unit/states/test_openvswitch_port.py | Python | apache-2.0 | 3,213 | 0.000934 |
# Handy for debugging setup.py
"""Utilities creating reusable, DRY, setup.py installation scripts
Typical usage in setup.py:
>>> global_env, local_env = {}, {}
>>> execfile(join('pug', 'setup_util.py'), global_env, local_env)
>>> get_variable = local_env['get_variable']
"""
import os
def s... | hobson/pug | pug/setup_util.py | Python | mit | 915 | 0.006557 |
# Copyright 2015-2017 Capital One Services, 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 agreed ... | taohungyang/cloud-custodian | c7n/output.py | Python | apache-2.0 | 9,658 | 0.000207 |
#!/usr/bin/env python
import sys
urllib_urlretrieve = None
try:
# Python 3.x or later
import urllib.request
urllib_urlretrieve = urllib.request.urlretrieve
except ImportError:
# Python 2.x
import urllib
urllib_urlretrieve = urllib.urlretrieve
def download(url, target_path):
urllib_urlre... | knimon-software/ffos-meets-closure | tools/sub/download.py | Python | mit | 567 | 0 |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox(capabilities={"marionette": Fa... | schukinp/python_training | fixture/application.py | Python | apache-2.0 | 1,091 | 0.003666 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | openstack/nova | nova/api/openstack/compute/keypairs.py | Python | apache-2.0 | 9,891 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 dl1ksv.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
from gnuradio import gr, gr_unittest
from PyQt5 import Qt
import sip
# from gnuradio import blocks
try:
from display import text_msg
except ImportError:
import os
import sys
dirname,... | dl1ksv/gr-display | python/qa_display_text_msg.py | Python | gpl-3.0 | 951 | 0.005258 |
import os
import unittest
import tempfile
import shutil
from mock import MagicMock, Mock
from catkin_pkg.package_templates import _safe_write_files, create_package_files, \
create_cmakelists, create_package_xml, PackageTemplate, _create_include_macro, \
_create_targetlib_args
from catkin_pkg.package import pa... | ipa-mdl/catkin_pkg | test/test_templates.py | Python | bsd-3-clause | 14,395 | 0.001389 |
#!/usr/bin/env python
# encoding: utf-8
import glob
import os
import subprocess
'''
Convert 23andMe files to
PLINK format
'''
def twenty3_and_me_files():
"""Return the opensnp files that are 23 and me format"""
all_twenty3_and_me_files= glob.glob('../opensnp_datadump.current/*.23andme.txt')
fifteen_mb = 15 * 100... | ciyer/opensnp-fun | run_plink_reformat.py | Python | mit | 886 | 0.023702 |
# -*- coding: utf-8 -*-
"""
Contains data that initially get added to the database to bootstrap it.
"""
from __future__ import unicode_literals
# pylint: disable=invalid-name
prophet_muhammad = {
'title': u'Prophet',
'display_name': u'النبي محمد (صلى الله عليه وآله وسلم)'.strip(),
'full_name': u'محمد بن... | hadithhouse/hadithhouse | hadiths/initial_data.py | Python | mit | 5,391 | 0.000518 |
class Solution(object):
def checkPossibility(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
n = len(nums)
t = 0
for i in xrange(n-1):
if nums[i] > nums[i+1]:
if i-1 < 0 or i+2 > n-1:
t += 1
... | daohu527/leetcode_learning | 665. Non-decreasing Array/code.py | Python | gpl-3.0 | 554 | 0.001805 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from abc import ABCMeta, abstractmethod
from pathlib import PurePath
from textwrap import dedent
from typing import List, Tuple, Type
from unittest.mock import Mock
import pytest
from pa... | wisechengyi/pants | src/python/pants/rules/core/test_test.py | Python | apache-2.0 | 8,678 | 0.001498 |
#!/usr/bin/env python2.7
import logging
import numpy as np
from .analysis import Analysis
class HopCountAnalysis(Analysis):
def __init__(self, scenario, location, repetitions, csv):
Analysis.__init__(self, scenario, location, "hopCount", repetitions, csv)
self.logger = logging.getLogger('baltimo... | mfrey/baltimore | analysis/hopcountanalysis.py | Python | gpl-3.0 | 3,831 | 0.006004 |
#!env python
# Copyright 2008 Simon Edwards <simon@simonzone.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 option) any later version.
... | KDE/twine2 | kbindinggenerator/cmake.py | Python | lgpl-3.0 | 15,357 | 0.004428 |
import os
import re
import cmd
import sys
import time
import util
host = sys.argv[1]
cmd.run ("virsh shutdown %s"%(host))
while util.vm_is_running(host):
time.sleep(1)
| alobbs/qvm | qvm/qvm-stop.py | Python | apache-2.0 | 171 | 0.017544 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# 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 Licens... | hryamzik/ansible | lib/ansible/modules/network/cnos/cnos_factory.py | Python | gpl-3.0 | 5,299 | 0.00434 |
import os
import unittest
from conans.client.cache.cache import CONAN_CONF
from conans.client.conf import ConanClientConfigParser
from conans.paths import DEFAULT_PROFILE_NAME
from conans.test.utils.test_files import temp_folder
from conans.util.files import save
default_client_conf = '''[storage]
path: ~/.conan/data... | memsharded/conan | conans/test/unittests/util/client_conf_test.py | Python | mit | 1,569 | 0.001275 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, filter_strip_join
from frappe.website.website_generator import WebsiteGenerator
from frappe.contacts.addres... | vishdha/erpnext | erpnext/setup/doctype/sales_partner/sales_partner.py | Python | gpl-3.0 | 1,584 | 0.024621 |
#!/usr/bin/python
# This file is part of P4wnP1.
#
# Copyright (c) 2017, Marcus Mengs.
#
# P4wnP1 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 ... | mame82/P4wnP1 | hidtools/hidsrv9.py | Python | gpl-3.0 | 10,097 | 0.029712 |
import datetime
from dateutil.tz import tzoffset
from decimal import Decimal
from django.db import models
from django.contrib.auth.models import User
from django.test import TestCase
from django.http import HttpRequest
from tastypie.bundle import Bundle
from tastypie.exceptions import ApiFieldError, NotFound
from tas... | ocadotechnology/django-tastypie | tests/core/tests/fields.py | Python | bsd-3-clause | 56,800 | 0.001268 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.gis.geos import geometry
from PIL import Image
from PIL.ExifTags import TAGS
from ..util import point_from_exif
class Migration(DataMigr... | dschep/django-photomap | photomap/migrations/0004_copy_exif_data_to_model.py | Python | mit | 1,128 | 0.003546 |
#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 use thi... | ZhangXFeng/hadoop | src/hadoop-mapreduce1-project/src/contrib/hod/hodlib/AllocationManagers/goldAllocationManager.py | Python | apache-2.0 | 4,244 | 0.013431 |
"""Tests for two-process terminal frontend
Currently only has the most simple test possible, starting a console and running
a single command.
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Imports
#--------------------------------------------------------------... | noslenfa/tdjangorest | uw/lib/python2.7/site-packages/IPython/terminal/console/tests/test_console.py | Python | apache-2.0 | 1,726 | 0.006952 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api_v3/models/work_title_v30_rc2.py | Python | mit | 4,930 | 0.000203 |
# Copyright 2021 Alfredo de la Fuente - Avanzosc S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
from odoo.tests import tagged
@tagged("post_install", "-at_install")
class TestNameCodeYearId(common.SavepointCase):
@classmethod
def setUpClass(cls):
sup... | avanzosc/odoo-addons | event_name_code_year_id/tests/test_event_name_code_year_id.py | Python | agpl-3.0 | 1,353 | 0 |
import traceback
from sqlalchemy import Column, Boolean, Integer, String, ForeignKey, create_engine
from sqlalchemy.orm import relationship, sessionmaker, scoped_session
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
engine = create_engine('sqlite:///bag_of_holding.db')
Base.metadata... | gradiuscypher/internet_illithid | bag_of_holding/libs/user_manager.py | Python | mit | 2,633 | 0.001899 |
def get_encrypted_char(k, ascii_val, ascii_list, limit):
diff = k % 26
rotate_val = ascii_val + diff
encrypted_char = ''
if rotate_val not in ascii_list:
rotate_val -= limit
for i in ascii_list:
rotate_val -= 1
if rotate_val == 0:
encrypted_char +=... | spradeepv/dive-into-python | hackerrank/domain/algorithms/implementation/caesar_cipher/solution.py | Python | mit | 1,399 | 0.002144 |
# -*- coding: utf-8 -*-
# © 2015 Compassion CH (Nicolas Tran)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
class AccountPaymentOrder(models.Model):
_inherit = 'account.payment.order'
@api.multi
def open2generated(self):
"""
Replace act... | CompassionCH/l10n-switzerland | l10n_ch_fds_upload_sepa/models/account_payment_order.py | Python | agpl-3.0 | 1,096 | 0 |
from flask import Blueprint, render_template, redirect, url_for
from flask_blog.extensions import mongo
from flask_blog.helpers import convertToObj
from flask.ext.login import login_required, current_user
from forms import PostsForm
posts = Blueprint('posts', __name__, template_folder='templates',
st... | sboily/flask-blog | flask_blog/plugins/posts/views.py | Python | gpl-3.0 | 1,743 | 0.003442 |
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of Logilab-Common.
#
# Logilab-Common is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as publ... | esparta/logilab_common3 | test/unittest_registry.py | Python | gpl-2.0 | 6,824 | 0.001465 |
# /usr/bin/env python
import os
# Context manager
class cd:
"""
Context manager for safely changing the current working directory
"""
def __init__(self, newPath):
self.newPath = os.path.expanduser(newPath)
def __enter__(self):
self.savedPath = os.getcwd()
os.chdir(self.newPath)
def __exit__(self, etype, ... | JohnGiorgi/SRA-RNAseq-Workflow | SRA_RNAseq_Workflow/helpers.py | Python | gpl-3.0 | 366 | 0.030055 |
# -*- coding: utf-8 -*-
"""
Emotiv acquisition :
Reverse engineering and original crack code written by
Cody Brocious (http://github.com/daeken)
Kyle Machulis (http://github.com/qdot)
Many thanks for their contribution.
Need python-crypto.
"""
import multiprocessing as mp
import numpy as np
import msgpack... | Hemisphere-Project/Telemir-DatabitMe | Telemir-EEG/pyacq/pyacq/core/devices/emotiv.py | Python | gpl-2.0 | 12,623 | 0.01323 |
import json
import pathlib
import re
import pytest
import snafu.versions
version_paths = list(snafu.versions.VERSIONS_DIR_PATH.iterdir())
version_names = [p.stem for p in version_paths]
@pytest.mark.parametrize('path', version_paths, ids=version_names)
def test_version_definitions(path):
assert path.suffix ==... | uranusjr/snafu | tests/test_versions.py | Python | isc | 4,596 | 0 |
import json
from os.path import join, dirname
from jsonschema import validate
SCHEMA_FILE = "normandy-schema.json"
def assert_valid_schema(data):
schema = _load_json_schema()
return validate(data, schema)
def _load_json_schema():
relative_path = join("schemas", SCHEMA_FILE)
absolute_p... | mozilla/normandy | contract-tests/v3_api/support/assertions.py | Python | mpl-2.0 | 461 | 0 |
# Copyright 2016 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... | tensorflow/addons | tensorflow_addons/seq2seq/decoder.py | Python | apache-2.0 | 23,035 | 0.000781 |
# author : Etienne THIERY
from matgen import *
import random
import numpy
def test_symmetricPositiveDefinite():
for i in range(10):
print(".", end="", flush=True)
size = random.randint(400, 500)
maxVal = random.randint(0, 1000)
M = symmetricPositiveDefinite(size, maxVal)
if... | ethiery/heat-solver | trunk/test_matgen.py | Python | mit | 1,289 | 0.006206 |
# -*- coding: utf-8 -*-
#
# HelixMC documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 21 15:51:36 2013.
#
# 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.
#
# A... | fcchou/HelixMC | doc/source/conf.py | Python | gpl-3.0 | 8,069 | 0.005453 |
from syzoj.models import JudgeState
from syzoj import db
db.create_all()
all_judge = JudgeState.query.all()
for item in all_judge:
item.update_userac_info()
| cdcq/jzyzj | syzoj/update_assistant/misc.py | Python | mit | 163 | 0 |
import subprocess as Subprocess
import pymel.all as pm
class CapsDisabler(object):
def __init__(self, parentRef, go=False):
self.parentRef = parentRef
self.ini = self.parentRef.ini
self.conf = self.ini.conf
self.enabled = False
self.autohotkeyProcess = Non... | joetainment/mmmmtools | MmmmToolsMod/Dynamic/CapsDisabler.py | Python | gpl-3.0 | 2,060 | 0.019417 |
from yowsup.structs import ProtocolEntity, ProtocolTreeNode
class IqProtocolEntity(ProtocolEntity):
'''
<iq type="{{get | set}}" id="{{id}}" xmlns="{{xmlns}}" to="{{TO}}" from="{{FROM}}">
</iq>
'''
TYPE_SET = "set"
TYPE_GET = "get"
TYPE_ERROR = "error"
TYPE_RESULT = "result"
TYPE_D... | AragurDEV/yowsup | yowsup/layers/protocol_iq/protocolentities/iq.py | Python | gpl-3.0 | 2,304 | 0.010417 |
import unittest
from tito.buildparser import BuildTargetParser
from ConfigParser import ConfigParser
from tito.exception import TitoException
class BuildTargetParserTests(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.valid_branches = ["branch1", "branch2"]
self... | domcleal/tito | test/unit/test_build_target_parser.py | Python | gpl-2.0 | 3,872 | 0.000517 |
from django.forms.formsets import BaseFormSet, formset_factory
from django.forms.models import BaseModelFormSet
from django.forms.models import modelformset_factory
from django import forms
from models import PlanillaHistoricas, ConceptosFolios, Folios, Tomos
class PlanillaHistoricasForm(forms.Form):
codi_empl_pe... | heraldmatias/django-payroll | src/inei/planilla/forms.py | Python | gpl-3.0 | 3,110 | 0.006431 |
"""
Virtualization test - Virtual disk related utility functions
:copyright: Red Hat Inc.
"""
import os
import glob
import shutil
import stat
import tempfile
import logging
import re
try:
import configparser as ConfigParser
except ImportError:
import ConfigParser
from avocado.core import exceptions
from avoca... | lmr/avocado-vt | virttest/utils_disk.py | Python | gpl-2.0 | 21,332 | 0.000281 |
from injector import Module
from cassandra.cqlengine import connection
from cassandra.cluster import Cluster
from cassandra.cqlengine.management import create_keyspace_simple, sync_table, sync_type
from cassandra.cqlengine.usertype import UserType
from ...entities.track_type import TrackType
from cassandra_users_reposi... | jacekdalkowski/bike-timer | web-api/biketimerwebapi/db/repositories/cassandra/cassandra_repositories_module.py | Python | apache-2.0 | 1,685 | 0.005935 |
import sys, math
# **************** Main program *********************************************
def main():
# File IO ###############################################
txt = open("in9.txt", 'r')
N = int (txt.readline())
n = 2 * N
a = [[0 for x in range(1)] for y in range(n)]
... | dannyp11/gossip_network | main_v2.py | Python | gpl-2.0 | 4,267 | 0.023904 |
import time
import sublime
import sublime_plugin
ST3 = int(sublime.version()) >= 3000
if ST3:
from .view_collection import ViewCollection
from .git_gutter_popup import show_diff_popup
else:
from view_collection import ViewCollection
from git_gutter_popup import show_diff_popup
def async_event_listen... | natecavanaugh/GitGutter | git_gutter_events.py | Python | mit | 3,715 | 0.000538 |
# Copyright (c) 2016 Cisco Systems
# 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 require... | noironetworks/aci-integration-module | aim/tools/cli/commands/config.py | Python | apache-2.0 | 1,450 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.