code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import sys
import yaml
def fetch_table_data(table_path):
data_dict = {}
with open(table_path) as table_to_load:
# load headers
headers = table_to_load.readline().strip('\n').split('\t')
row_id = 0
for line in table_to_load.readlines():
# print(line)
lin... | gregvonkuster/tools-iuc | tools/ena_upload/dump_yaml.py | Python | mit | 1,252 |
# -*- coding: utf-8 -*-
import unittest
from datetime import datetime
from wechatpy import parse_message
class EventsTestCase(unittest.TestCase):
def test_scan_code_push_event(self):
from wechatpy.events import ScanCodePushEvent
xml = """<xml>
<ToUserName><![CDATA[gh_e136c6e50636]]></ToU... | jxtech/wechatpy | tests/test_events.py | Python | mit | 18,940 |
# Module doctest.
# Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org).
# Major enhancements and refactoring by:
# Jim Fulton
# Edward Loper
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
r"""Module doctest -- a framework for running examples in docstrings.
In... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.7/Lib/doctest.py | Python | mit | 101,750 |
'''
Created on Mar 19, 2014
@author: Simon
'''
from engine.engine_job import EngineJob
class ValidationJob(EngineJob):
'''
M/R job for validating a trained model.
'''
def mapper(self, key, values):
data_processor = self.get_data_processor()
data_processor.set_data(values)
dat... | xapharius/mrEnsemble | Engine/src/jobs/validation_job.py | Python | mit | 746 |
"""Functionality to query and extract information from aligned BAM files.
"""
import collections
import contextlib
import os
import itertools
import signal
import subprocess
import numpy
import pysam
import toolz as tz
from bcbio import utils
from bcbio.bam import ref
from bcbio.distributed import objectstore
from bc... | Cyberbio-Lab/bcbio-nextgen | bcbio/bam/__init__.py | Python | mit | 19,381 |
import os
import pytest
from som.vm.current import current_universe
@pytest.mark.parametrize(
"test_name",
[
"Array",
"Block",
"ClassLoading",
"ClassStructure",
"Closure",
"Coercion",
"CompilerReturn",
"DoesNotUnderstand",
"Double",
... | SOM-st/PySOM | tests/test_som.py | Python | mit | 964 |
# 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... | ryfeus/lambda-packs | Tensorflow_Pandas_Numpy/source3.6/tensorboard/plugins/beholder/beholder.py | Python | mit | 7,267 |
import csv
import re
from io import TextIOWrapper
from django.conf import settings
from django.core.cache import cache
from django.utils.termcolors import colorize
# Import clog if we're in debug otherwise make it a noop
if settings.DEBUG:
from clog.clog import clog
else:
def clog(*args, **kwargs):
pa... | tndatacommons/tndata_backend | tndata_backend/goals/utils.py | Python | mit | 3,686 |
from __future__ import absolute_import
from .nihts_xcam import XenicsCamera
| henryroe/xenics_pluto | nihts_xcam/__init__.py | Python | mit | 77 |
import re
from django.db import migrations
def add_project_member(apps, schema_editor):
# Using historical versions as recommended for RunPython
PublicDataAccess = apps.get_model("public_data", "PublicDataAccess")
DataRequestProjectMember = apps.get_model(
"private_sharing", "DataRequestProjectMe... | OpenHumans/open-humans | public_data/migrations/0004_migrate_data_20190508.py | Python | mit | 1,674 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
# all country info
import os, json, frappe
from frappe.utils.momentjs import get_all_timezones
def get_country_info(country=None):
data = get_all()
data = frappe._dict(data.get(country, {}))
if 'date_format' not in dat... | frappe/frappe | frappe/geo/country_info.py | Python | mit | 1,972 |
import csv
import math
import sys
data = []
with open(sys.argv[1], 'rb') as f:
reader = csv.DictReader(f)
for row in reader:
if row['year'] != '2015':
continue
if row['birthdate'] and row['gender']:
data.append({
'age': 2016 - int(math.floor(float(row['... | adjspecies/furrypoll-munger | bin/other/age-gender.py | Python | mit | 553 |
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from .punctuation import TOKENIZER_SUFFIXES
from ...language import Language, BaseDefaults
class UrduDefaults(BaseDefaults):
suffixes = TOKENIZER_SUFFIXES
lex_attr_getters = LEX_ATTRS
stop_words = STOP_WORDS
writing_system = {"directi... | honnibal/spaCy | spacy/lang/ur/__init__.py | Python | mit | 461 |
# -*- 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 |
# Copyright (C) 2008 Guild of Writers PyPRP Project Team
# See the file AUTHORS for more info about the team
#
# 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... | Jrius/PyPRP | PyPRP/prp_CamClasses.py | Python | gpl-2.0 | 32,164 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
MultipleExternalInputDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
(C) 2013 by CS Systemes d'informatio... | CS-SI/QGIS | python/plugins/processing/gui/MultipleFileInputDialog.py | Python | gpl-2.0 | 4,837 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLayoutView.
.. note:: 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.
"""
__a... | nirvn/QGIS | tests/src/python/test_qgslayoutview.py | Python | gpl-2.0 | 27,525 |
# -*- coding: utf-8 -*-
'''
Created on 25 April 2014
@author: Kimon Tsitsikas
Copyright © 2013-2014 Kimon Tsitsikas, Delmic
This file is part of Odemis.
Odemis is free software: you can redistribute it and/or modify it under the terms
of the GNU General Public License version 2 as published by the Free Software
F... | gstiebler/odemis | src/odemis/acq/test/spot_alignment_test.py | Python | gpl-2.0 | 10,396 |
#python
import k3d
import testing
setup = testing.setup_mesh_modifier_test("PolyGrid", "ExtrudeFaces")
setup.source.rows = 3
setup.source.columns = 3
selection = k3d.geometry.selection.create(0)
face_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.FACE)
k3d.geometry.primitive_selec... | barche/k3d | tests/mesh/mesh.modifier.ExtrudeFaces.py | Python | gpl-2.0 | 639 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | mitya57/debian-buildbot | buildbot/db/buildsets.py | Python | gpl-2.0 | 7,930 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EditScriptDialog.py
---------------------
Date : December 2012
Copyright : (C) 2012 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*******... | yordan-desta/QgisIns | python/plugins/processing/gui/ScriptEditorDialog.py | Python | gpl-2.0 | 7,417 |
#!/usr/bin/env python
##########################################################################
## Sequence Concat
## Author: Tyghe Vallard
## Release Date: 5/30/2012
## Version: 1.1
## Descriptio... | demis001/bio_pieces | bio_pieces_old/sequence_concat.py | Python | gpl-2.0 | 10,368 |
#!/usr/bin/env python
import os, re, sys
if len(sys.argv) < 2:
print "usage: %s <recordfile>" % sys.argv[0]
sys.exit(1)
# Read record
filename = sys.argv[1]
fd = file(filename)
record = fd.read()
fd.close()
# Update revision
newrecord = []
lbreak = "\r\n"
for line in record.splitlines():
if line.startsw... | BackupTheBerlios/namingmuse | tools/freedb-submit.py | Python | gpl-2.0 | 936 |
# coding: utf-8
"""
HDL Testing Platform
REST API for HDL TP # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
from swagger_client.models.task import Task ... | autosub-team/autosub | src/plugins/vels_ob/test/test_task.py | Python | gpl-2.0 | 776 |
from __future__ import print_function
from sqlalchemy import create_engine
from sqlalchemy.pool import NullPool
import sqlalchemy
import sys
# This value must be incremented after schema changes on replicated tables!
SCHEMA_VERSION = 1
engine = None
def init_db_engine(connect_str):
global engine
engine = cre... | Freso/listenbrainz-server | messybrainz/db/__init__.py | Python | gpl-2.0 | 1,338 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.configuration import Configuration
class JobsEventModelConfigurationCreator(object):
_model_name = 'agent_event_model'
def __init__(self,
locatio... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/washtenaw/configurations/jobs_event_model_configuration_creator.py | Python | gpl-2.0 | 2,232 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009-2010 Zuza Software Foundation
#
# This file is part of Virtaal.
#
# 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 ... | elric/virtaal-debian | virtaal/plugins/terminology/models/localfile/localfileview.py | Python | gpl-2.0 | 17,737 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Campaign.photo'
db.delete_column(u'campaign_campaign', ... | fandrefh/AnjoMeu | anjo/campaign/migrations/0003_auto__del_field_campaign_photo__add_field_campaign_image.py | Python | gpl-2.0 | 1,508 |
"""
Motion correction of image sequences by 'efficient subpixel image registration
by cross correlation'. A reference image is iteratively computed by aligning
and averaging a subset of images/frames.
2015 Lloyd Russell, Christoph Schmidt-Hieber
*************************************************************************... | jzaremba/sima | sima/motion/dftreg.py | Python | gpl-2.0 | 31,079 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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) ... | Tomsod/gemrb | gemrb/GUIScripts/pst/MessageWindow.py | Python | gpl-2.0 | 3,926 |
""" PyroScope - Controller "torrent".
Copyright (c) 2009 The PyroScope Project <pyroscope.project@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; either version 2 of the L... | pyroscope/pyroscope | pyroscope/pyroscope/controllers/torrent.py | Python | gpl-2.0 | 1,556 |
from Queue import Empty
from multiprocessing import Process, Queue
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import widgets
from scipy import interpolate
from labrad.units import Unit
V, mV, us, GHz, rad = [Unit(s) for s in ('V', 'mV', 'us', 'GHz', 'rad')]
from pyle.dataking import utilMultil... | McDermott-Group/LabRAD | LabRAD/TestScripts/fpgaTest/pyle/pyle/dataking/squid.py | Python | gpl-2.0 | 19,393 |
__author__ = 'leviwright'
from mainbot.commands import Command
class NickServLogin(Command):
arguments = []
permissionLevel = 3
permitExtraArgs = False
manArgCheck = False
defaultArgs = []
callName = "login"
def on_call(self, event, *args):
self.bot.connection.privmsg("NickServ",... | MrMindImplosion/Slack-Bots | mainbot/autoCommand.py | Python | gpl-2.0 | 437 |
#!/usr/bin/env python
# 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 ... | abdhaleegit/avocado-misc-tests | toolchain/gdb.py | Python | gpl-2.0 | 3,103 |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2017 University of Tuebingen, CERN, CSC, KTH.
#
# B2Share 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... | EUDAT-B2SHARE/b2share | tests/b2share_unit_tests/users/test_account_rest_permissions.py | Python | gpl-2.0 | 6,918 |
#!/usr/bin/python
#
#
from distutils.core import setup
from spacewalk.common.rhnConfig import CFG, initCFG
initCFG('web')
setup(name = "rhnclient",
version = "5.5.9",
description = CFG.PRODUCT_NAME + " Client Utilities and Libraries",
long_description = CFG.PRODUCT_NAME + """\
Client Utilities
Incl... | PaulWay/spacewalk | client/solaris/rhnclient/setup.py | Python | gpl-2.0 | 610 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | pmisik/buildbot | master/buildbot/db/base.py | Python | gpl-2.0 | 5,687 |
# Patchwork - automated patch tracking system
# Copyright (C) 2016 Linaro Corporation
#
# SPDX-License-Identifier: GPL-2.0-or-later
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.views import APIView
class IndexView(APIView):
def get(self, request, *a... | stephenfin/patchwork | patchwork/api/index.py | Python | gpl-2.0 | 942 |
# -*- coding: utf-8 -*-
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.gui import *
from osgeo import ogr
from ui_widgetGrid import Ui_GdalToolsWidget as Ui_Widget
from widgetPluginBase import GdalToolsBasePluginWidget as BasePluginWidget
import GdalTools_utils as Utils
class G... | sourcepole/qgis | qgis/python/plugins/GdalTools/tools/doGrid.py | Python | gpl-2.0 | 8,154 |
import sys, re
mnemonics="mov,and,or,xor,add,adc,sto,ld,ror,jsr,sub,sbc,inc,lsr,dec,asr,halt,bswp,putpsr,getpsr,rti,not,out,in,push,pop,cmp,cmpc".split(",")
op = dict([(opcode,mnemonics.index(opcode)) for opcode in mnemonics])
dis = dict([(mnemonics.index(opcode),opcode) for opcode in mnemonics])
pred_dict = {0:"",1:"0... | revaldinho/opc | opc6/opc6emu.py | Python | gpl-3.0 | 6,597 |
"""test building messages with streamsession"""
#-------------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/IPython/kernel/zmq/tests/test_session.py | Python | gpl-3.0 | 12,636 |
#!/usr/bin/env python
# from https://github.com/mapillary/mapillary_tools/
# The MIT License (MIT)
#
# Copyright (c) 2014 Mapillary AB
#
# 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 withou... | ltog/mapillary_utils | general/remove_duplicates.py | Python | gpl-3.0 | 17,416 |
"""Manifest clonning tools.."""
import json
import requests
import six
import time
import uuid
import zipfile
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding
from nailgun import entit... | ares/robottelo | robottelo/manifests.py | Python | gpl-3.0 | 7,792 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from module.plugins.Hoster import Hoster
class VeehdCom(Hoster):
__name__ = 'VeehdCom'
__type__ = 'hoster'
__pattern__ = r'http://veehd\.com/video/\d+_\S+'
__config__ = [
('filename_spaces', 'bool', "Allow spaces in filename", 'False'),
... | Rusk85/pyload | module/plugins/hoster/VeehdCom.py | Python | gpl-3.0 | 2,311 |
import math
def is_palindrome(n):
s = str(n)
return s == s[::-1]
def is_prime(n):
if n <= 1:
return False
if n % 2 == 0 and n != 2:
return False
if n == 2:
return True
root = math.sqrt(n)
i = 3
while i <= root:
if n % i == 0:
return Fa... | durandj/codeeval | python/3_prime_palindrome.py | Python | gpl-3.0 | 521 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from frappe.model.document import Document
from erpnext.stock.doctype.serial_no.serial_no import... | elba7r/system | erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py | Python | gpl-3.0 | 4,474 |
# flake8: noqa
"""
PILKit image processors.
A processor accepts an image, does some stuff, and returns the result.
Processors can do anything with the image you want, but their responsibilities
should be limited to image manipulations--they should be completely decoupled
from the filesystem.
"""
from .base import *... | bzennn/blog_flask | python/lib/python3.5/site-packages/pilkit/processors/__init__.py | Python | gpl-3.0 | 386 |
# Chess Analyses by Jan van Reek
# http://www.endgame.nl/index.html
JvR_links = (
("http://www.endgame.nl/match.htm", "http://www.endgame.nl/MATCHPGN.ZIP"),
("http://www.endgame.nl/bad1870.htm", "http://www.endgame.nl/bad1870.pgn"),
("http://www.endgame.nl/wfairs.htm", "http://www.endgame.nl/wfairs.pgn"),
... | pychess/pychess | lib/pychess/Database/JvR.py | Python | gpl-3.0 | 6,560 |
## @package hfst.exceptions
## exceptions...
## Base class for HfstExceptions. Holds its own name and the file and line number where it was thrown.
class HfstException:
## A message describing the error in more detail.
def what():
pass
## Two or more HfstTransducers are not of the same type. Same as H... | wikimedia/operations-debs-contenttranslation-hfst | python/doc/hfst/exceptions/__init__.py | Python | gpl-3.0 | 7,967 |
#!/usr/bin/env python
import qa
import re
import numpy
have_use = re.compile("^\s{1,12}use\s")
remove_warn = re.compile('''(?!.*QA_WARN .+)''', re.VERBOSE)
unwanted = re.compile("(\s|&|\n)", re.VERBOSE)
def do_magic(files, options):
name = files[0]
glob = []
temp = []
for f in files[2:]:
lin... | varadarajan87/piernik | bin/generate_public.py | Python | gpl-3.0 | 1,873 |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a sample controller
## - index is the default action of any application
## - user is required for authentication and authorization... | Yelrado/web-admin-events | controllers/default.py | Python | gpl-3.0 | 6,866 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 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... | belokop/indico_bare | indico/modules/rb/controllers/admin/__init__.py | Python | gpl-3.0 | 1,335 |
# 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/modules/networks/util.py | Python | gpl-3.0 | 1,020 |
'''
NFI -- Silensec's Nyuki Forensics Investigator
Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com)
Silensec Ltd.
Juma Fredrick (j.fredrick[at]silensec[dot]com)
Silensec Ltd.
This file is part of Nyuki Forensics Investigator (NFI).
NFI is fr... | georgenicolaou/nfi | AndroidApps/com_google_android_feedback.py | Python | gpl-3.0 | 1,587 |
# Developed for module tiericide, this script will quickly print out a market
# conversion map based on patch notes, as well as database conversion mapping.
import argparse
import os.path
import sqlite3
import sys
# Add eos root path to sys.path so we can import ourselves
path = os.path.dirname(str(__file__, sys.getf... | bsmr-eve/Pyfa | scripts/conversion.py | Python | gpl-3.0 | 23,244 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenSesame is distri... | eort/OpenSesame | opensesame_extensions/quick_switcher/quick_switcher.py | Python | gpl-3.0 | 2,188 |
"""
This code will fail at runtime...
Could you help `mypy` catching the problem at compile time?
"""
def sum_numbers(*n) -> float:
"""Sums up any number of numbers"""
return sum(n)
if __name__ == '__main__':
sum_numbers(1, 2.0) # this is not a bug
sum_numbers('4', 5) # this is a bug - can `mypy` ... | etingof/talks | pyvo-optional-static-typing/code/12-add-annotations.py | Python | gpl-3.0 | 331 |
"""
Microsoft Windows Help (HLP) parser for Hachoir project.
Documents:
- Windows Help File Format / Annotation File Format / SHG and MRB File Format
written by M. Winterhoff (100326.2776@compuserve.com)
found on http://www.wotsit.org/
Author: Victor Stinner
Creation date: 2007-09-03
"""
from hachoir_py3.parser ... | SickGear/SickGear | lib/hachoir_py3/parser/misc/hlp.py | Python | gpl-3.0 | 2,932 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2020 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | chipaca/snapcraft | snapcraft/internal/db/migration.py | Python | gpl-3.0 | 3,728 |
from .utils.dataIO import fileIO
from .utils import checks
from __main__ import send_cmd_help
from __main__ import settings as bot_settings
# Sys.
from operator import itemgetter, attrgetter
import discord
from discord.ext import commands
#from copy import deepcopy
import aiohttp
import asyncio
import json
import os
im... | Canule/Mash-Cogs | omaps/omaps.py | Python | gpl-3.0 | 8,950 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansSylotiNagri-Regular'
native_name = ''
def glyphs(self):
glyphs = []
glyphs.append(0x0039) #glyph00057
glyphs.append(0x0034) #uniA82A
glyphs.append(0x0035) #uniA82B
glyphs.append(0x0036) #glyp... | davelab6/pyfontaine | fontaine/charsets/noto_glyphs/notosanssylotinagri_regular.py | Python | gpl-3.0 | 3,639 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
from __future__ import absolute_import, division, unicode_literals
from jx_base.queries import ... | klahnakoski/TestLog-ETL | vendor/jx_sqlite/schema.py | Python | mpl-2.0 | 4,659 |
"""bug 993786 - update_crash_adu_by_build_signature-bad-buildids
Revision ID: 21e4e35689f6
Revises: 224f0fda6ecb
Create Date: 2014-04-08 18:46:19.755028
"""
# revision identifiers, used by Alembic.
revision = '21e4e35689f6'
down_revision = '224f0fda6ecb'
from alembic import op
from socorrolib.lib import citexttype,... | KaiRo-at/socorro | alembic/versions/21e4e35689f6_bug_993786_update_crash_adu_by_build_.py | Python | mpl-2.0 | 728 |
import frappe
from frappe.utils import get_fullname
def execute():
for user_id in frappe.db.sql_list("""select distinct user_id from `tabEmployee`
where ifnull(user_id, '')!=''
group by user_id having count(name) > 1"""):
fullname = get_fullname(user_id)
employee = frappe.db.get_value("Employee", {"employe... | gangadhar-kadam/hrerp | erpnext/patches/4_0/fix_employee_user_id.py | Python | agpl-3.0 | 491 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-2014 OpenERP (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | songmonit/CTTMSONLINE_V8 | openerp/addons/test_new_api/models.py | Python | agpl-3.0 | 10,759 |
from django.core.exceptions import MultipleObjectsReturned
from django.shortcuts import redirect
from django.urls import reverse, path
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.api.v2.views import PagesAPIViewSet, BaseAPIViewSet
from wagtail.images.api.v2.views import ImagesAPIViewSet
from wagtai... | openstax/openstax-cms | openstax/api.py | Python | agpl-3.0 | 2,453 |
def get_ip_address(request):
ip_address = request.META.get('HTTP_X_FORWARDED_FOR')
if ip_address:
return ip_address.split(',')[-1]
return request.META.get('REMOTE_ADDR')
| jessamynsmith/boards-backend | blimp_boards/utils/request.py | Python | agpl-3.0 | 192 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.core.exceptions import ImproperlyConfigured
from django.core.sig... | hrayr-artunyan/shuup | shuup/xtheme/views/extra.py | Python | agpl-3.0 | 1,769 |
#!/usr/bin/env python
# Shellscript to verify r.gwflow calculation, this calculation is based on
# the example at page 167 of the following book:
# author = "Kinzelbach, W. and Rausch, R.",
# title = "Grundwassermodellierung",
# publisher = "Gebr{\"u}der Borntraeger (Berlin, Stuttgart)",
# year = "1995"
#
import sys
im... | AsherBond/MondocosmOS | grass_trunk/raster/r.gwflow/valid_calc_excavation.py | Python | agpl-3.0 | 1,561 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib.auth.models import User
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.urlresolve... | pirata-cat/agora-ciudadana | userena/models.py | Python | agpl-3.0 | 15,318 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2013-11-25
@author: Martin H. Bramwell
'''
import oerplib
import sys
import socket
from models.OErpModel import OErpModel
class OpenERP(object):
def __init__(self, credentials):
db = credentials['db_name']
user_id = credentials['user... | martinhbramwell/GData_OpenERP_Data_Pump | openerp_utils.py | Python | agpl-3.0 | 1,342 |
#!/usr/bin/env python3
"""Test behaviour of the test running and the term program interaction."""
import sys
import pexpect
from testrunner import run
def _shellping(child, timeout=1):
"""Issue a 'shellping' command.
Raises a pexpect exception on failure.
:param timeout: timeout for the answer
"""
... | cladmi/RIOT | tests/test_tools/tests/01-run.py | Python | lgpl-2.1 | 1,512 |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of the test suite of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
## Commercial License... | RLovelett/qt | doc/src/diagrams/contentspropagation/customwidget.py | Python | lgpl-2.1 | 6,694 |
# RUN: %python -m artiq.compiler.testbench.signature +diag %s >%t
# RUN: OutputCheck %s --file-to-check=%t
def f():
delay_mu(2)
def g():
delay_mu(2)
x = f if True else g
def h():
with interleave:
f()
# CHECK-L: ${LINE:+1}: fatal: it is not possible to interleave this function call within... | JQIamo/artiq | artiq/test/lit/interleaving/error_inlining.py | Python | lgpl-3.0 | 447 |
#!/usr/bin/env python
import re
from lilac.controller import ADMIN, LOGGER
from lilac.orm import Backend
from lilac.tool import access, set_secure_cookie
from lilac.model import User
from solo.template import render_template
from solo.web.util import jsonify
from solo.web import ctx
from webob import exc
from lilac.... | thomashuang/Lilac | lilac/controller/user.py | Python | lgpl-3.0 | 6,114 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of a weboob module.
#
# This weboob module 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 Licen... | vicnet/weboob | modules/regionsjob/__init__.py | Python | lgpl-3.0 | 847 |
# -*- coding: utf-8 -*-
""" Module for converting various mesh formats."""
# Copyright (C) 2006 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, e... | FEniCS/dolfin | site-packages/dolfin_utils/meshconvert/meshconvert.py | Python | lgpl-3.0 | 50,178 |
import gc
from concurrent.futures import ThreadPoolExecutor
import pandas as pd
import numpy as np
import os
import arboretum
import json
import sklearn.metrics
from sklearn.metrics import f1_score, roc_auc_score
from sklearn.model_selection import train_test_split
from scipy.sparse import dok_matrix, coo_matrix
from ... | bataeves/kaggle | instacart/imba/arboretum_cv.py | Python | unlicense | 18,971 |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
import sys
# Define required packages.
requires = []
# Assume spidev is required on non-windows & non-mac platforms (i.e. linux).
if sys.platform != 'win32' and sys.platform != 'darwin':
requires.append('spidev')
set... | WxOutside/software | telemetry/sensors/weatherPiArduino/Adafruit_Python_GPIO/setup.py | Python | unlicense | 846 |
#!/usr/bin/env python
#/******************************************************************************
# * $Id$
# *
# * Project: GDAL Make Histogram and Cumulative graph from Tab delimited tab as
# generated by gdal_hist.py
# * Purpose: Take a gdal_hist.py output and create a histogram plot using matp... | USGS-Astrogeology/GDAL_scripts | gdal_baseline_slope/python2/slope_histogram_cumulative_graph.py | Python | unlicense | 4,103 |
# 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 required by applicable ... | jestapinski/oppia | core/domain/classifier_domain.py | Python | apache-2.0 | 3,445 |
#!/usr/bin/env python
#
# kvmexit.py
#
# Display the exit_reason and its statistics of each vm exit
# for all vcpus of all virtual machines. For example:
# $./kvmexit.py
# PID TID KVM_EXIT_REASON COUNT
# 1273551 1273568 EXIT_REASON_MSR_WRITE 6
# 1274253 1274261 EXIT_RE... | brendangregg/bcc | tools/kvmexit.py | Python | apache-2.0 | 12,070 |
#!/usr/bin/python
import argparse
import sys
import os
import subprocess
import signal
import getpass
import simplejson
from termcolor import colored
import ConfigParser
import StringIO
import functools
import time
import random
import string
from configobj import ConfigObj
import tempfile
import pwd, grp
import trace... | mrwangxc/zstack-utility | zstackctl/zstackctl/ctl.py | Python | apache-2.0 | 302,359 |
# Copyright (C) 2014 VA Linux Systems Japan K.K.
#
# 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... | CingHu/neutron-ustack | neutron/tests/unit/ofagent/test_arp_lib.py | Python | apache-2.0 | 13,264 |
"""Test deCONZ gateway."""
from unittest.mock import Mock, patch
import pytest
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.components.deconz import errors, gateway
from tests.common import mock_coro
import pydeconz
ENTRY_CONFIG = {
"host": "1.2.3.4",
"port": 80,
"api_ke... | jabesq/home-assistant | tests/components/deconz/test_gateway.py | Python | apache-2.0 | 7,242 |
"""Support for Freedompro sensor."""
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import LIGHT_LUX, PERCENTAGE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant, callb... | mezz64/home-assistant | homeassistant/components/freedompro/sensor.py | Python | apache-2.0 | 3,148 |
"""Unit test for treadmill.appcfg.configure.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import shutil
import sys
import tempfile
import unittest
import mock
import treadmill
from treadmill.appcfg... | Morgan-Stanley/treadmill | lib/python/treadmill/tests/appcfg/configure_test.py | Python | apache-2.0 | 7,613 |
###############################################################################
#
# file: urlfetcher.py
#
# Purpose: refer to module documentation for details
#
# Note: This file is part of Termsaver application, and should not be used
# or executed separately.
#
#####################################... | wkentaro/termsaver | termsaverlib/screen/urlfetcher.py | Python | apache-2.0 | 2,181 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | joshua-cogliati-inl/raven | framework/utils/randomUtils.py | Python | apache-2.0 | 15,561 |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | bikeNomad/mbed | workspace_tools/synch.py | Python | apache-2.0 | 11,453 |
#!/usr/bin/env python2.5
#
# Copyright 2009 the Melange 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 applic... | MatthewWilkes/mw4068-packaging | src/melange/src/soc/modules/gsoc/logic/models/grading_record.py | Python | apache-2.0 | 5,231 |
"""
Copyright (c) 2015 SONATA-NFV
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 applicable law or agreed to... | sonata-nfv/son-qual | qual-stress-mano-framework/son-mano-base/test/test_messaging.py | Python | apache-2.0 | 10,419 |
__author__ = 'Brian Wickman'
from process_provider_ps import ProcessProvider_PS
from process_provider_procfs import ProcessProvider_Procfs
class ProcessProviderFactory(object):
"""
A factory for producing platform-appropriate ProcessProviders.
Typical use-cases:
Import
>>> from twitter.common.... | foursquare/commons-old | src/python/twitter/common/process/__init__.py | Python | apache-2.0 | 1,910 |
import time
from datetime import datetime
def format_ts_from_float(ts):
return int(ts) * 1000000000
def format_ts_from_date(ts):
return format_ts_from_float(time.mktime(ts.timetuple()))
def format_ts_from_str(ts, pattern='%Y-%m-%d %H:%M:%S'):
return format_ts_from_date(datetime.strptime(ts, pattern))
... | rdo-infra/ci-config | ci-scripts/infra-setup/roles/rrcockpit/files/telegraf_py3/influxdb_utils.py | Python | apache-2.0 | 487 |
"""Handle automations."""
# Copyright 2013-2017 The Home Assistant Authors
# https://github.com/home-assistant/home-assistant/blob/master/LICENSE.md
# This file was modified by The Camacq Authors.
import logging
from collections import deque
from functools import partial
import voluptuous as vol
from camacq.exception... | CellProfiling/cam_acq | camacq/plugins/automations/__init__.py | Python | apache-2.0 | 10,741 |
"""Helper methods to handle the time in Home Assistant."""
from __future__ import annotations
from contextlib import suppress
import datetime as dt
import re
from typing import Any, cast
import ciso8601
import pytz
import pytz.exceptions as pytzexceptions
import pytz.tzinfo as pytzinfo
from homeassistant.const impor... | w1ll1am23/home-assistant | homeassistant/util/dt.py | Python | apache-2.0 | 12,636 |
# 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 u... | apache/incubator-superset | superset/dashboards/commands/importers/v1/__init__.py | Python | apache-2.0 | 6,297 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import importlib
import os
import six
import ujson
import django.core.urlresolvers
from django.test import TestCase
from typing import List, Optional
from zerver.lib.test_classes import ZulipTestCase
from zerver.mode... | vaidap/zulip | zerver/tests/test_urls.py | Python | apache-2.0 | 6,615 |
# Copyright 2013 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... | Juniper/nova | nova/tests/unit/virt/xenapi/test_vm_utils.py | Python | apache-2.0 | 98,282 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | asimshankar/tensorflow | tensorflow/python/ops/rnn_cell_impl.py | Python | apache-2.0 | 61,366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.