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
# Advent of Code Solutions: Day 8, part 1 # https://github.com/emddudley/advent-of-code-solutions code = 0 mem = 0 with open('input', 'r') as f: for line in f: code += len(line) - 1 mem += len(line.decode("string-escape")) - 3 print(code - mem)
emddudley/advent-of-code-solutions
2015/day-8/advent-day-8-1.py
Python
unlicense
268
# -*- coding: utf-8 -*- import logging import simplejson import os import openerp from openerp.addons.web.controllers.main import manifest_list, module_boot, html_template class PointOfSaleController(openerp.addons.web.http.Controller): _cp_path = '/pos' @openerp.addons.web.http.httprequest def app(self,...
jeffery9/mixprint_addons
point_of_sale/controllers/main.py
Python
agpl-3.0
5,627
#!/usr/bin/env python # encoding: utf-8 import dateutil.parser as dp import hashlib import json import lxml.html import os import re import string import textblob import textblob_aptagger as tag import urllib DEBUG = False # True ###################################################################### ## scrape the ...
ceteri/exsto
exsto.py
Python
apache-2.0
6,800
import rapidsms import re from rapidsms.connection import Connection from rapidsms.message import Message from reporters.models import Reporter, Location from models import * from i18n.utils import get_translation as _ from i18n.utils import get_language_code from strings import strings import threading import time fr...
rapidsms/rapidsms-legacy
apps/iavi/app.py
Python
bsd-3-clause
21,103
#!/usr/bin/env python # Created for KiCad project by Miguel # Some modifications by Edwin # GPL2 import subprocess import os import difflib # class for checking and uncrustifying files # defaults to cpp,cxx,h,hpp and c files class coding_checker(object): file_filter = ["cpp", "cxx", "h", "hpp", "c"] # Funct...
johnbeard/kicad-git
tools/checkcoding.py
Python
gpl-2.0
4,111
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. import os from setuptools import setup, find_packages from digits.extensions.data import GROUP as DIGITS_PLUGIN_GROUP # Utility function to read the README file. def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() ...
TimZaman/DIGITS
plugins/data/imageGradients/setup.py
Python
bsd-3-clause
734
#!/usr/bin/env python """ 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");...
arenadata/ambari
ambari-server/src/main/resources/stacks/ADH/1.6/services/HBASE/package/scripts/setup_ranger_hbase.py
Python
apache-2.0
6,925
import json import argparse import sys import zmq import time from multiprocessing import Process from Sundberg.Logger import * from Modules import NetmodBase, Ping, Command def get_command_line_arguments( ): parser = argparse.ArgumentParser(description='Server for Networkdroid') parser.add_argument("conf...
susundberg/Networkdroid
src/main_server.py
Python
gpl-2.0
8,189
# Copyright (c) 2014 by Ecreall under licence AGPL terms # available on http://www.gnu.org/licenses/agpl.html # licence: AGPL # author: Amen Souissi from zope.interface import Interface from substanced.interfaces import IFile as SourceIFile from dace.interfaces import Attribute class IVisualisableElement(Interfa...
ecreall/pontus
pontus/interfaces.py
Python
agpl-3.0
697
#!/usr/bin/env python3 # Copyright (c) 2014-2019 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 the REST API.""" import binascii from decimal import Decimal from enum import Enum import http.cl...
ftrader-bitcoinabc/bitcoin-abc
test/functional/interface_rest.py
Python
mit
13,199
# actual code def leap_year(year: int) -> bool: """ Calculate if it is a leap year or not. A leap year is defined as one that - is divisible by 4, - but is not otherwise divisible by 100 - unless it is also divisible by 400. :param year: the year :return: True if year is a leap year, Fa...
plipp/Python-Coding-Dojos
katas/02-Leap-Year/leap_year.py
Python
mit
445
""" A test DB in DIRAC, using MySQL as backend """ from DIRAC.Core.Base.DB import DB class AtomDB(DB): def __init__(self): DB.__init__(self, "AtomDB", "Test/AtomDB") retVal = self.__initializeDB() if not retVal["OK"]: raise Exception(f"Can't create tables: {retVal['Message']}")...
DIRACGrid/DIRAC
docs/source/DeveloperGuide/AddingNewComponents/DevelopingDatabases/AtomDB.py
Python
gpl-3.0
969
""" Source Extraction Helpers. These are used in conjunction with image.ImageData. """ import logging import math # DictMixin may need to be replaced using collections.MutableMapping; # see http://docs.python.org/library/userdict.html#UserDict.DictMixin from UserDict import DictMixin import numpy try: import ndim...
transientskp/tkp
tkp/sourcefinder/extract.py
Python
bsd-2-clause
42,538
# Copyright 2016 Elvio Toccalino, Kamal Shadi # This file is part of the Localization package. # # Localization 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 opt...
etoccalino/Localization
localization/geoProject.py
Python
lgpl-3.0
2,627
#!/usr/bin/env python # coding=utf-8 # 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, Versio...
Mega-DatA-Lab/mxnet
example/cnn_chinese_text_classification/text_cnn.py
Python
apache-2.0
11,149
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import getdate, validate_email_add, today, add_years from frappe.model.naming import make_autoname from frappe import t...
kressi/erpnext
erpnext/hr/doctype/employee/employee.py
Python
gpl-3.0
9,961
from ....foo import foo_func from ....bar import bar_func
jwren/intellij-community
python/testData/addImport/relativeImportTooDeepWithSameLevelUsed/pkg1/pkg2/pkg3/pkg4/test.after.py
Python
apache-2.0
57
import pythoncom from win32com.server import util from win32com.server import exception VT_EMPTY = pythoncom.VT_EMPTY class Bag: _public_methods_ = [ 'Read', 'Write' ] _com_interfaces_ = [ pythoncom.IID_IPropertyBag ] def __init__(self): self.data = { } def Read(self, propName, varType, errorLog): p...
sserrot/champion_relationships
venv/Lib/site-packages/win32com/demos/trybag.py
Python
mit
1,988
# Find average price of products in a text file, grouped by sex and age # Infant, Kid, Men, Unisex, Woman def average(prices): return sum(prices) / len(prices) infant_prices = [] kid_prices = [] men_prices = [] unisex_prices = [] woman_prices = [] with open('catalogs/catalog_sample.csv') as f: for line in f...
natla/softuni-python
SoftUni-L3-Functions/t2_average_price_by_sex_age.py
Python
mit
2,695
__author__ = "Can Ozbek Arnav" import pandas as pd import numpy as np import pylab import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix import sys sys.path.append("/Users/ahmetcanozbek/Desktop/EE660/660Project/Code_Final_Used/functions") import ml_aux_functions as ml_aux import crop_rock #PR...
nishantnath/MusicPredictiveAnalysis_EE660_USCFall2015
Code/Machine_Learning_Algos/training_t1.py
Python
mit
6,014
from __future__ import absolute_import import functools import inspect import itertools import logging import threading import six from django.utils.functional import empty, LazyObject from sentry.utils import warnings, metrics from sentry.utils.concurrent import FutureSet, ThreadedExecutor from .imports import imp...
beeftornado/sentry
src/sentry/utils/services.py
Python
bsd-3-clause
17,172
# -*- coding: utf-8 -*- import types import MySQLdb import datetime import pprint class EasySqlLiteException( Exception ): pass def formatcols( cols ): return ','.join( ('`%s`' % (c) if c is not None else 'NULL') for c in cols ) def formattable( tb ): if type(tb) in (types.TupleType, types.ListType ):...
hackshel/metaCollecter
src/metaCenter/modules/easysql.py
Python
bsd-3-clause
9,484
""" A sub-package for efficiently dealing with polynomials. Within the documentation for this sub-package, a "finite power series," i.e., a polynomial (also referred to simply as a "series") is represented by a 1-D numpy array of the polynomial's coefficients, ordered from lowest order term to highest. For example, a...
b-carter/numpy
numpy/polynomial/__init__.py
Python
bsd-3-clause
1,140
from six import python_2_unicode_compatible from .base import QuickbooksBaseObject, Ref, QuickbooksManagedObject @python_2_unicode_compatible class TaxLineDetail(QuickbooksBaseObject): class_dict = { "TaxRateRef": Ref } def __init__(self): super(TaxLineDetail, self).__init__() sel...
sidecars/python-quickbooks
quickbooks/objects/tax.py
Python
mit
1,164
from distutils.core import setup, Extension import numpy from Cython.Distutils import build_ext setup( cmdclass={'build_ext': build_ext}, ext_modules=[Extension("sdf", sources=["_sdf.pyx", "sdf.c"], include_dirs=[numpy.get_include()])], )
duyuan11/glumpy
glumpy/ext/sdf/setup.py
Python
bsd-3-clause
282
# -*- coding: utf-8 -*- from .pdfkit import PDFKit from .pdfkit import Configuration def from_url(url, output_path=None, options=None, toc=None, cover=None, configuration=None, cover_first=False, verbose=False): """ Convert file of files from URLs to PDF document :param url: URL or list of ...
JazzCore/python-pdfkit
pdfkit/api.py
Python
mit
4,062
""" Copyright (c) 2018 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ import pytest from flexmock import flexmock from atomic_reactor.inner import DockerBuildWorkflow from atomic_reactor.plugin import PreBuildP...
DBuildService/atomic-reactor
tests/plugins/test_change_from_in_df.py
Python
bsd-3-clause
11,199
# Copyright 2015-2017 Capital One Services, LLC # Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 import json import ipaddress import os import tempfile import time from botocore.exceptions import ClientError from dateutil.parser import parse as parse_date import mock from c7n import util...
capitalone/cloud-custodian
tests/test_utils.py
Python
apache-2.0
15,368
from paramiko import SFTPClient as BaseSFTPClient class SFTPClient(BaseSFTPClient): def stream_file_to_remote(self, fileobj, remotepath): """ Reads from fileobj and streams it to a remote server over ssh. """ try: fr = self.file(remotepath, "wb") fr.set_pipe...
caio1982/capomastro
archives/sftpclient.py
Python
mit
849
""" Django settings for wgmanager project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) ...
mxm/wgmanager
wgmanager/settings.py
Python
agpl-3.0
3,963
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' ### UPDATE SCRIPT ### ### PURPOSE ### The purpose of this file is to check for updated dividend data and manually extracting the updates from the ### www.newsweb.no website in an efficient manner. This way of manually working with the data is a prototype solution ### ...
FredrikBakken/Norwegian-Stocks-Rating
update.py
Python
mit
6,249
""" .. module: historical.tests.test_s3 :platform: Unix :copyright: (c) 2017 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. author:: Mike Grima <mgrima@netflix.com> """ import json import boto3 import os import time from datetime import datetime from botocore.exc...
kevgliss/historical
historical/tests/test_s3.py
Python
apache-2.0
14,439
# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, ...
rlaager/python-virtinst
tests/utils.py
Python
gpl-2.0
6,806
# -*- coding: utf-8 -*- # # papyon - a python client library for Msn # # Copyright (C) 2009 Collabora Ltd. # # 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 #...
emesene/papyon
papyon/media/codec.py
Python
gpl-2.0
1,589
import random class Card(): ''' Represents a single card type ''' def __init__(self, value, name, suit): self.value = value self.name = name self.suit = suit def is_special(self): ''' Determine whether the card is one of the special cards (King, ...
DaveTCode/PlatoonNiNoKuni
card.py
Python
mit
4,138
from boto.sqs.connection import SQSConnection class Connection(): """ This class acts as a facade for an SQSConnection so that we connect to SQS it until we need it. See http://docs.pythonboto.org/en/latest/ref/sqs.html#module-boto.sqs.connection for a list of all the methods you can use. """...
sauramirez/pysqes
pysqes/conn.py
Python
apache-2.0
951
class Mascota: tipo = "mascota" name = None edad = 0 def __str__(self): return "Soy un {} y me llamo {}".format(self.tipo, self.name) def __repr__(self): return "Mascota" class Carta: valor = 0 palo = None
agustashd/Learning-Python
OOP/objetos.py
Python
mit
250
from django.contrib import admin from django.contrib.admin import ModelAdmin from cms.test_utils.project.pluginapp.plugins.manytomany_rel.models import ( Article, Section, ) admin.site.register(Section, ModelAdmin) admin.site.register(Article, ModelAdmin)
rsalmaso/django-cms
cms/test_utils/project/pluginapp/plugins/manytomany_rel/admin.py
Python
bsd-3-clause
262
# -*- test-case-name: twistedcaldav.directory.test.test_calendar -*- ## # Copyright (c) 2005-2015 Apple Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://ww...
red-hood/calendarserver
twistedcaldav/scheduling_store/caldav/resource.py
Python
apache-2.0
21,494
# -*- coding: utf-8 try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET try: import simplejson as json except ImportError: import json ADDRESS_FIELDS = ( 'first', 'middle', 'last', 'salutation', 'email', 'phone', 'fax', 'mobile', 'addr1', 'addr2', ...
derekperry/oaxmlapi
oaxmlapi/utilities.py
Python
mit
4,499
import os, sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/../") import random from pymcda.electre_tri import ElectreTri, MRSort from pymcda.generate import generate_alternatives, generate_criteria from pymcda.generate import generate_random_mrsort_model from pymcda.generate import generate_random...
oso/pymcda
tests/test_electre_tri.py
Python
gpl-3.0
21,049
"""Diagnostic on HUC12 flowpath balance.""" import numpy as np import cartopy.crs as ccrs from matplotlib.patches import Polygon import matplotlib.colors as mpcolors from geopandas import read_postgis from pyiem.util import get_dbconn from pyiem.plot.use_agg import plt from pyiem.plot.geoplot import MapPlot def main...
akrherz/idep
scripts/plots/huc12_flowpath_balance.py
Python
mit
2,390
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2016 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Emanuel Cino <ecino@compassion.ch> # # This program is free software: you can red...
lem8r/cofair-addons
l10n_ch_account_statement_base_import/parsers/camt.py
Python
lgpl-3.0
1,518
# -*- coding: utf-8 -*- #
jumpserver/jumpserver
utils/create_test_data.py
Python
gpl-3.0
27
from . import math class Viewport: def __init__(self, object, *, min_scale, max_scale, scale=None): self.object = object self.__min_scale = min_scale self.__max_scale = max_scale if scale is None: scale = math.sqrt(min_scale * max_scale) self.__scale = scale ...
iu7-ray-teamwork/junkcraft
engine/_Viewport.py
Python
gpl-3.0
787
#!/usr/bin/env python # # NEWMAN: Natural English With Mutating Abridged Nouns # # Copyright 2010 Chris Eberle <eberle1080@gmail.com> # # 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 # # h...
eberle1080/newman
newman.py
Python
apache-2.0
3,202
""" OpenMLDataManager organizing the data for the benchmarks with data from OpenML-tasks. DataManager organizing the download of the data. The load function of a DataManger downloads the data given an unique OpenML identifier. It splits the data in train, test and optional validation splits. It can be distinguished be...
automl/HPOlib2
hpolib/util/openml_data_manager.py
Python
gpl-3.0
9,540
# Copyright (c) 2013 NEC Corporation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
varunarya10/oslo.middleware
oslo_middleware/tests/test_catch_errors.py
Python
apache-2.0
1,655
# -*- coding: utf-8 -*- # # This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for # more information about the licensing of this file. from collections import namedtuple from inginious.common.base import id_checker SectionConfigItem = namedtuple('SectionConfigItem', ['label', 'type', 'default'])...
UCL-INGI/INGInious
inginious/frontend/task_dispensers/util.py
Python
agpl-3.0
7,041
class IncrementedNamedInt: _last_int = 0 _names = {} @classmethod def get(cls, name): cls._last_int += 1 cls._names[cls._last_int] = name return cls._last_int @classmethod def name_of(cls, int): return cls._names[int] @classmethod def get_for_name(cls, ...
buxx/synergine
synergine/lib/eint.py
Python
apache-2.0
471
import pymongo import sys # establish a connection to the database connection = pymongo.MongoClient("mongodb://localhost") # get a handle to the school database db=connection.school scores = db.scores def find(): print ("find, reporting for duty") query = {'type':'exam'} try: cursor = scores...
nesterione/experiments-of-programming
MongoDB/Python/Week2/Classroom/using_find.py
Python
apache-2.0
812
from collections import defaultdict import numpy as np from deep_net import * from keras.models import Sequential,model_from_json import argparse import parse_data from myKerasLayer_new import MyLayer #import sys if __name__=='__main__': parser = argparse.ArgumentParser() parser.add_argument('-p',"...
KECB/learn
machine_learning/NN_code_release/deep_analyze.py
Python
mit
6,074
#! /usr/bin/env python3 # # Author: Martin Schreiber # Email: schreiberx@gmail.com # Date: 2017-06-18 # import sys import math import mule_local.rexi.EFloat as ef # # Supported Functions to approximate # class Functions: def phiNDirect( self, n: int, z: float ): """ ...
schreiberx/sweet
mule_local/python/mule_local/rexi/Functions.py
Python
mit
9,237
from django.test import TestCase from .models import Color class LightsTest(TestCase): def test_no_color(self): self.assertRaises(Color.DoesNotExist, Color.objects.get) resp = self.client.get("/lights/LEDP.txt") self.assertEqual(resp["content-type"], "text/plain") self.assertEqual...
thepoly/Pipeline
lights/tests.py
Python
mit
1,113
from decimal import Decimal def _Decimal(v): if not isinstance(v, Decimal): return Decimal(str(v)) return v class BackoffTimer(object): """ This is a timer that is smart about backing off exponentially when there are problems """ def __init__(self, min_interval, max_interval, ratio=....
matrixorz/pynsq
nsq/backoff_timer.py
Python
mit
1,739
Plot the forecasted temperatures of Miami in Celsius. You'll need to use the "<a href='#'>create empty list</a>" and "<a href='#'>append</a>" blocks to create a new list of Celsius temperatures from the forecasted temperatures in Blacksburg, and then plot these new temperatures against the old ones. ##### import weath...
RealTimeWeb/Blockpy-Server
static/programs/temperatures.py
Python
mit
634
# -*- coding: utf-8 -*- # Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/ # # 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...
bioinformatics-ua/montra
emif/questionnaire/migrations/0005_add_field_Question_stats.py
Python
gpl-3.0
1,098
#----------------------------------------------------------- # Copyright (C) 2016 Peter Petrik for Lutra Consulting #----------------------------------------------------------- # Licensed under the terms of GNU GPL 2 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GN...
lutraconsulting/qgis-report-plugin
report/providers/github.py
Python
gpl-2.0
3,317
import os import warnings import dotenv from celery import Celery _dirname = os.path.dirname ROOT = _dirname(_dirname(_dirname(os.path.abspath(__file__)))) def path(*args): return os.path.join(ROOT, *args) # Filter out missing .env warning, it's fine if we don't have one. warnings.filterwarnings("ignore", mo...
jotes/pontoon
pontoon/base/celeryapp.py
Python
bsd-3-clause
816
''' Created on 2015-3-24 @author: zhangq ''' import wx import sent_key import parseIrkey #import format_case import globalVariable import os import re class ExamplePanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) self.main_path=os.getcwd() self.IP="10.209...
joakimzhang/qa_study
IM_test/UI2.py
Python
apache-2.0
38,443
# JointBox - Your DIY smart home. Simplified. # Copyright (C) 2017 Dmitry Berezovsky # # JointBox 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...
JointBox/jointbox
src/unix/sysfs/w1.py
Python
gpl-3.0
2,927
## Copyright (C) 2012 by Kevin L. Mitchell <klmitch@mit.edu> ## ## 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. ## #...
klmitch/tendril
tests/unit/test_udp.py
Python
gpl-3.0
23,101
# coding: utf-8 from __future__ import print_function # partially from package six by Benjamin Peterson import sys import os import types try: from ruamel.ordereddict import ordereddict except: try: from collections import OrderedDict except ImportError: from orderddict import OrderedDic...
naparuba/opsbro
opsbro/misc/internalyaml/ruamel/compat.py
Python
mit
2,477
# -*- coding: utf-8 -*- from ionyweb.website.rendering.utils import render_view def index_view(request, plugin): return render_view( plugin.get_templates('plugin_text/index.html'), {'object': plugin})
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_text/views.py
Python
bsd-3-clause
222
"""Calculate distances and shortest paths and find nearest node/edge(s) to point(s).""" import itertools import multiprocessing as mp import warnings import networkx as nx import numpy as np import pandas as pd from rtree.index import Index as RTreeIndex from shapely.geometry import Point from . import projection fr...
gboeing/osmnx
osmnx/distance.py
Python
mit
19,886
""" WSGI config for mysite project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from dj_static import Cling, MediaCli...
ruslan2k/pinax
mysite/wsgi.py
Python
mit
448
import socket import struct # CAN frame packing/unpacking (see 'struct can_frame' in <linux/can.h>) can_frame_fmt = "=IB3x8s" can_frame_size = struct.calcsize(can_frame_fmt) def build_can_frame(can_id, data): can_dlc = len(data) data = data.ljust(8, b'\x00') return struct.pack(can_frame_fmt, can_id, can...
JesusAMR/ProgramasUNI
mysocketest.py
Python
gpl-3.0
944
# This file is part of the myhdl library, a Python package for using # Python as a Hardware Description Language. # # Copyright (C) 2003-2008 Jan Decaluwe # # The myhdl library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License as # published by t...
gw0/myhdl
myhdl/_misc.py
Python
lgpl-2.1
1,896
""" primeshare urlresolver plugin Copyright (C) 2013 Lynx187 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. This program is d...
igor-rangel7l/igorrangelteste.repository
script.module.urlresolver/lib/urlresolver/plugins/primeshare.py
Python
gpl-2.0
2,549
#!/usr/bin/env python # -*- coding: utf-8 -*- import vim import os import os.path from .utils import * from .explorer import * from .manager import * #***************************************************** # HistoryExplorer #***************************************************** class HistoryExplorer(Explorer): de...
Yggdroot/LeaderF
autoload/leaderf/python/leaderf/historyExpl.py
Python
apache-2.0
4,647
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Dag Wieers <dag@wieers.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1'...
caphrim007/ansible
lib/ansible/modules/network/aci/aci_domain_to_encap_pool.py
Python
gpl-3.0
11,289
# # Honeybee: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari # # This file is part of Honeybee. # # Copyright (c) 2013-2020, Mostapha Sadeghipour Roudsari <mostapha@ladybug.tools> # Honeybee is free software; you can redistribute it and/or modify # it under the terms of the GNU G...
mostaphaRoudsari/Honeybee
src/Honeybee_Get EnergyPlus Loads.py
Python
gpl-3.0
7,401
# coding: utf-8 from __future__ import unicode_literals import re import base64 from .common import InfoExtractor from ..compat import ( compat_urllib_parse_urlencode, compat_str, ) from ..utils import ( int_or_none, parse_iso8601, smuggle_url, unsmuggle_url, urlencode_postdata, ) class ...
jcoady9/youtube-dl
youtube_dl/extractor/awaan.py
Python
unlicense
8,019
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe def execute(): if frappe.db.exists("DocType", "Event Producer"): frappe.db.sql("""UPDATE `tabEvent Producer` SET api_key='', api_secret=''""") if frappe.db.exis...
adityahase/frappe
frappe/patches/v13_0/delete_event_producer_and_consumer_keys.py
Python
mit
433
# -*- coding: utf-8 -*- from openerp import models, fields class res_company(models.Model): _inherit = "res.company" ecdf_prefixe = fields.Char("eCDF Prefix", size=6)
acsone/l10n-luxemburg
l10n_lu_ecdf/models/res_company.py
Python
agpl-3.0
178
#!/usr/bin/env python # Copyright (c) 2017,2018, F5 Networks, 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 app...
F5Networks/f5-openstack-agent
f5_openstack_agent/lbaasv2/drivers/bigip/test/class_tester_base_class.py
Python
apache-2.0
7,187
# coding=utf-8 from __future__ import print_function from gen.gen_captcha import gen_dataset, load_templates import cPickle as pickle from PIL import Image import numpy as np from gen.utils import vec2str def check_dataset(dataset, labels, index): data = np.uint8(dataset[index]).reshape((40, 100)) * 255 im = Image...
nladuo/captcha-break
jikexueyuan/python/trainer/check_captcha.py
Python
mit
551
# -*- coding: utf-8 -*- from ..internal.Crypter import Crypter class XupPl(Crypter): __name__ = "XupPl" __type__ = "crypter" __version__ = "0.16" __status__ = "testing" __pattern__ = r'https?://(?:[^/]*\.)?xup\.pl/.+' __config__ = [("activated", "bool", "Activated", True), ...
Arno-Nymous/pyload
module/plugins/crypter/XupPl.py
Python
gpl-3.0
855
""" from: https://gist.github.com/eickenberg/f1a0e368961ef6d05b5b by Michael Eickenberg TODO fix float64 warnings """ import theano import theano.tensor as T fX = theano.config.floatX class _nd_grid(object): """Implements the mgrid and ogrid functionality for theano tensor variables. Parameters =...
diogo149/treeano
treeano/theano_extensions/meshgrid.py
Python
apache-2.0
1,445
from urh.signalprocessing.ChecksumLabel import ChecksumLabel from urh.signalprocessing.ProtocoLabel import ProtocolLabel from urh.signalprocessing.FieldType import FieldType from urh.simulator.SimulatorItem import SimulatorItem from urh.simulator.SimulatorMessage import SimulatorMessage import xml.etree.ElementTree as ...
jopohl/urh
src/urh/simulator/SimulatorProtocolLabel.py
Python
gpl-3.0
4,272
import unittest from version import Version class VersionTestCase(unittest.TestCase): def testFromString(self): v = Version.fromObject("1.3.3sp1") self.assertEquals(v.major, 1) self.assertEquals(v.minor, '3') self.assertEquals(v.micro, '3sp1') self.assertEquals(Version.getNumericPiece(v.micro), '3') self....
marshall/pynaries
pynaries/tests.py
Python
apache-2.0
731
#!python3 """ Data download: TCGA_expression_pipeline.py R preprocessing code: preprocess_classifier.R Use multiple classification methods to classfy stage i-iii and stage iv breast cancer, using their fpkm expression values. """ import os import random import re import math import pandas as pd import num...
SCP-028/UGA
archive/metastasis/classifier/binary_classifier.py
Python
apache-2.0
5,344
#!/usr/bin/python # # Copyright (c) 2008 Steven Watanabe # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) # Test that the common.copy rule set the modification date of the new file to # the current time. import B...
alexhenrie/poedit
deps/boost/tools/build/test/copy_time.py
Python
mit
1,952
from Crypto.PublicKey import RSA from Crypto.Cipher import AES, PKCS1_OAEP file_in = open("encrypted_data.bin", "rb") private_key = RSA.import_key(open("private.pem").read()) enc_session_key, nonce, tag, ciphertext = [ file_in.read(x) for x in (private_key.size_in_bytes(), 16, 16, -1) ] # Decrypt the session key wi...
siwells/teaching_set09103
code/topic_11/decrypt.py
Python
gpl-3.0
616
#The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. #There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. #How many circular primes are there below one million? import eulerlib isprime = eulerlib.list_prima...
vsmolyakov/euler
p035.py
Python
mit
645
from unittest import TestCase from mock import patch from railgun.engines.storage_engine import DummyEngine class StorageEngineTestCase(TestCase): def setUp(self): self.config = { 'field1': 'value1', 'field2': 'value2' } def test_init(self): with patch('railg...
clearcare/railgun
tests/engines/test_storage_engine.py
Python
mit
1,295
# coding=utf-8 # -------------------------------------------------------------------------- # -------------------------------------------------------------------------- from msrest.serialization import Model class User(Model): """User. :param id: :type id: long :param username: :type username: s...
balajikris/autorest
Samples/petstore/Python/swaggerpetstore/models/user.py
Python
mit
1,468
import pygame as pg from gui.Label import Label from gui.Button import Button # TODO: # IMPORTANT # Wave-Nr.-Display # Wave-countdown-Display (to let player know, how long until next wave) # # OPTIONAL # Button to immediately send next wave # Wave-Preview (how many enemies of what kind) class Sidemenu(...
EinfInPython-SS2017-LaJuTo/AbschlussProjekt
src/gui/Sidemenu.py
Python
mit
4,072
import os count = 0 for root, dirs, files in os.walk("D:\Data\Minecraft Modding\Harvest Festival\src\main\java\joshie"): for file in files: for str in open(os.path.join(root, file), 'r'): if str != "/n": count += 1 print(count, "lines of code were found!")
joshiejack/Harvest-Festival
src/main/java/uk/joshiejack/line_counter.py
Python
mit
298
""" Mpmath documentation build configuration file. This file is execfile()d with the current directory set to its containing dir. The contents of this file are pickled, so don't put values in the namespace that aren't pickleable (module imports are okay, they're removed automatically). """ import mpmath # Add any ...
fredrik-johansson/mpmath
docs/conf.py
Python
bsd-3-clause
1,352
import sys import os.path import pickle import csv def decompress(compressed): """Decompress a list of output ks to a string.""" from cStringIO import StringIO # Build the dictionary. dict_size = 256 dictionary = dict((i, chr(i)) for i in xrange(dict_size)) # in Python 3: dictionary = {i: chr...
AdriaGS/MTP-Group-C
Compression/decompresspy.py
Python
gpl-2.0
1,805
import copy import numpy as np import tensorflow as tf from nlp.chatbot.dataset import data_utils class S2SModel(object): def __init__(self, source_vocab_size, target_vocab_size, buckets, size, dropout, num_layers, ...
koala-ai/tensorflow_nlp
nlp/chatbot/model.py
Python
apache-2.0
10,775
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-12-05 20:41 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('images', '0002_imageseries_patient_id'), ] operati...
vessemer/concept-to-clinic
interface/backend/images/migrations/0003_imagefile.py
Python
mit
1,235
#!/usr/bin/env python from cmddocs import Cmddocs def test_do_undo_fail(demoenv, capsys): c, d = demoenv Cmddocs(c).do_undo('test') out, err = capsys.readouterr() assert out == "Error: Could not find given commit reference\n" def test_do_revert_fail(demoenv, capsys): c, d = demoenv Cmddocs(c)...
noqqe/cmddocs
tests/test_undo.py
Python
mit
639
##################################################################### # -*- coding: iso-8859-1 -*- # # # # Frets on Fire # # Copyright (C) 2006 Sami Kyöstilä ...
mdsitton/fofix
fofix/core/Mesh.py
Python
gpl-2.0
8,951
""" AI routines, AI data, and monster death. """ import libtcodpy as libtcod import log from components import * import actions # Might make sense to have this defined # in spells.py instead, dropping the # default argument? CONFUSE_NUM_TURNS = 10 class basic_monster_metadata: def __init__(self, target): ...
Naburimannu/libtcodpy-tutorial
ai.py
Python
bsd-3-clause
2,047
from karakara.tests.data.tracks_random import random_tracks from karakara.model import init_DBSession, DBSession, commit import logging log = logging.getLogger(__name__) VERSION = 0.0 #------------------------------------------------------------------------------- # Command Line #----------------------------------...
richlanc/KaraKara
website/karakara/scripts/insert_random_tracks.py
Python
gpl-3.0
1,343
#!/usr/bin/python # -*- coding: utf-8 -*- """ RPi_Robot ~~~~~~ A robot website application written with Flask. :copyright: (c) TEOTW by Jailman. :license: Apache 2.0. """ #global unicode declearation import sys reload(sys) sys.setdefaultencoding('utf8') '''##########Import modules##########'...
Jailman/RaspberryPiRobot
Web-Terminal/raspberry.py
Python
apache-2.0
6,302
"""Test Met weather entity.""" from homeassistant.components.met import DOMAIN from homeassistant.components.weather import DOMAIN as WEATHER_DOMAIN async def test_tracking_home(hass, mock_weather): """Test we track home.""" await hass.config_entries.flow.async_init("met", context={"source": "onboarding"}) ...
partofthething/home-assistant
tests/components/met/test_weather.py
Python
apache-2.0
2,349
""" Settings and configuration for Django. Values will be read from the module specified by the DJANGO_SETTINGS_MODULE environment variable, and then from django.conf.global_settings; see the global settings file for a list of all possible variables. """ import os import re import time # Needed for Wind...
greggian/TapdIn
django/conf/__init__.py
Python
apache-2.0
5,416