code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... | mikehulluk/morphforge | src/morphforgecontrib/traces/taggers.py | Python | bsd-2-clause | 2,064 |
import os
import json
# Relative path-names of json text files containing standard schemas
OSF_META_SCHEMA_FILES = [
'osf-open-ended-2.json',
'osf-open-ended-3.json',
'osf-standard-2.json',
'brandt-prereg-2.json',
'brandt-postcomp-2.json',
'character-lab-fully-powered-study.json',
'characte... | CenterForOpenScience/osf.io | website/project/metadata/schemas.py | Python | apache-2.0 | 2,920 |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | marmyshev/item_title | openlp/plugins/songs/forms/songmaintenancedialog.py | Python | gpl-2.0 | 10,254 |
"""examples for usage of F-test on linear restrictions in OLS
linear restriction is R \beta = 0
R is (nr,nk), beta is (nk,1) (in matrix notation)
TODO: clean this up for readability and explain
Notes
-----
This example was written mostly for cross-checks and refactoring.
"""
import numpy as np
import numpy.testing... | matthew-brett/draft-statsmodels | scikits/statsmodels/examples/example_ols_tftest.py | Python | bsd-3-clause | 5,886 |
"""Step implementations for the data model feature."""
import hashlib
from asserts import assert_equal, assert_true
from behave import then, when
def md5_hash(string: str) -> str:
"""Return a md5 hash of the string."""
return hashlib.md5(string.encode("utf-8")).hexdigest() # nosec, Not used for cryptograph... | ICTU/quality-time | tests/feature_tests/steps/data_model.py | Python | apache-2.0 | 1,343 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-17 15:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_t... | zerolab/wagtail | wagtail/tests/testapp/migrations/0023_formpagewithredirect_redirectformfield.py | Python | bsd-3-clause | 3,180 |
"""
The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order,
but it also has a rather interesting sub-string divisibility property.
Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we note the following:
- d2 d3 d4 = 406 is divisible... | pgrm/project-euler | 0001-0050/43-Sub-string_divisibility.py | Python | apache-2.0 | 1,107 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
import numpy as np
from pymatgen import Lattice, Structure
from pymatgen.transformations.site_transformations import \
InsertSitesTransformation, TranslateSitesTransformation, \
Repla... | mbkumar/pymatgen | pymatgen/transformations/tests/test_site_transformations.py | Python | mit | 11,139 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | tobegit3hub/keystone_docker | keystone/tests/unit/test_v3_federation.py | Python | apache-2.0 | 139,181 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Utilidades para detectar vídeos de los diferentes conectores
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
#LvX Edited Patched
im... | dentaku65/plugin.video.sod | servers/servertools.py | Python | gpl-3.0 | 18,567 |
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# imports - standard imports
import gzip
import json
import os
import shlex
import subprocess
import sys
import unittest
import glob
# imports - module imports
import frappe
import frappe.recorder
from frappe.installer import add_to_installed_apps
f... | saurabh6790/frappe | frappe/tests/test_commands.py | Python | mit | 14,384 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | jax2tex/jax2tex.py | Python | apache-2.0 | 30,661 |
#!/usr/bin/env python
# coding=utf-8
# Contributor:
# Phus Lu <phus.lu@gmail.com>
__version__ = '2.0.2'
__password__ = ''
import sys, os, re, time, struct, zlib, binascii, logging, httplib, urlparse, base64, wsgiref.headers
try:
from google.appengine.api import urlfetch
from google.appengine.runti... | agassiyzh/GoAgentX | Resources/goagent-server/python/wsgi.py | Python | bsd-2-clause | 20,119 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
import sys
import versioneer
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
version = versioneer.get_version()
if sys.platform.startswith('win') or sys.platform == 'cygwin':
... | insilichem/pychimera | setup.py | Python | lgpl-3.0 | 1,366 |
#! /usr/bin/python3
"""Based on pyethereum <https://github.com/ethereum/pyethereum>."""
from counterpartylib.lib import util
from counterpartylib.lib import config
from counterpartylib.lib import log
from counterpartylib.lib.messages.scriptlib import rlp
from counterpartylib.lib.messages.scriptlib import utils
impor... | tokenly/counterparty-lib | counterpartylib/lib/messages/scriptlib/blocks.py | Python | mit | 7,166 |
COUNTER_NOTIFY = 1000
XMLRPC_POST_DATA = """
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>wp.getUsersBlogs</methodName>
<params>
<param>
<value>{USERNAME}</value>
</param>
<param>
<value>{PASSWORD}</value>
</param>
</params>
</... | getyourbots/wordpressbruteforcer | config.py | Python | gpl-3.0 | 8,874 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the branch listing query optimiser."""
__metaclass__ = type
from storm.store import Store
from zope.component import getUtility
from lp.app.interfaces.launchpad imp... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py | Python | agpl-3.0 | 6,535 |
#File
fname = '5D-HexOpt2i.gcode'
f=open(fname,'w')
#Laser Parameters
laserPower = 10 #% max power
dwellTime = 2 #ms
x_start = 389
y_start = 329
z_start = 110.4 #mm above home
pauseTime = 500 #ms; time paused after movement before ablation
feedRate = 500 #movement speed
# Rect... | Team02-TeamGuinness/BIOE421_RoboHand | ablation-GUI/CONFIG/2014-October-20/07-13-30 PM 5D-HexOpt2i-CONFIG.py | Python | gpl-2.0 | 574 |
import os
from django.test import TransactionTestCase
from django.contrib.auth.models import Group
from hs_core import hydroshare
from hs_core.testing import MockIRODSTestCaseMixin, TestCaseCommonUtilities
class TestResourceFileFolderOprsAPI(MockIRODSTestCaseMixin,
TestCaseCommon... | ResearchSoftwareInstitute/MyHPOM | hs_core/tests/api/native/test_resource_file_folder_operations.py | Python | bsd-3-clause | 2,908 |
#!/usr/bin/env python
"""
Pazookle Audio Programming Language
Copyright (C) 2013 Bob Harris. All rights reserved.
This file is part of Pazookle.
Pazookle 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,... | zacko-belsch/pazookle | pazookle/util.py | Python | gpl-3.0 | 1,412 |
"""The tests for the Rfxtrx component."""
# pylint: disable=protected-access
import time
import unittest
import pytest
from homeassistant.components import rfxtrx
from homeassistant.core import callback
from homeassistant.setup import setup_component
from tests.common import get_test_home_assistant
@pytest.mark.sk... | nkgilley/home-assistant | tests/components/rfxtrx/test_init.py | Python | apache-2.0 | 6,172 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_recommended_sensitivity_labels_operations.py | Python | mit | 4,885 |
import struct
from binascii import hexlify
from types import MethodType
from serial import SerialTimeoutException
from umodbus import log
from umodbus.route import Map
from umodbus.server import route
from umodbus.functions import create_function_from_request_pdu
from umodbus.exceptions import ModbusError, ServerDevic... | AdvancedClimateSystems/python-modbus | umodbus/server/serial/__init__.py | Python | mpl-2.0 | 4,660 |
#!/usr/bin/env python
# coding=utf-8
from trigger import Trigger
from process_website import Website
from post_process import post_proc
from urls import url_manage
import time
from pyspark import SparkConf, SparkContext
slot = 10
def process(start_url):
u = url_manage(start_url)
w = Website()
process_... | whiteablum/crawler | src/main.py | Python | gpl-3.0 | 1,008 |
"""
Module to access home-automation devices
"""
# This module is part of the FritzConnection package.
# https://github.com/kbr/fritzconnection
# License: MIT (https://opensource.org/licenses/MIT)
# Author: Klaus Bremer
import itertools
from warnings import warn
from .fritzbase import AbstractLibraryBase
SERVICE =... | kbr/fritzconnection | fritzconnection/lib/fritzhomeauto.py | Python | mit | 3,231 |
from ..logging import logger # noqa
from ..utils import g_get
from ..models import (
db, current_user, common_friends_between, current_user_id,
User as UserModel, connections, ConnectionType
)
from graphene import relay, types
from graphene_sqlalchemy import SQLAlchemyObjectType
from promise import Promise
fro... | ivanchoo/demo-friends-management | server/app/graphql/users.py | Python | mit | 6,815 |
# -*- coding: utf-8 -*-
import requests
import scrapy
from bs4 import BeautifulSoup
from scrapinghub import ScrapinghubClient
class JavcodeSpider(scrapy.Spider):
name = 'javcode'
start_urls = []
filterlist = []
def __init__(self):
baseurl = BeautifulSoup(requests.get('http://www.javlib.com/')... | jiangtianyu2009/PiSoftCake | thzspider/spiders/javcode.py | Python | mit | 2,220 |
# coding: utf-8
"""
CEC - Crawler
~~~~~
Mini crawler para extrair informações da página de busca do site CEC.
Uso:
python crawler.py <parametro de busca>
Exemplo:
python crawler.py tijolo
:copyright: (c) 2014 by Lucas Magnum.
"""
import logging
import os
import re
import sq... | LucasMagnum/cec_crawler | crawler.py | Python | mit | 4,859 |
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
from rest_framework.settings import APISettings
USER_SETTINGS = getattr(settings, 'JWT_GRAPHENE', None)
DEFAULTS = {
'JWT_GRAPHENE_USER_ONLY_FIELDS': None,
'JWT_GRAPHENE_USER_EXCLUDE_FIELDS': None,
}
IMPORT_STRINGS = (
... | SillyFreak/django-graphene-jwt | graphene_jwt/settings.py | Python | agpl-3.0 | 629 |
#!/usr/bin/python3
import sys
def process_import(filename, statement):
statement = statement.replace(",", " ")
modules = statement.split()
for module in modules[1:]:
print('"%s" -> "%s"' % (filename, module))
def process_from(filename, statement):
statement = statement.replace(",", " ")
m... | WeCase/WeCase | utils/depgraph.py | Python | gpl-3.0 | 898 |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
from oucfeed.crawler import util
from oucfeed.crawler.newsspider import NewsSpider
class Spider(NewsSpider):
"""职业技术师范学院
这个网站的列表页有两种,还好基本能用同一组XPath提取
内容页中看似分类的东西不会变化,不能用
"""
name = "院系/职业... | D6C92FE5/oucfeed.crawler | oucfeed/crawler/spiders/yuanxi_zhi_ye.py | Python | mit | 1,481 |
import re
import string
import math
from operator import itemgetter
from itertools import groupby
import itertools
import operator
import foofah_utils
COST_DELETE_EXISTING_CELL = 1
COST_DELETE_CELL = 1
COST_DELETE_EMPTY = 1
COST_ADD_EMPTY = 1
COST_MOVE_EMPTY = 1
COST_MOVE_CELL = 1
COST_SPLIT = 1
COST_MERGE = 1
COST_... | umich-dbgroup/foofah | foofah_libs/foofah_table_graph.py | Python | mit | 28,226 |
# Copyright (C) 2011 Daniele Simonetti
#
# 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 dist... | tectronics/l5rcm | models/spellmodel.py | Python | gpl-3.0 | 6,086 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-11 21:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Contro... | dcalacci/Interactive_estimation | game/control/migrations/0001_initial.py | Python | mit | 492 |
#pylint: disable=C0103,R0903
from ansi.colour.base import Graphic
# ECMA-048 standard names
reset = Graphic('0')
bold = Graphic('1')
faint = Graphic('2')
italic = Graphic('3')
underline = Graphic('4')
blink_slow = Graphic('5')
blink = Graphic('6')
n... | tehmaze/ansi | ansi/colour/fx.py | Python | mit | 1,434 |
# 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleinterns/cl_analysis | model/train_baseline.py | Python | apache-2.0 | 3,174 |
# Copyright (c) 2014 . All rights reserved.
# Use of this source code is governed by the APACHE 2.0 license that can be
# found in the LICENSE file.
# Author: Frederick Lefebre <frederick.lefebvre@calculquebec.ca>
from __future__ import division
import os.path
from lustre import lustre
from lustre_mds_stats import lu... | calculquebec/python-lustre-utils | lustre_util/lustre_mds.py | Python | apache-2.0 | 2,064 |
# -*- coding: utf-8 -*-
import warnings
"""
Django settings for refugeedata project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject... | ukch/refugeedata | refugeedata/app/settings.py | Python | mit | 6,497 |
from typing import List, Optional, Sequence, Union
from decksite.data import achievements, deck, preaggregation, query
from decksite.data.models.person import Person
from decksite.database import db
from shared import dtutil, guarantee, logger
from shared.container import Container
from shared.database import sqlescap... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | decksite/data/person.py | Python | gpl-3.0 | 17,080 |
#!/usr/bin/env python3
# ******************************************************************************
# $Id: gcps2wld.py 124baa7f71f15396a661014a81b6c5b0c82c8004 2020-10-14 17:29:39 +0300 Idan Miara $
#
# Name: gcps2wld
# Project: GDAL Python Interface
# Purpose: Translate the set of GCPs on a file into fir... | grueni75/GeoDiscoverer | Source/Platform/Target/Android/core/src/main/jni/gdal-3.2.1/swig/python/osgeo/utils/gcps2wld.py | Python | gpl-3.0 | 2,675 |
"""
Manage IAM users, groups, roles, and policies
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os, sys, argparse, collections, random, string
from . import config, logger
from .ls import register_parser, register_listing_parser
from .util import Timestamp, paginate, h... | wholebiome/aegea | aegea/iam.py | Python | apache-2.0 | 5,108 |
# Make the plugin directory a python package
| timroes/ApplePy | plugins/__init__.py | Python | mit | 45 |
"""
================
:mod:`variators`
================
.. Copyright 2012 Aaron Garrett
.. 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... | aarongarrett/inspyred | inspyred/ec/variators/variators.py | Python | mit | 1,660 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para seriehd - based on guardaserie channel
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand.
# ------------------------------------------------------------
import re
import sys
import u... | orione7/Italorione | channels/seriehd.py | Python | gpl-3.0 | 10,110 |
#!/usr/bin/env python
##
## See COPYING file distributed along with the ncanda-data-integration package
## for the copyright and license terms
##
"""
Generate a plot of the SNR across NCANDA sites.
"""
__author__ = "Nolan Nichols"
import os
import glob
import dateutil
import pandas as pd
import lxml.etree as etree... | nicholsn/ncanda-data-integration | scripts/reporting/generate_adni_phantom_plots.py | Python | bsd-3-clause | 2,042 |
#!/usr/bin/env python2
import os,re,sys,json,yaml
from StringIO import StringIO
from Tools.pretty import prettyPrint
from Tools.argue import Argue
args = Argue()
@args.argument(short='v', flag=True)
def verbose():
return False
#_______________________________________________________________
@args.command(name... | eddo888/Tools | test/Propertly.py | Python | mit | 4,414 |
"""Helpful utilities for building analysis pipelines.
"""
import glob
import gzip
import os
import tempfile
import time
import shutil
import contextlib
import itertools
import functools
import random
import fnmatch
import subprocess
import sys
import types
import six
import toolz as tz
import yaml
from collections im... | vladsaveliev/bcbio-nextgen | bcbio/utils.py | Python | mit | 32,939 |
#!/usr/bin/env python
"""
crate_anon/linkage/bulk_hash.py
===============================================================================
Copyright (C) 2015-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CRATE.
CRATE is free software: you can redistribute it and/or modify
it under th... | RudolfCardinal/crate | crate_anon/linkage/bulk_hash.py | Python | gpl-3.0 | 6,042 |
# HAppy
import sys
import logging
from optparse import OptionParser
logger = logging.getLogger(__name__)
SUB_COMMANDS = [
'daemon',
'takeover',
'release',
'status',
]
def parse_args(argv):
if len(argv) > 0 and argv[0] in SUB_COMMANDS:
subcommand = argv.pop(0)
... | adregner/HAppy | happy/shell.py | Python | mit | 1,151 |
from netforce.template import register_helper
from urllib.parse import urlencode
from netforce.model import get_model
def ecom_products_url(this, categ_id=None, brand_id=None, supp_id=None, price=None, sort_by=None):
#toggle_brand_id = brand_id
categ_id=categ_id or this.data.get("categ_id")
#brand_id=brand... | sidzan/netforce | netforce_ecom/netforce_ecom/controllers/ecom_helpers.py | Python | mit | 1,920 |
#!/usr/bin/env python
############################################################################
# prepare.py
# Copyright (C) 2015 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/... | cdynak/linphone-iphone | prepare.py | Python | gpl-2.0 | 14,524 |
# -*- coding: utf-8 -*-
"""Tests for the Item model"""
import unittest
import sys
import os
from os.path import join, abspath, dirname
parentpath = abspath(join(dirname(__file__), '../../..'))
sys.path.append(parentpath)
from blibbapi.db import get_engine, init_db, get_db_session, Base
from blibbapi.models.blibb imp... | ipedrazas/blibb-project | blibbapi/tests/models/test_item.py | Python | apache-2.0 | 1,623 |
"""Constants for colorful console output."""
import sys
if sys.stdout.isatty():
RED = '\033[91m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
BLUE = '\033[94m'
PURPLE = '\033[95m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
else:
RED = ''
GREEN = ''
YELLOW = ''
B... | trueaccord/DogPush | dogpush/bcolors.py | Python | apache-2.0 | 449 |
# BEGIN_COPYRIGHT
#
# Copyright 2009-2015 CRS4.
#
# 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 agree... | kikkomep/pydoop | pydoop/mapreduce/string_utils.py | Python | apache-2.0 | 1,523 |
# encoding: utf-8
"""
ancient.py
Created by Thomas Mangin on 2009-08-25.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
import os
import sys
import stat
import time
import socket
import shlex
from copy import deepcopy
from struct import pack
from struct import unpack
from exabgp.util.ip import isipv... | lochiiconnectivity/exabgp | lib/exabgp/configuration/ancient.py | Python | bsd-3-clause | 94,922 |
#!/usr/bin/env python
import flexiport, sys, time
def Usage ():
print 'Usage: ' + sys.argv[0] + ' [-o portoptions]'
print '-o portoptions\tString of options for the port.'
def main ():
portOptions = 'type=serial,device=/dev/ttyS0,timeout=1'
if len (sys.argv) == 3:
if sys.argv[1] == '-o':
portOptions = sys... | gbiggs/flexiport | python/test/serial_example.py | Python | gpl-3.0 | 1,758 |
#!/usr/bin/env python
"""calculate the finite strain ellipsoid at each location"""
import numpy as np
import finite_strain as fs
import glob
def rotate_to_local(lat,lon,V):
"""rotate column vectors V in the global frame
(axes 1,2,3 pointing to lat,lon (0,0); (0,90); and (90,0) respectively)
to a local ... | JackWalpole/finite_strain | TX2008V2_finite_strain_ellipsoids.py | Python | mit | 2,461 |
# -*- coding: utf-8 -*-
"""
@author: kevinhikali
@email: hmingwei@gmail.com
"""
from __future__ import division
import sys
dataname = sys._getframe().f_code.co_filename
dataname = dataname.split('/')[-1]
dataname = dataname.split('.')[0]
import os
from PIL import Image
import numpy as np
PATH = '/home/kevin/catkin_ws... | kevinhikali/ml_kevin | res/mnist.py | Python | gpl-3.0 | 1,635 |
#!/usr/bin/python
import shutil
import os
import stat
import platform
import subprocess
def registerapp(app):
# don't do any of this unless >= 10.8
v, _, _ = platform.mac_ver()
v = float('.'.join(v.split('.')[:2]))
if v < 10.8:
return None, 'Registering requires OS X version >= 10.8'
app... | dpendl00/headphones | lib/osxnotify/registerapp.py | Python | gpl-3.0 | 4,531 |
#
# @lc app=leetcode id=56 lang=python3
#
# [56] Merge Intervals
#
from typing import List
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
if not intervals:
return []
intervals = sorted(intervals, key=lambda x: x[0])
buffer_start, buffer_end = int... | heyf/cloaked-octo-adventure | leetcode/0056_merge-intervals.py | Python | mit | 1,030 |
# Generated from java-escape by ANTLR 4.5
from antlr4 import *
# This class defines a complete listener for a parse tree produced by SpeakPythonJSGFParser.
class SpeakPythonJSGFListener(ParseTreeListener):
# Enter a parse tree produced by SpeakPythonJSGFParser#prog.
def enterProg(self, ctx):
pass
... | sunfounder/SunFounder_PiSmart | pismart/SpeakPython/SpeakPythonJSGFListener.py | Python | gpl-2.0 | 5,250 |
"""empty message
Revision ID: c626e32ddcc
Revises: None
Create Date: 2016-01-23 14:47:09.205628
"""
# revision identifiers, used by Alembic.
revision = 'c626e32ddcc'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
... | athkishore/vgr | migrations/versions/c626e32ddcc_.py | Python | mit | 2,615 |
from parser import CategoryParser
class ScrubbingTelemetryParser(CategoryParser):
def __init__(self, reader, store):
CategoryParser.__init__(self, '05: Scrubbing State', reader, store)
def get_bit_count(self):
return 3 + 3 + 32
def parse(self):
self.append("Primary Flash Scrubbin... | PW-Sat2/PWSat2OBC | integration_tests/emulator/beacon_parser/scrubbing_telemetry_parser.py | Python | agpl-3.0 | 445 |
'''
Take two lists, say for example these two:
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
and write a program that returns a list that contains only the elements that are common
between the lists (without duplicates). Make sure your program works on two lists of dif... | terrameijar/practice-projects | list_overlap.py | Python | gpl-2.0 | 747 |
import sys
import json
import urllib
from datetime import datetime
from base64 import b64decode
from bitstring import ConstBitStream
from ..exceptions import (
PyiCloudAPIResponseError,
PyiCloudBinaryFeedParseError,
PyiCloudPhotoLibraryNotActivatedErrror
)
class PhotosService(object):
""" The 'Photos... | b-jesch/service.fritzbox.callmonitor | resources/lib/PhoneBooks/pyicloud/services/photos.py | Python | gpl-2.0 | 9,009 |
from __future__ import unicode_literals
import os.path
from django.utils._os import upath
TEST_ROOT = os.path.dirname(upath(__file__))
TESTFILES_PATH = os.path.join(TEST_ROOT, 'apps', 'test', 'static', 'test')
TEST_SETTINGS = {
'DEBUG': True,
'MEDIA_URL': '/media/',
'STATIC_URL': '/static/',
'MEDIA... | DONIKAN/django | tests/staticfiles_tests/settings.py | Python | bsd-3-clause | 1,039 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/tink | python/tink/streaming_aead/_file_object_adapter.py | Python | apache-2.0 | 2,165 |
try:
import simplejson as json
except ImportError:
import json
import functools
from cgi import parse_header
def wrap_json(func=None, *, encoder=json.JSONEncoder, preserve_raw_body=False):
"""
A middleware that parses the body of json requests and
encodes the json responses.
NOTE: this middle... | jespino/anillo | anillo/middlewares/json.py | Python | bsd-2-clause | 3,333 |
""" Testing
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal, \
assert_
from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings
def test_squeeze_element():
a = np.zeros((1,3))
... | jamestwebber/scipy | scipy/io/matlab/tests/test_mio_utils.py | Python | bsd-3-clause | 1,549 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SciFabric LTD.
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | geotagx/pybossa | pybossa/default_settings.py | Python | agpl-3.0 | 4,010 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-eventarc | google/cloud/eventarc_v1/services/eventarc/transports/grpc_asyncio.py | Python | apache-2.0 | 27,526 |
# -*- coding: UTF-8 -*-
# Copyright 2012-2021 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from builtins import range
import decimal
from lino.utils import ONE_DAY
from django.conf import settings
from django.utils.translation import gettext as _
from lino.utils impor... | lino-framework/welfare | lino_welfare/modlib/debts/fixtures/demo.py | Python | agpl-3.0 | 3,720 |
from _Xpath import *
from _Error import *
from _Geometric import *
from _BigintDouble import *
from _compat import compat_option
from _compat import compat_color
from _compat import compat_get
from _compat import compat_strftime
from _compat import compat_sleep
| hackersql/sq1map | Web/xpath_injection/Xpath/Xtract/__init__.py | Python | gpl-3.0 | 263 |
import json
import sys
import base64
#from distutils.util import strtobool
import io
import zipfile
from pymisp import PyMISP
from mwdblib import MWDB
misperrors = {'error': 'Error'}
mispattributes = {'input': ['attachment', 'malware-sample'], 'output': ['link']}
moduleinfo = {'version': '1', 'author': 'Koen Van Imp... | MISP/misp-modules | misp_modules/modules/expansion/mwdb.py | Python | agpl-3.0 | 5,770 |
"""
pyturb
Adapted nozzle tests tests
M Rodriguez. 2020
"""
import sys
from sys import path
from os.path import dirname as dir
sys.path.append(dir(sys.path[0]))
from pyturb.gas_models.isentropic_flow import IsentropicFlow
from pyturb.gas_models.perfect_ideal_gas import PerfectIdealGas
from pyturb.power_plant.nozzle... | MRod5/pyturb | src/tests/adapted_nozzle_tests.py | Python | mit | 3,424 |
__author__ = "Ian Goodfellow"
class Environment(object):
pass
| fyffyt/pylearn2 | pylearn2/sandbox/lisa_rl/bandit/environment.py | Python | bsd-3-clause | 67 |
def this_is_the_outer_lib():
print 'For imports test'
| fingeronthebutton/RIDE | utest/resources/robotdata/imports/outer_lib.py | Python | apache-2.0 | 58 |
import attr
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.utils import VersionPick, Version
from widgetastic.widget import Text, Checkbox
from widgetastic_manageiq import SummaryFormItem
from widgetastic_patternfly import Button, Input, BootstrapSelect
from cfme.intelligence.reports imp... | lkhomenk/integration_tests | cfme/intelligence/reports/widgets/__init__.py | Python | gpl-2.0 | 8,138 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
##
## S E R I A L B O X
##
## This file is distributed under terms of BSD license.
## See LICENSE.txt for more information.
##
##===-... | thfabian/serialbox2 | examples/python/example-06-visualization.py | Python | bsd-2-clause | 1,260 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 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 applicabl... | SimplyMinimal/Liberarsi | calendar-cmd-line-sample/sample.py | Python | apache-2.0 | 4,864 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
"""
The pex.bin.pex utility builds PEX environments and .pex files specified by
sources, requirements and their dependencies.
"""
from __future__ import absolute_import, print_function
i... | pantsbuild/pex | pex/bin/pex.py | Python | apache-2.0 | 31,799 |
#!/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)
from future_builtins import map
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'rest... | insomnia-lab/calibre | src/calibre/ebooks/mobi/debug/mobi8.py | Python | gpl-3.0 | 11,866 |
class Penguin(object):
def __init__(self, name, mood, id=None):
self.name = name
self.mood = mood
self.id = id
def __repr__(self):
return '< %s the %s penguin >' % (self.name, self.mood)
class Goose(object):
def __init__(self, name, favorite_penguin, id=None):
... | natb1/query-tools | tests/examples/fixture_model.py | Python | mit | 554 |
#
# 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... | nathanielvarona/airflow | airflow/providers/airbyte/hooks/airbyte.py | Python | apache-2.0 | 4,185 |
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import User
class MyUserChangeForm(UserChangeForm):
class Meta(UserChangeForm.Meta):
model = User
... | watchdogpolska/feder | feder/users/admin.py | Python | mit | 826 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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... | nop33/indico | indico/core/db/sqlalchemy/util/session.py | Python | gpl-3.0 | 1,060 |
import re
from view_error import *
class JSONPMiddleware(object):
def process_response(self, request, response):
# If the response is a redirect, the callback will be dealt
# on the next request:
if response.status_code == 302:
return response
else:
if reque... | New-Bamboo/mapit | mapit/middleware/__init__.py | Python | agpl-3.0 | 631 |
# -*- coding: utf-8 -*-
from django.apps import apps
from django.db import models
def get_file_fields():
"""
Get all fields which are inherited from FileField
"""
# get models
all_models = apps.get_models()
# get fields
fields = []
for model in all_models:
for field i... | akolpakov/django-unused-media | django_unused_media/utils.py | Python | mit | 456 |
""" Configurable hooks in the build system. Can be used by various platforms
to customize the build process.
"""
################################################################################
# Hooks for the various parts of the build process
# Internal mapping of hooks per tool
_HOOKS = {}
# Internal mapping of r... | c1728p9/mbed-os | tools/hooks.py | Python | apache-2.0 | 7,232 |
import sys
if __name__ == "__main__":
import django
from django.core.management import execute_from_command_line
django.setup()
execute_from_command_line(sys.argv)
| edigiacomo/django-statusboard | manage.py | Python | gpl-2.0 | 181 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2014 Alex Forencich
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... | dracorpg/python-ivi | ivi/lecroy/lecroyWaveJet300.py | Python | mit | 38,820 |
import Queue
#this file contains the move/jump mappings for each space on the board
#the squares that a checker can move into from each position
blackMoveMapping = {1:[5, 6],
2:[6, 7],
3:[7, 8],
4:[8],
5:[9],
6:[9, 10]... | dmille56/codesamples | src/CheckersMoveMappings.py | Python | mit | 8,398 |
import os
import sys
from .metadata import MetadataUpdateRunner
from .sync import SyncFromUpstreamRunner
from .tree import GitTree, HgTree, NoVCSTree
from .base import Step, StepRunner, exit_clean, exit_unclean
from .state import SavedState, UnsavedState
def setup_paths(sync_path):
sys.path.insert(0, os.path.abs... | paulrouget/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/update/update.py | Python | mpl-2.0 | 6,447 |
#!/usr/bin/env python
# Copyright 2020 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | jboeuf/grpc | tools/run_tests/run_xds_tests.py | Python | apache-2.0 | 53,665 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser 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 hope that it will ... | mnach/suds-py3k | suds/transport/options.py | Python | lgpl-3.0 | 2,197 |
import unittest
from Elements.G.Populators.OnlyEntriesPopulator import OnlyEntriesPopulator
from Elements.G.Populators.ParameterListPopulator import ParameterListPopulator
class TestClass(unittest.TestCase):
def setUpEntriesPopulator(self, name, templates = { "Name" : "" }, settings = {}):
self.entriesPopulator = O... | afronski/grammar-generator | grammar-generator/Tests/PopulatorsTest.py | Python | mit | 3,427 |
"""A high-speed, production ready, thread pooled, generic WSGI server.
Simplest example on how to use this module directly
(without using CherryPy's application machinery):
from cherrypy import wsgiserver
def my_crazy_app(environ, start_response):
status = '200 OK'
response_headers = [('C... | sizzlelab/pysmsd | extras/cherrypy/wsgiserver/__init__.py | Python | mit | 70,860 |
#Задача 9. Вариант 8.
#1-50. Создайте игру, в которой компьютер выбирает какое-либо слово, а игрок должен его отгадать. Компьютер сообщает игроку, сколько букв в слове, и дает пять попыток узнать, есть ли какая-либо буква в слове, причем программа может отвечать только "Да" и "Нет". Вслед за тем игрок должен попробоват... | Mariaanisimova/pythonintask | INBa/2015/Ionova_A_K/task_9_8.py | Python | apache-2.0 | 1,504 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 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) any later... | zenodo/invenio | invenio/modules/authors/views.py | Python | gpl-2.0 | 1,155 |
"""
Bubble Sort
-----------
A naive sorting that compares and swaps adjacent elements.
Time Complexity: O(n**2)
Space Complexity: O(1) Auxiliary
Stable: Yes
Psuedo code: http://en.wikipedia.org/wiki/Bubble_sort
"""
def sort(seq):
"""
Takes a list of integers and sorts them in ... | stphivos/algorithms | algorithms/sorting/bubble_sort.py | Python | bsd-3-clause | 639 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.