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 numpy as np
from milk.supervised.base import supervised_model
class fast_classifier(object):
def __init__(self):
pass
def set_option(self, _k, _v):
pass
def train(self, features, labels, **kwargs):
examples = {}
for f,lab in zip(features, labels):
if lab ... | pombredanne/milk | milk/tests/fast_classifier.py | Python | mit | 821 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mempool limiting together/eviction with the wallet."""
from test_framework.test_framework import ... | yavwa/Shilling | test/functional/mempool_limit.py | Python | mit | 2,527 |
__all__ = ['E']
import operator
import sys
import threading
import numpy
# Declare a double type that does not exist in Python space
double = numpy.double
# The default kind for undeclared variables
default_kind = 'double'
type_to_kind = {bool: 'bool', int: 'int', long: 'long', float: 'float',
doub... | erdc-cm/numexpr | numexpr/expressions.py | Python | mit | 14,057 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import json
import logging
import traceback
import time
from google.appengine.api import app_identity, mail, capabilities
from google.appengine.runtime import DeadlineExceededError
from tekton.gae.middleware import Middleware
from tekton... | andersonsilvade/5semscript | tekton/gae/middleware/email_errors.py | Python | mit | 2,781 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Michael Krause ( http://krause-software.com/ ).
# You are free to use this code under the MIT license:
# http://opensource.org/licenses/MIT
"""Show some histograms for a directory a Xcode project files."""
from __future__ import print_function
imp... | mikr/xcodeprojer | examples/gidhistograms.py | Python | mit | 9,342 |
# coding=utf-8
from __init__ import *
from dao.dbArticle import SolutionArticle
from dao.dbTag import Tag
def generate_tags(data):
tag_list = []
for tag in data:
if tag == '':
continue
has_tag = Tag.query.filter(Tag.name == tag).first()
if not has_tag:
new_tag = ... | Raynxxx/CUIT-ACM-Website | server/article_server.py | Python | mit | 6,348 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_bicep_r.iff"
... | obi-two/Rebelion | data/scripts/templates/object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_bicep_r.py | Python | mit | 494 |
# include for aggregation
from django.db.models import Case, IntegerField, Sum, Value, When
from django.db.models import CharField
# ------------------------------------------
# imports needed for the functional view
from rest_framework.response import Response
# ------------------------------------------
# ----------... | hackoregon/team-budget | budget_proj/budget_app/views.py | Python | mit | 5,220 |
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Font(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout.yaxis.title"
_path_str = "layout.yaxis.title.font"
_valid_props = {"color", "family"... | plotly/python-api | packages/python/plotly/plotly/graph_objs/layout/yaxis/title/_font.py | Python | mit | 8,542 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/food/shared_drink_aludium_pu36.iff"
result.attribute_templ... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/food/shared_drink_aludium_pu36.py | Python | mit | 452 |
"""Fetch Massacheusetts Department of Transportation feeds.
MassDOT supplies the feeds for MA not covered by MBTA (Boston's transit authority).
http://www.massdot.state.ma.us/DevelopersData.aspx
"""
import logging
from FeedSource import FeedSource
BASE_URL = 'http://www.massdot.state.ma.us/Portals/0/docs/developers/... | azavea/gtfs-feed-fetcher | feed_sources/Massdot.py | Python | mit | 3,164 |
#!/usr/bin/env python
# encoding: utf-8
"""
test_indivdual.py
Test the individual class.
Created by Måns Magnusson on 2013-03-07.
Copyright (c) 2013 __MyCompanyName__. All rights reserved.
"""
import sys
import os
from ped_parser import individual
class TestIndividual(object):
"""Test class for testing how the... | willtownes/ped_parser | tests/test_individual.py | Python | mit | 2,845 |
# This is an example of popping a packet from the Emotiv class's packet queue
# and printing the gyro x and y values to the console.
from emokit.emotiv import Emotiv
import platform
if platform.system() == "Windows":
import socket # Needed to prevent gevent crashing on Windows. (surfly / gevent issue #459)
impor... | cactorium/UCFBrainStuff | seniordesign/emokit/gyro_plot.py | Python | mit | 1,625 |
"Messages used to internally control thesplog settings."
from thespian.actors import ActorSystemMessage
class SetLogging(ActorSystemMessage):
def __init__(self, threshold, useLogging, useFile):
self.threshold = threshold
self.useLogging = useLogging
self.useFile = useFile
| kquick/Thespian | thespian/system/messages/logcontrol.py | Python | mit | 308 |
#!/usr/bin/env python3
# Copyright (c) 2017 The Starwels developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listsincelast RPC."""
from test_framework.test_framework import StarwelsTestFramework
from test_framew... | starwels/starwels | test/functional/wallet_listsinceblock.py | Python | mit | 9,614 |
from nose.tools import *
from localimport import localimport
import os
import sys
modules_dir = os.path.join(os.path.dirname(__file__), 'modules')
def test_localimport_with_autodisable():
sys.path.append(modules_dir)
import another_module as mod_a
try:
with localimport('modules') as _imp:
import som... | NiklasRosenstein/localimport | tests/test_localimport.py | Python | mit | 1,885 |
import demistomock as demisto
incident = demisto.incidents()
data = {
"Type": 17,
"ContentsFormat": "pie",
"Contents": {
"stats": [
{
"data": [
int(incident[0].get('CustomFields', {}).get('xdrhighseverityalertcount', 0))
],
... | demisto/content | Packs/CortexXDR/Scripts/EntryWidgetPieAlertsXDR/EntryWidgetPieAlertsXDR.py | Python | mit | 1,252 |
from lib import incrementer
print(incrementer(2)) | pauleveritt/pycharm_polyglot | src/modules/app.py | Python | mit | 49 |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""Interactive widgets for the Jupyter notebook.
Provide simple interactive controls in the notebook.
Each Widget corresponds to an object in Python and Javascript,
with controls on the page.
To put a Widget on the p... | sserrot/champion_relationships | venv/Lib/site-packages/ipywidgets/__init__.py | Python | mit | 1,536 |
"""
Scrapy settings for RecipesScraper project.
"""
# Names
BOT_NAME = 'RecipesScraper'
SPIDER_MODULES = ['RecipesScraper.spiders']
NEWSPIDER_MODULE = 'RecipesScraper.spiders'
# Obey robots.txt rules
ROBOTSTXT_OBEY = True
# Disable cookies (enabled by default)
COOKIES_ENABLED = False
# Configure item pipelines
IT... | brandonmburroughs/food2vec | dat/RecipesScraper/RecipesScraper/settings.py | Python | mit | 864 |
#!/usr/bin/python
# Script pour telecharger City
import MySQLdb
file_ = open('city.csv', 'w')
file_.write ('city_id,city,country_id\n')
db = MySQLdb.connect( user='etudiants',
passwd='etudiants_1',
host='192.168.99.100',
db='sakila')
cur = db.cursor... | setrar/INF1069 | C.PYTHON/mysql.py | Python | mit | 475 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ObservationTools documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 30 14:32:48 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in ... | iastro-pt/ObservationTools | docs/source/conf.py | Python | mit | 5,035 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/deed/event_perk/shared_fire_pit_deed.iff"
result.attribute_template... | anhstudios/swganh | data/scripts/templates/object/tangible/deed/event_perk/shared_fire_pit_deed.py | Python | mit | 456 |
#!/usr/bin/env python
"""
Given an int n, return True if it is within 10 of 100 or 200. Note: abs(num) computes the absolute value of a number.
near_hundred(93) == True
near_hundred(90) == True
near_hundred(89) == False
"""
def near_hundred(n):
return 190 <= abs(n) <= 210 or 90 <= abs(n) <= 110
def test_funct... | marshallhumble/Euler_Groovy | Coding_Bat/Python/Warmup_1/near_hundred.py | Python | mit | 932 |
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
ALLOWED_HOSTS = []
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'django_netjsongraph.db',
}
}
SECRET_KEY = 'fn)t*+$)ugeyip6-#txyy$5wf2ervc0d2n#h)qb)y5@ly$t*@w'
INSTALLED_APPS = [
... | interop-dev/django-netjsongraph | tests/settings.py | Python | mit | 3,592 |
#!/usr/local/bin/python
import os
# import ycm_core
# return the filename in the path without extension
def findFileName(path, ext):
name = ''
for projFile in os.listdir(path):
# cocoapods will generate _Pods.xcodeproj as well
if projFile.endswith(ext) and not projFile.startswith('_Pods'):
name= proj... | haifengkao/ReactiveCache | .ycm_extra_conf.py | Python | mit | 13,022 |
# Program make a simple calculator that can add, subtract, multiply and divide using functions
# define functions
def add(x, y):
"""This function adds two numbers"""
return x + y
def subtract(x, y):
"""This function subtracts two numbers"""
return x - y
def multiply(x, y):
"""This function multiplie... | janusnic/21v-python | unit_02/calc/1.py | Python | mit | 991 |
from __future__ import absolute_import
import Cookie
import copy
import threading
import time
import urllib
import urlparse
from email.utils import parsedate_tz, formatdate, mktime_tz
import netlib
from netlib import http, tcp, odict, utils
from netlib.http import cookies
from .tcp import TCPHandler
from .primitives ... | byt3bl33d3r/mitmproxy | libmproxy/protocol/http.py | Python | mit | 56,839 |
#
# Dalton Burke, CU Denver
#
# CONUS = [-124.7844079,-66.9513812,24.7433195,49.3457868]
from __future__ import absolute_import
from utils import ensure_dir, symlink_unless_exists
from .downloader import download_url, DownloadError, get_dList
# fast searching of dList
from bisect import bisect
from datetime import d... | vejmelkam/wrfxpy | src/ingest/level0_source.py | Python | mit | 36,889 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Thomas Scholtes.
#
# 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 ... | LordSputnik/beets | beetsplug/types.py | Python | mit | 1,775 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/loot_schematic/shared_death_watch_mandalorian_belt_schematic.if... | obi-two/Rebelion | data/scripts/templates/object/tangible/loot/loot_schematic/shared_death_watch_mandalorian_belt_schematic.py | Python | mit | 509 |
from yowsup.layers.protocol_contacts.protocolentities.iq_sync_get import GetSyncIqProtocolEntity
from yowsup.structs import ProtocolTreeNode
from yowsup.layers.protocol_contacts.protocolentities.test_iq_sync import SyncIqProtocolEntityTest
class GetSyncIqProtocolEntityTest(SyncIqProtocolEntityTest):
def setUp(self... | felix-dumit/campusbot | yowsup2/yowsup/layers/protocol_contacts/protocolentities/test_iq_sync_get.py | Python | mit | 810 |
__author__ = 'bernardo'
import csv
import mechanize
import re
import time
import BeautifulSoup
import smtplib
def sendEmail(result, sfrom, pwd, sto):
SMTP_SERVER = 'smtp.live.com'
SMTP_PORT = 587
sender = 'sfrom'
recipient = 'sto'
subject = 'Promocoes'
body = result
body = "<b>" + body ... | sean-smith/website_status | inemail.py | Python | mit | 782 |
# -*- coding: utf-8 -*-
#
# LICENCE MIT
#
# DESCRIPTION Callgraph builder.
#
# AUTHOR Michal Bukovsky <michal.bukovsky@trilogic.cz>
#
from operator import attrgetter
from inspect import signature
from callgraph.hooks import Hooks
from callgraph.utils import AuPair
from callgraph.symbols import Symbol, ... | burlog/py-static-callgraph | callgraph/builder.py | Python | mit | 5,632 |
"""Subclass of IsClassMethods, which is generated by wxFormBuilder."""
from beatle import model
from beatle.lib import wxx
from beatle.activity.models.ui import ui as ui
from beatle.app.utils import cached_type
# Implementing IsClassMethods
class IsClassMethods(ui.IsClassMethods):
"""
This dialog allows to a... | melviso/phycpp | beatle/activity/models/ui/dlg/cc/IsClassMethods.py | Python | gpl-2.0 | 2,970 |
import os
from gettext import gettext as _
from pulp.bindings.exceptions import NotFoundException
from pulp.client.arg_utils import convert_boolean_arguments
from pulp.client.extensions.decorator import priority
from pulp.client.extensions.extensions import PulpCliCommand, PulpCliOption
from pulp.client.commands.poll... | jeremycline/pulp | nodes/extensions/admin/pulp_node/extensions/admin/commands.py | Python | gpl-2.0 | 20,361 |
import time
import requests
import answer
min_question_id = 1000
max_question_id = 5604
sleep_time = 10
submit_url = 'http://acm.hdu.edu.cn/submit.php?action=submit'
login_url = 'http://acm.hdu.edu.cn/userloginex.php?action=login'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/53... | hnu2013wwj/DH-AutoAC | Python/hdu.py | Python | gpl-2.0 | 2,371 |
#!/usr/bin/env python
# Python Network Programming Cookbook -- Chapter - 5
# This program requires Python 2.7 or any later version
import os
import cgi
import argparse
import BaseHTTPServer
import CGIHTTPServer
import cgitb
cgitb.enable() ## enable CGI error reporting
def web_server(port):
server = BaseHTTPSer... | simontakite/sysadmin | pythonscripts/pythonnetworkingcoookbook/chapter5/5_7_cgi_server.py | Python | gpl-2.0 | 877 |
# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED ... | Jamlum/pytomo | pytomo/dns/rdtypes/ANY/NSEC.py | Python | gpl-2.0 | 5,407 |
import os
from autotest.client import test, utils
# tests is a simple array of "cmd" "arguments"
tests = [["aio-dio-invalidate-failure", "poo"],
["aio-dio-subblock-eof-read", "eoftest"],
["aio-free-ring-with-bogus-nr-pages", ""],
["aio-io-setup-with-nonwritable-context-pointer", ""],
... | nacc/autotest | client/tests/aio_dio_bugs/aio_dio_bugs.py | Python | gpl-2.0 | 1,337 |
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham, A. Roitman
# Copyright (C) 2007-2009 B. Malengier
# Copyright (C) 2008 Lukasz Rymarczyk
# Copyright (C) 2008 Raphael Ackermann
# Copyright (C) 2008 Brian G. Matherly
# Copyright... | sam-m888/gramps | gramps/cli/argparser.py | Python | gpl-2.0 | 23,180 |
from glob import glob
import fitsio
import sys
from astrometry.util.fits import *
from astrometry.util.file import *
from astrometry.util.starutil_numpy import *
from astrometry.libkd.spherematch import *
from collections import Counter
from legacypipe.oneblob import _select_model
from legacypipe.survey import wcs_for_... | legacysurvey/pipeline | py/legacyanalysis/fix-model-selection.py | Python | gpl-2.0 | 4,976 |
#!/usr/bin/python3
# coding: utf-8
import gi
gi.require_version('CinnamonDesktop', '3.0')
from gi.repository import Gtk, GdkPixbuf, Gio, GLib, GObject, Gdk
from util import utils, trackers
MAX_IMAGE_SIZE = 320
MAX_IMAGE_SIZE_LOW_RES = 200
class FramedImage(Gtk.Image):
"""
Widget to hold the user face image... | leigh123linux/cinnamon-screensaver | src/widgets/framedImage.py | Python | gpl-2.0 | 4,227 |
# This file is part of Scapy
# Copyright (C) 2007, 2008, 2009 Arnaud Ebalard
# 2015, 2016, 2017 Maxence Tury
# This program is published under a GPLv2 license
"""
The _TLSAutomaton class provides methods common to both TLS client and server.
"""
import struct
from scapy.automaton import Automaton
from ... | francois-contat/scapy | scapy/layers/tls/automaton.py | Python | gpl-2.0 | 8,976 |
# -*- coding: iso-8859-1 -*-
# Text translations for Suomi (fi).
# Automatically generated - DO NOT EDIT, edit fi.po instead!
meta = {
'language': 'Suomi',
'maintainer': '***vacant***',
'encoding': 'iso-8859-1',
'direction': 'ltr',
}
text = {
'''Create this page''':
'''Luo tämä sivu''',
'''Edit "%(pagename)s"''... | philipn/sycamore | Sycamore/i18n/fi.py | Python | gpl-2.0 | 2,372 |
#
# Copyright 2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | oVirt/vdsm | tests/virt/__init__.py | Python | gpl-2.0 | 887 |
#!/home/mshameers/Templates/py2.7_flask.9/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'datab... | mshameers/me | db_create.py | Python | gpl-2.0 | 529 |
from __future__ import print_function, absolute_import, division
from .project import Project
from .builder import ProjectBuilder, FahProjectBuilder
| msmbuilder/msmbuilder-legacy | MSMBuilder/project/__init__.py | Python | gpl-2.0 | 150 |
"""
Texture Replacement
+++++++++++++++++++
Example of how to replace a texture in game with an external image.
``createTexture()`` and ``removeTexture()`` are to be called from a
module Python Controller.
"""
from bge import logic
from bge import texture
def createTexture(cont):
"""Create a new Dynamic Texture"... | pawkoz/dyplom | blender/doc/python_api/examples/bge.texture.1.py | Python | gpl-2.0 | 1,051 |
# -*- coding: utf-8 -*-
import common
import sys, os, traceback
import time
import random
import re
import urllib
import string
from string import lower
from entities.CList import CList
from entities.CItemInfo import CItemInfo
from entities.CListItem import CListItem
from entities.CRuleItem import CRuleItem
import c... | Crach1015/plugin.video.superpack | zip/plugin.video.SportsDevil/lib/parser.py | Python | gpl-2.0 | 26,568 |
#!/usr/bin/env python
from similaritymeasures import Similarity
def main():
""" main function to create Similarity class instance and get use of it """
measures = Similarity()
print measures.euclidean_distance([0,3,4,5],[7,6,3,-1])
print measures.jaccard_similarity([0,1,2,5,6],[0,2,3,5,7,9])
if __name__ == "... | bharcode/MachineLearning | commons_ml/Similarity_measures/using_similarity.py | Python | gpl-2.0 | 338 |
# vim:ts=4:et
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 prog... | taniwha-qf/io_object_mu | export_mu/empty.py | Python | gpl-2.0 | 2,799 |
import click
import pickle
from build import Build
@click.group()
def cli():
pass
@cli.command()
@click.option('--cache-file', default='test-cache')
@click.option('--query')
def query(cache_file, query):
with open(cache_file, 'rb') as f:
key, criteria = query.split('=')
buildobjs = pickle.l... | jpmontez/jenkins-rpc | scripts/build-summary/cachequery.py | Python | gpl-2.0 | 492 |
""" Checks assigning attributes not found in class slots
will trigger assigning-non-slot warning.
"""
# pylint: disable=too-few-public-methods, no-init, missing-docstring, no-absolute-import, import-error
from collections import deque
from missing import Unknown
class Empty(object):
""" empty """
class Bad(objec... | rogalski/pylint | pylint/test/functional/assigning_non_slot.py | Python | gpl-2.0 | 3,455 |
import xbmc, xbmcgui, xbmcaddon, xbmcplugin, re
import urllib, urllib2
import re, string
import threading
import os
import base64
#from t0mm0.common.addon import Addon
#from t0mm0.common.net import Net
import urlparse
import xbmcplugin
import cookielib
__addon__ = xbmcaddon.Addon()
__addonname__ = __addon__.ge... | pauron/ShaniXBMCWork | plugin.video.f4mTester/default.py | Python | gpl-2.0 | 16,981 |
#!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import random
from gnuradio import gr, gr_unittest, blocks
import pmt
class qa_repack_bits_bb (gr_unittest.TestCase):
def setUp (self):
random.seed... | TheWylieStCoyote/gnuradio | gr-blocks/python/blocks/qa_repack_bits_bb.py | Python | gpl-3.0 | 5,600 |
#!/usr/bin/env python
"""
Profile script for CNFgen package
"""
from __future__ import print_function
import os
import sys
from contextlib import contextmanager
@contextmanager
def erase_stdout():
with file(os.devnull,"w") as null:
old_stdout = sys.stdout
sys.stdout = null
yield
... | marcvinyals/cnfgen | profile.py | Python | gpl-3.0 | 744 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.model.mapper import get_mapped_doc
from frappe.utils import get_url, cint
from frap... | kressi/erpnext | erpnext/buying/doctype/request_for_quotation/request_for_quotation.py | Python | gpl-3.0 | 10,014 |
import os
from cosmos.api import Cosmos, py_call
from cosmos.util.helpers import environment_variables
def use_cuda_device(some_arg, num_gpus):
assert "CUDA_VISIBLE_DEVICES" in os.environ
print(("some_arg", some_arg))
print(("CUDA_VISIBLE_DEVICES", os.environ["CUDA_VISIBLE_DEVICES"]))
assert len(os.e... | LPM-HMS/COSMOS2 | examples/local_gpus.py | Python | gpl-3.0 | 895 |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... | b1-systems/kiwi | kiwi/utils/sync.py | Python | gpl-3.0 | 3,632 |
# ####################### BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All ... | insiderr/insiderr-app | app/modules/requests/packages/chardet/mbcharsetprober.py | Python | gpl-3.0 | 3,269 |
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Rocky Bernstein
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.... | rocky/python2-trepan | trepan/processor/command/set_subcmd/patsub.py | Python | gpl-3.0 | 1,775 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright 2015 Abhijit Menon-Sen <ams@2ndQuadrant.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eithe... | wenottingham/ansible | lib/ansible/plugins/connection/ssh.py | Python | gpl-3.0 | 32,355 |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... | jasonehines/mycroft-core | mycroft/client/enclosure/api.py | Python | gpl-3.0 | 6,761 |
import jmbitcoin as btc
import pytest
def test_bip21_decode():
# These should raise exception because of not being valid BIP21 URI's
with pytest.raises(ValueError):
btc.decode_bip21_uri('')
btc.decode_bip21_uri('nfdjksnfjkdsnfjkds')
btc.decode_bip21_uri('175tWpb8K1S7NmH4Zx6rewF9WQrcZv... | undeath/joinmarket-clientserver | jmbitcoin/test/test_bip21.py | Python | gpl-3.0 | 6,062 |
#!/usr/bin/env python
import roslib;
import rospy
import serial
import time
#COM.baudrate=115200
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import JointState
global COM
def callback(data):
rospy.loginfo(rospy.get_caller_id()+"I heard %s",data.position)
global COM
buffer=[]
j =[0.7,0.5,... | kuri-kustar/haptic_interface-project | manipulation/mitsubishi_arm_hardware_interface/scripts/writeJointRos.py | Python | gpl-3.0 | 1,782 |
# import bpy
# def draw_wire(context):
# area = context.area
# if context.area.type == 'VIEW_3D':
# target = bpy.context.area.spaces.active
# # target.draw_handler_add() | TriumphLLC/FashionProject | modules/draw/wires.py | Python | gpl-3.0 | 183 |
'''
SASMOL: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... | StevenCHowell/zazmol | src/python/test_sasmol/test_system/test_intg_system_Atom_setLoc.py | Python | gpl-3.0 | 1,425 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def from_election_to_elections(apps, schema_editor):
# We can't import the Person model directly as it may be a newer
# version than this migration expects. We use the historical version.
Election = a... | ciudadanointeligente/votainteligente-portal-electoral | elections/migrations/0021_auto_20151008_1526.py | Python | gpl-3.0 | 928 |
# -*- coding: utf-8 -*-
from pyknyx.common.singleton import *
import unittest
# Mute logger
from pyknyx.services.logger import logging; logger = logging.getLogger(__name__)
from pyknyx.services.logger import logging
logger = logging.getLogger(__name__)
logging.getLogger("pyknyx").setLevel(logging.ERROR)
@six.add_me... | knxd/pKNyX | tests/common/singleton.py | Python | gpl-3.0 | 617 |
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2015, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
#####################################... | krull/docker-zenoss4 | init_fs/usr/local/zenoss/ZenPacks/ZenPacks.zenoss.ZenJMX-3.12.1.egg/ZenPacks/zenoss/ZenJMX/tests/test_JMXDataSource.py | Python | gpl-3.0 | 960 |
""" VirtualMachineMonitorAgent plays the role of the watch dog for the Virtual Machine
"""
import os
import time
import glob
# DIRAC
from DIRAC import S_OK, S_ERROR, gConfig, rootPath
from DIRAC.ConfigurationSystem.Client.Helpers import Operations
from DIRAC.Core.Base.AgentModule ... | atsareg/VMDIRAC | VMDIRAC/WorkloadManagementSystem/Agent/VirtualMachineMonitorAgent.py | Python | gpl-3.0 | 9,987 |
#!/usr/bin/env python
# --!-- coding: utf8 --!--
"""
The converters package provide functions to quickly convert on the fly from
one format to another. It is responsible to check what external library are
present, and do the job as best as possible with what we have in hand.
"""
from manuskript.converters.abstractCon... | gedakc/manuskript | manuskript/converters/__init__.py | Python | gpl-3.0 | 1,027 |
# -*- coding: latin-1 -*-
import re
import json
from .common import InfoExtractor
from ..utils import determine_ext
class HarkIE(InfoExtractor):
_VALID_URL = r'https?://www\.hark\.com/clips/(.+?)-.+'
_TEST = {
u'url': u'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-targ... | lebabouin/CouchPotatoServer-develop | couchpotato/core/providers/trailer/vftrailers/youtube_dl/extractor/hark.py | Python | gpl-3.0 | 1,526 |
'''
main tuning script, LCLS
'''
import numpy as np
from ocelot.mint.mint import Optimizer, Action
from ocelot.mint.flash1_interface import FLASH1MachineInterface, FLASH1DeviceProperties, TestInterface
mi = FLASH1MachineInterface()
dp = FLASH1DeviceProperties()
#opt = Optimizer(mi, dp)
opt = Optimizer(TestInterfac... | sserkez/ocelot | mint/flash_tune.py | Python | gpl-3.0 | 2,806 |
import numpy as np
from esdl.cube_provider import CubeSourceProvider
from esdl.cube_config import CubeConfig
class TestCubeSourceProvider(CubeSourceProvider):
"""
CubeSourceProvider implementation used for testing cube generation without any source files.
The following usage generates a cube with two var... | CAB-LAB/cablab-core | esdl/providers/test_provider.py | Python | gpl-3.0 | 1,856 |
from sqlalchemy.schema import (
Table,
Column,
MetaData,
ForeignKey)
from sqlalchemy.types import (
Text,
JSON,
DateTime,
Integer,
String)
from collections import defaultdict
from uuid import uuid4
import datetime
class SchemaStore:
def __init__(self):
self.metadata = d... | grahame/ealgis | django/ealgis/dataschema/schema_v1.py | Python | gpl-3.0 | 3,861 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 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; eith... | pferreir/indico-backup | indico/core/index/adapter.py | Python | gpl-3.0 | 1,381 |
"""Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... | mancoast/CPythonPyc_test | cpython/278_test_io.py | Python | gpl-3.0 | 115,068 |
import os
import re
import json
import importlib
# Django Libraries
from django.http import HttpResponse, HttpResponseServerError
# CloudScape Libraries
from cloudscape.common import config
from cloudscape.common import logger
from cloudscape.common.vars import T_BASE
from cloudscape.engine.api.base import APIBase
fr... | djtaylor/cloudscape-DEPRECATED | python/cloudscape/engine/api/core/request.py | Python | gpl-3.0 | 15,200 |
# -*- coding: utf-8 -*-
# strsync - Automatically translate and synchronize .strings files from defined base language.
# Copyright (c) 2015 metasmile cyrano905@gmail.com (github.com/metasmile)
from __future__ import print_function
import strparser, strparser_intentdefinition, strlocale, strtrans
import time, os, sys, ... | metasmile/strsync | strsync/strsync.py | Python | gpl-3.0 | 26,146 |
../../../../../../share/pyshared/papyon/gnet/proxy/SOCKS5.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/papyon/gnet/proxy/SOCKS5.py | Python | gpl-3.0 | 60 |
"""
BIANA: Biologic Interactions and Network Analysis
Copyright (C) 2009 Javier Garcia-Garcia, Emre Guney, Baldo Oliva
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 vers... | emreg00/biana | biana/BianaObjects/Ontology.py | Python | gpl-3.0 | 10,887 |
import argparse
from pyfastaq import tasks
def run(description):
parser = argparse.ArgumentParser(
description = 'Prints the number of sequences in input file to stdout',
usage = 'fastaq count_sequences <infile>')
parser.add_argument('infile', help='Name of input file')
options = parser.par... | martinghunt/Fastaq | pyfastaq/runners/count_sequences.py | Python | gpl-3.0 | 379 |
# -*- coding: utf-8 -*-
#
# Copyright © 2014 René Samselnig
#
# This file is part of Database Navigator.
#
# Database Navigator 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, ... | resamsel/dbnavigator | src/dbmanagr/wrapper.py | Python | gpl-3.0 | 3,349 |
# -*- coding: utf-8 -*-
import unittest
from test.basetestcases import PluginLoadingMixin
class StatisticsLoadingTest (PluginLoadingMixin, unittest.TestCase):
def getPluginDir(self):
"""
Должен возвращать путь до папки с тестируемым плагином
"""
return "../plugins/statistics"
... | unreal666/outwiker | src/test/plugins/statistics/test_loading.py | Python | gpl-3.0 | 587 |
#!/usr/bin/env python
import argparse
import json
import csv
import sys
sys.path.append('python')
import plotting
import utils
from opener import opener
parser = argparse.ArgumentParser()
parser.add_argument('-b', action='store_true') # passed on to ROOT when plotting
parser.add_argument('--outdir', required=True)
... | psathyrella/partis-deprecated | python/compare.py | Python | gpl-3.0 | 2,531 |
# 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 ... | mintuhouse/shotfactory | shotfactory04/__init__.py | Python | gpl-3.0 | 924 |
from __future__ import absolute_import
import urlparse
import urllib
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.utils.encoding import smart_unicode, ... | appsembler/mayan_appsembler | apps/dynamic_search/models.py | Python | gpl-3.0 | 2,130 |
import sys
import logging
import numpy as np
from aravis import Camera
if __name__ == "__main__":
#cam = ar.get_camera("Prosilica-02-2130A-06106")
#cam = Camera("AT-Automation Technology GmbH-20805103")
cam = Camera(loglevel=logging.DEBUG)
if len(sys.argv) > 1:
path = sys.argv[1]
else:
... | oroulet/python-aravis | examples/save-frame.py | Python | gpl-3.0 | 538 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansDevanagari-Regular'
native_name = ''
def glyphs(self):
glyphs = []
glyphs.append(0x0065) #uni0961
glyphs.append(0x0178) #glyph00376
glyphs.append(0x02D8) #glyph00728
glyphs.append(0x0179) #gl... | davelab6/pyfontaine | fontaine/charsets/noto_glyphs/notosansdevanagari_regular.py | Python | gpl-3.0 | 38,139 |
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/bindings/scripts/v8_attributes.py | Python | gpl-3.0 | 29,128 |
#!/usr/bin/env python
# Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# *... | cs-au-dk/Artemis | WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_input.py | Python | gpl-3.0 | 2,580 |
# coding: utf-8
import os.path
from datetime import datetime
from django.conf import settings
from django.test.client import RequestFactory
from django.test.utils import override_settings
import pytest
from django_jinja.backend import Jinja2
from jinja2 import Markup
from mock import patch
from pyquery import PyQuer... | hoosteeno/bedrock | bedrock/mozorg/tests/test_helper_misc.py | Python | mpl-2.0 | 51,641 |
# ext/serializer.py
# Copyright (C) 2005-2019 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Serializer/Deserializer objects for usage with SQLAlchemy query structures,
all... | skarra/PRS | libs/sqlalchemy/ext/serializer.py | Python | agpl-3.0 | 5,784 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-04-24 15:01
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("notification", "0004_delete_old_email_notification")]
operations = [
migrations.RenameModel(
... | project-callisto/callisto-core | callisto_core/notification/migrations/0005_rename_to_emailnotification.py | Python | agpl-3.0 | 408 |
#!/usr/bin/env python
from connection import Conn as Connection
| Polychart/builder | server/polychartQuery/csv/__init__.py | Python | agpl-3.0 | 65 |
import pytest
from django.test import RequestFactory
from django.core.urlresolvers import reverse
from api.transaction.serializers import TransactionSerializer
from iati.transaction.factories import TransactionFactory
class TestTransactionSerializer:
"""
Test if transaction model is serialized correctly.
... | tokatikato/OIPA | OIPA/api/transaction/tests/test_transaction_serializer.py | Python | agpl-3.0 | 1,318 |
#-----------------------------------------------------------
# Threaded, Gevent and Prefork Servers
#-----------------------------------------------------------
import datetime
import errno
import logging
import os
import os.path
import platform
import random
import select
import signal
import socket
import subprocess
... | tvtsoft/odoo8 | openerp/service/server.py | Python | agpl-3.0 | 35,763 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_purchase_delivery
| OCA/purchase-workflow | purchase_propagate_qty/tests/__init__.py | Python | agpl-3.0 | 107 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.