code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python2
# This handy Python script checks if your rtorrent XMLRPC
# setup is working without relying on Emacs.
# Run as follows:
# python rtorrent-test.py
# Copyright (C) 2016-2021 Stefan Kangas.
#
# This file is NOT part of GNU Emacs.
#
# Including code from:
# rtorrent_xmlrpc
# (c) 2011 Roger Que <... | skangas/mentor | test-rtorrent.py | Python | gpl-3.0 | 7,424 |
#!/usr/bin/env python
__author__ = 'greghines'
import numpy as np
import matplotlib.pyplot as plt
import csv
import sys
import os
import pymongo
import matplotlib.cbook as cbook
import random
import bisect
def index(a, x):
'Locate the leftmost value exactly equal to x'
i = bisect.bisect_left(a, x)
if i != ... | camallen/aggregation | experimental/condor/condorIBCC_2.py | Python | apache-2.0 | 3,535 |
print 1, 2, '3', '%.2f' % 4.1
print '%04x' % 0xfeda
# '..' % (..)
print '%d %x %d' % (10, 11, 12)
print '%d %s' % (1, 'een')
print '%d %s %.2f' % (1, 'een', 8.1)
# '..' % tuple
t = (10, 11, 12)
print '%x %d %x' % t
t2 = ('twee', 2)
print '%s %04x' % t2
# mod
a = '%04x' % 0xdefa
print a, a, '%02x' % 0x1234
# all ch... | tomspur/shedskin | tests/165.py | Python | gpl-3.0 | 1,007 |
from __future__ import unicode_literals
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from registration.forms import RegistrationFormUniqueEmail
class RegistrationFormCustom(RegistrationFormUniqueEmail):
"""
This class includes re... | rupalkhilari/approval_frame | approval_frame/forms.py | Python | gpl-3.0 | 3,052 |
import os
import urllib
import json
from django.core.files import File
from django.core.management.base import BaseCommand
from mysite.models import Article, Author, Section
def create_sections():
SECTIONS = [
"News", "Opinion", "Magazine", "Sports",
"Arts", "Media", "Flyby", "Admissions"
]
... | zurawiki/thecrimsom | mysite/management/commands/import_scrape.py | Python | mit | 2,524 |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/utils/example_encoding.py | Python | apache-2.0 | 10,793 |
class Solution(object):
def matrixReshape(self, nums, r, c):
"""
:type nums: List[List[int]]
:type r: int
:type c: int
:rtype: List[List[int]]
"""
h = len(nums)
w = len(nums[0])
if h*w != r*c:
return nums
else:
n... | sadad111/leetcodebox | Reshape the Matrix.py | Python | gpl-3.0 | 567 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
js_to_json,
)
class FKTVIE(InfoExtractor):
IE_NAME = 'fernsehkritik.tv'
_VALID_URL = r'http://(?:www\.)?fernsehkritik\.tv/folge-(?P<id>[0-9]+)(?:/.*)?'
_TEST = {
... | akirk/youtube-dl | youtube_dl/extractor/fktv.py | Python | unlicense | 1,557 |
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from zorna.articles.models import ArticleStory, ArticleCategory
class ArticleCategoryFeed(Feed):
current_site = Sit... | zorna/zorna | zorna/articles/feeds.py | Python | bsd-3-clause | 1,267 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Violin Memory, 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
#
# ... | rlucio/cinder-violin-driver-icehouse | cinder/volume/drivers/violin/vxg/vshare/snapshot.py | Python | apache-2.0 | 23,168 |
from compressor.filters.base import CompilerFilter
from compressor.filters.css_default import CssAbsoluteFilter
from compressor.utils import staticfiles
class CustomCssAbsoluteFilter(CssAbsoluteFilter):
def find(self, basename):
# This is the same as the inherited implementation except for the
# r... | okfn/website | lib/precompilers.py | Python | mit | 1,003 |
import os
import osiris
from osiris import events
class Page(osiris.IPortalPage):
def __init__(self, session):
osiris.IPortalPage.__init__(self, session)
def getPageName(self):
return "portal.pages.changes"
def onInit(self):
osiris.IPortalPage.onInit(self)
#if(self.loggedUser.guestMode == Fals... | OsirisSPS/osiris-sps | client/data/extensions/148B613D055759C619D5F4EFD9FDB978387E97CB/scripts/portals/changes.py | Python | gpl-3.0 | 2,173 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Condition) on 2017-03-22.
# 2017, SMART Health IT.
from . import domainresource
class Condition(domainresource.DomainResource):
""" Detailed information about conditions, problems or diagn... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/condition.py | Python | bsd-3-clause | 10,762 |
def memoize(f):
cache = {}
def aux(*args, **kargs):
k = (args, tuple(kargs.items()) )
if k not in cache:
cache[k] = f(*args, **kargs)
return cache[k]
return aux
@memoize
def fibo_memoize(n):
if n==0:
return 0
elif n==1:
return 1
else:
return fibo_memoize(n-... | JamesZhuh/poulejapon.github.com | code/fibo/fibo.py | Python | mit | 1,637 |
# Demonstrates the following:
# plotting logarithmic axes
# user-defined functions
# "where" function, NumPy array conditional
import numpy as np
import matplotlib.pyplot as plt
# Define the sinc function, with output for x=0 defined
# as a special case to avoid division by zero
def s(x):
a = np.where(x... | djpine/pyman | Book/chap5/Supporting Materials/MultPlotDemo.py | Python | cc0-1.0 | 1,270 |
# Copyright 2017 Google 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | duftler/spinnaker | dev/buildtool/source_commands.py | Python | apache-2.0 | 4,427 |
# -*- 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, Version 2.0 (the
#... | Fokko/incubator-airflow | airflow/contrib/sensors/redis_pub_sub_sensor.py | Python | apache-2.0 | 2,594 |
# -*- coding: utf-8 -*-
import erppeek
from support import tools, behave_better
__all__ = []
OPENERP_ARGS = [
'-c', 'etc/openerp.cfg',
'--logfile=var/log/behave-stdout.log',
]
# Print readable 'Fault' errors
tools.patch_traceback()
# Some monkey patches to enhance Behave
behave_better.patch_all()
def be... | guewen/oerpscenario | features/environment.py | Python | gpl-2.0 | 2,496 |
#
# Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
#
# Jockey 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, or (at your option) any
# later version.
#
# Jockey is distr... | ska-sa/purr | Purr/Plugins/local_pychart/legend.py | Python | gpl-2.0 | 6,779 |
"""
Tests for the Shopping Cart Models
"""
import copy
import datetime
import json
import smtplib
import sys
from decimal import Decimal
import ddt
import pytz
from boto.exception import BotoServerError # this is a super-class of SESError and catches connection errors
from django.conf import settings
from django.cont... | jolyonb/edx-platform | lms/djangoapps/shoppingcart/tests/test_models.py | Python | agpl-3.0 | 58,603 |
# Python implementation of the MySQL client-server protocol
# https://dev.mysql.com/doc/dev/mysql-server/latest/PAGE_PROTOCOL.html
import sys
import struct
from cymysql.err import raise_mysql_exception, OperationalError
from cymysql.constants import SERVER_STATUS, FLAG
from cymysql.converters import convert_characte... | nakagami/CyMySQL | cymysql/packet.py | Python | mit | 12,141 |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from pandas import (Series, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex, Index, IntervalIndex)
import pan... | zfrenchee/pandas | pandas/tests/test_algos.py | Python | bsd-3-clause | 57,547 |
from django.db.models import Model, CharField, URLField
from django.template.loader import get_template
from django.utils.translation import ugettext as _
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore import blocks
from wagtail.wagtailembeds.blocks import EmbedBlock
from wagtail.wagtailimages.blo... | jeremy-c/unusualbusiness | unusualbusiness/utils/models.py | Python | bsd-3-clause | 7,002 |
__author__ = 'xincafe'
| vmthunder/virtman | virtman/utils/__init__.py | Python | apache-2.0 | 23 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pdb
import time
import cx_Oracle
import multiprocessing
ipList = ("192.168.7.121",
"192.168.7.122",
"192.168.7.123",
"192.168.7.124",
"192.168.7.125",
"192.168.7.126",
"192.168.7.127",
"192.168.7... | wbvalid/python2 | aioSqlQuery.py | Python | unlicense | 1,328 |
#-
# Copyright (c) 2014 Michael Roe
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BER... | 8l/beri | cheritest/trunk/tests/fpu/test_raw_fpu_movf_s_pipeline.py | Python | apache-2.0 | 1,529 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import sorl.thumbnail.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='WebpageSnapshot',
fields=[
... | mattaustin/django-thummer | thummer/migrations/0001_initial.py | Python | apache-2.0 | 1,008 |
"""
One calculation and two real motors.
The calculation motor has the position of the motor tagged as first.
The real motor tagged as second differs from the first by a fraction.
orientation: label (horizontal | vertical) of the orientation of the motors.
fraction: the difference [mm] between the first and the second... | tiagocoutinho/bliss | bliss/controllers/motors/slitbox.py | Python | lgpl-3.0 | 1,530 |
class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
temp = nums[0]
for i in range(1,len(nums)):
temp = temp ^ nums[i]
return temp | dichen001/Go4Jobs | JoeXu/136. Single Number.py | Python | gpl-3.0 | 245 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 2020 Rocky Bernstein <rocky@gnu.org>
#
# 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 opti... | rocky/python3-trepan | trepan/lib/complete.py | Python | gpl-3.0 | 3,777 |
#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Install Debian Wheezy sysroots for building chromium.
"""
# The sysroot is needed to ensure that binaries will run on Debian Wh... | junhuac/MQUIC | src/build/linux/sysroot_scripts/install-sysroot.py | Python | mit | 7,498 |
import os,shutil
sources = ["E://Cmder"]
dest_root = "C:\\Mirror\\"
if os.path.exists(dest_root):
shutil.rmtree(dest_root)
ignore_folders = ['.git', 'lib', 'env', 'bin', '.Trash']
ignore_files = ['.DS_Store', '.localized']
for src in sources:
for cur_fol, dirs, files in os.walk(src, topdown=True):
fo... | nickedes/NickPy | 0xMirror/mirror.py | Python | gpl-2.0 | 1,092 |
from __future__ import absolute_import
import logging
import six
from rest_framework import serializers, status
from uuid import uuid4
from sentry import roles
from sentry.api.base import DocSection
from sentry.api.bases.organization import OrganizationEndpoint
from sentry.api.decorators import sudo_required
from se... | mvaled/sentry | src/sentry/api/endpoints/organization_details.py | Python | bsd-3-clause | 18,935 |
"""Test code for iiif.auth_basic.
See http://flask.pocoo.org/docs/0.10/testing/ for Flask notes.
"""
from flask import Flask, request, make_response, redirect
from werkzeug.datastructures import Headers
import base64
import json
import re
import unittest
from iiif.auth_basic import IIIFAuthBasic
dummy_app = Flask('d... | zimeon/iiif | tests/test_auth_basic.py | Python | gpl-3.0 | 3,828 |
import json
from django.test.client import RequestFactory
from nose.tools import eq_
from fjord.base.browserid import FjordVerify
from fjord.base.tests import BaseTestCase, ProfileFactory, reverse, UserFactory
class TestAuth(BaseTestCase):
def test_new_user(self):
"""Tests that new users get redirected... | DESHRAJ/fjord | fjord/base/tests/test_auth.py | Python | bsd-3-clause | 2,558 |
"""Artists model file, contains all data storage logic"""
from django.db import models
class Artist(models.Model):
'''Artists model to specifically handle all
Artist data/storage within the Artist app.'''
name = models.CharField(max_length=260, unique=True)
picture = models.ImageField(
upload_... | ModalSeoul/Weeb.FM | artists/models.py | Python | mit | 594 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
__license__ = 'Public Domain'
import codecs
import io
import os
import random
import shlex
import sys
from .options import (
parseOpts,
)
from .compat import (
compat_expanduser,
compat_getpass,
compat_print,
... | nmrugg/youtube-dl | youtube_dl/__init__.py | Python | unlicense | 16,776 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-03 07:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lostnfound', '0002_auto_20161202_2329'),
]
operations = [
migrations.AlterF... | mafshar/lost-n-found-service | app/lostnfound/migrations/0003_auto_20161203_0241.py | Python | apache-2.0 | 466 |
import os
import signal
import sys
import tempfile
import traceback
import moznetwork
from mozprocess import ProcessHandler
from mozprofile import FirefoxProfile
from mozrunner import FennecEmulatorRunner
from serve.serve import make_hosts_file
from .base import (get_free_port,
cmd_arg,
... | SimonSapin/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/fennec.py | Python | mpl-2.0 | 10,712 |
from tkp.accessors.dataaccessor import RequiredAttributesMetaclass
class LofarAccessor(object):
__metaclass__ = RequiredAttributesMetaclass
"""
Additional metadata required for processing LOFAR images through QC
checks.
Attributes:
antenna_set (string): Antenna set in use during observati... | transientskp/tkp | tkp/accessors/lofaraccessor.py | Python | bsd-2-clause | 886 |
from invoke import task
@task
def start(c):
c.run("python -m src.server.main")
@task
def update_gdoc(
c,
sources_url="https://docs.google.com/spreadsheets/d/e/2PACX-1vRfXo-qePhrYGAoZqewVnS1kt9tfnUTLgtkV7a-1q7yg4FoZk0NNGuB1H6k10ah1Xz5B8l1S1RB17N6/pub?gid=0&single=true&output=csv",
signal_url="https:/... | cmu-delphi/delphi-epidata | tasks.py | Python | mit | 984 |
import sys, os, string
import vtkCommonCorePython
def vtkLoadPythonTkWidgets(interp):
"""vtkLoadPythonTkWidgets(interp) -- load vtk-tk widget extensions
This is a mess of mixed python and tcl code that searches for the
shared object file that contains the python-vtk-tk widgets. Both
the python path a... | collects/VTK | Wrapping/Python/vtk/tk/vtkLoadPythonTkWidgets.py | Python | bsd-3-clause | 2,567 |
"""
Django settings for portal 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, ...)
imp... | TunedMystic/file-upload-django-angular | portal/settings.py | Python | mit | 2,229 |
# Rounder - Poker for the GNOME Desktop
#
# Copyright (C) 2008 Devan Goodwin <dgoodwin@dangerouslyinc.com>
# Copyright (C) 2008 James Bowes <jbowes@dangerouslyinc.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 b... | dgoodwin/rounder | src/rounder/bot.py | Python | gpl-2.0 | 4,036 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# LICENSE
#
# Copyright (c) 2010-2013, GEM Foundation, G. Weatherill, M. Pagani,
# D. Monelli.
#
# The Hazard Modeller's Toolkit is free software: you can redistribute
# it and/or modify it under the terms of the GNU Affero General Public
# License ... | g-weatherill/hmtk | hmtk/parsers/source_model/__init__.py | Python | agpl-3.0 | 2,154 |
#
# 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... | apache/incubator-airflow | tests/providers/google/cloud/sensors/test_bigtable.py | Python | apache-2.0 | 5,366 |
import pygame
from client.widgets.RoundedButtonHelper import *
import client.assets.fonts.FontsManager as Fonts
import client.assets.ColoursManager as Colours
class Button:
rect = None
rawRect = None
radius = None
textContent = None
text = None
textRect = None
padding = None
colour =... | Vishwas-Adiga/Bloks | client/widgets/Button.py | Python | apache-2.0 | 1,860 |
#!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo 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 ... | msbeta/apollo | modules/tools/record_analyzer/common/error_code_analyzer.py | Python | apache-2.0 | 1,499 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: fix_metaclass.py
"""Fixer for __metaclass__ = X -> (metaclass=X) methods.
The various forms of classef (inherits nothing, inherits once, inherint... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/lib2to3/fixes/fix_metaclass.py | Python | unlicense | 7,021 |
# coding=UTF-8
"""
This file is part of GObjectCreator.
GObjectCreator 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.
GObjectCreator is d... | ThomasBollmeier/GObjectCreator | gobject_creator/code_generation/bool_parser.py | Python | gpl-3.0 | 7,561 |
#Author: Imran
#Descri: Creating UDF
#from __future__ import printfunction;
import sys;
from pyspark.sql import SparkSession;
from collections import namedtuple;
#from pyspark.mllib.fpm import namedtuple
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: NamedTuple.py data_filepath");
exit(-1);... | ImrankEDW/PepoleEDA | peopleeda/NamedTuple.py | Python | gpl-3.0 | 1,073 |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | Dev-Cloud-Platform/Dev-Cloud | dev_cloud/cc1/src/wi/tests/test_clean.py | Python | apache-2.0 | 4,050 |
#!/usr/bin/env python
from __future__ import absolute_import, print_function
import os
import sys
from collections import defaultdict
import sqlalchemy as sql
import numpy as np
from scipy.stats import mode
import pysam
try:
basestring
except NameError:
basestring = str
from . import database
from .annotati... | udp3f/gemini | gemini/gemini_annotate.py | Python | mit | 14,300 |
"""
WSGI config for mocery_backend 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/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANG... | jensadne/mocery.com | mocery/wsgi.py | Python | mit | 405 |
#!/usr/bin/python
#
# PumpkinLB Copyright (c) 2014-2015, 2017 Tim Savannah under GPLv3.
# You should have received a copy of the license as LICENSE
#
# See: https://github.com/kata198/PumpkinLB
import math
import multiprocessing
import os
import platform
import socket
import sys
import signal
import threading
import ... | kata198/PumpkinLB | PumpkinLB.py | Python | gpl-3.0 | 5,868 |
import unittest
from gradefast.models import Path, SlotEqualityMixin
class TestSlotEqualityMixin(unittest.TestCase):
class Example(SlotEqualityMixin):
__slots__ = ("a", "b", "c")
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def test_equal... | jhartz/gradefast | gradefast/tests/test_models.py | Python | mit | 3,587 |
"""Containers module."""
import sqlite3
import boto3
from dependency_injector import containers, providers
from .user.containers import UserContainer
from .photo.containers import PhotoContainer
from .analytics.containers import AnalyticsContainer
class ApplicationContainer(containers.DeclarativeContainer):
c... | rmk135/objects | examples/miniapps/decoupled-packages/example/containers.py | Python | bsd-3-clause | 1,032 |
"""Test multiprocess runner timeout functionality.
This module contains tests for the multiprocess runner timeout functionality.
"""
# pylint: disable=protected-access,too-many-public-methods,invalid-name
from __future__ import absolute_import
import sys
import pytest
from tests.core.utils import MockSuite1, MockSui... | gregoil/rotest | tests/core/multiprocess/test_timeout.py | Python | mit | 6,193 |
from evosnap import constants
class TransactionTenderData:
def __init__(self, encryption_key_id=None, payment_account_data_token=None, secure_payment_account_data=None,
swipe_status=None, card_data=None, card_security_data=None, ecommerce_security_data=None):
"""
Base class object... | Zertifica/evosnap | evosnap/transactions/base/transaction_tender_data.py | Python | mit | 1,148 |
"""Metrics to assess performance on classification task given scores
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.... | ashhher3/scikit-learn | sklearn/metrics/ranking.py | Python | bsd-3-clause | 21,793 |
# A top-level interface to the whole of xia2, for data processing & analysis.
from __future__ import annotations
import glob
import itertools
import logging
import math
import os
import platform
import sys
import h5py
from dials.util import Sorry
from xia2.Handlers.Citations import Citations
from xia2.Handlers.Env... | xia2/xia2 | src/xia2/Applications/xia2_main.py | Python | bsd-3-clause | 6,698 |
import typing
import twittback
TweetSequence = typing.Sequence[twittback.Tweet]
UserSequence = typing.Sequence[twittback.User]
| dmerejkowsky/twittback | twittback/types.py | Python | mit | 130 |
"""
Domain Name System (TCP/IP protocol stack)
"""
from construct import *
from construct.protocols.layer3.ipv4 import IpAddressAdapter
class DnsStringAdapter(Adapter):
def _encode(self, obj, context):
parts = obj.split(".")
parts.append("")
return parts
def _decode(self, o... | larsks/pydonet | lib/pydonet/construct/protocols/application/dns.py | Python | gpl-2.0 | 3,980 |
'''
Setup script for pydzcvr
@author: Chip Boling
@copyright: 2015 Boling Consulting Solutions. All rights reserved.
@license: Artistic License 2.0, http://opensource.org/licenses/Artistic-2.0
@contact: support@bcsw.net
@deffield updated: Updated
'''
from setuptools import setup
from setuptools import find_pa... | cboling/SDNdbg | docs/old-stuff/pydzcvr/setup.py | Python | apache-2.0 | 1,599 |
import unittest
import sys, os, glob
project_root = os.getcwd()
test_root = os.path.dirname(os.path.abspath(__file__))
test_files = glob.glob(os.path.join(test_root, 'test_*.py'))
os.chdir(test_root)
test_names = [os.path.basename(name)[:-3] for name in test_files]
os.chdir(project_root)
suite = unittest.defaultTest... | begeekmyfriend/smithsnmp | tests/test_all.py | Python | gpl-2.0 | 540 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Andrés Aguirre Dorelo <aaguirre@fing.edu.uy>
# Rafael Carlos Cordano Ottati <rafael.cordano@gmail.com>
# Lucía Carozzi <lucia.carozzi@gmail.com>
# Maria Eugenia Curi <mauge8@gmail.com>
# Leonel Peña <lapo26@gmail.com>
#
# MINA/INCO/UDELAR
#
# This program is free softwar... | nvazquez/Turtlebots | plugins/xevents/xevents.py | Python | mit | 15,509 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The fsl module provides classes for interfacing with the `FSL
<http://www.fmrib.ox.ac.uk/fsl/index.html>`_ command line tools. This
was written to work with FSL version 4.1.4.
Change directory to p... | iglpdc/nipype | nipype/interfaces/fsl/dti.py | Python | bsd-3-clause | 64,843 |
"""
This module provides command line interface for the disassmbler.
"""
from argparse import ArgumentParser
from ..release import VERSION
from .rom_image import RomImage
from .mapper import make_mapper
from .statemachine import StateMachine
def create_argparser():
"""Return a command line parser for the applicat... | showa-yojyo/dqutils | dqutils/snescpu/disasm.py | Python | mit | 4,111 |
# Copyright 2016 Google 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | googledatalab/pydatalab | google/datalab/utils/_lambda_job.py | Python | apache-2.0 | 1,535 |
"""
Ppl class
"""
import os
import re
import pandas as pd
import numpy as np
class Ppl:
"""
Data extraction for ppl files (OLGA >= 6.0)
"""
def __init__(self, fname):
"""
Initialize the ppl attributes
"""
if fname.endswith(".ppl") is False:
... | gpagliuca/pyfas | pyfas/ppl.py | Python | gpl-3.0 | 5,841 |
"""
Implementation of Charikar similarity hashes in Python.
Most useful for creating 'fingerprints' of documents or metadata
so you can quickly find duplicates or cluster items.
Part of python-hashes by sangelone. See README and LICENSE.
"""
from .hashtype import hashtype
class simhash(hashtype):
def create_has... | subho007/androguard | elsim/elsim/similarity/simhash.py | Python | apache-2.0 | 2,154 |
import numpy as np
def ImperialisticCompetition(imperialists, imperialists_fitness, colonies, colonies_fitness, empires_total_cost):
dim = len(colonies[0][0])
if len(imperialists) <= 1:
return imperialists, imperialists_fitness, colonies, colonies_fitness, empires_total_cost
# Search for the ... | JJSrra/Research-SocioinspiredAlgorithms | ICA/ImperialisticCompetition.py | Python | mit | 2,574 |
import numpy as np
def sigmoid(x):
"""
Uses tanh() for a sigmoid function
:param x: The number to pass into the sigmoid function
:returns: tanh(x)
"""
return np.tanh(x)
def sigmoid_first_d(x):
"""
:param x: The outputs to pass into the sigmoid's first derivative function
:returns: The first derivative of th... | JakeCowton/Pok-e-Lol | ann/nn.py | Python | mit | 2,853 |
from tikon.central import Módulo, SimulMódulo, Exper, Parcela, Modelo, Coso
from tikon.ecs import ÁrbolEcs, CategEc, SubcategEc, Ecuación, EcuaciónVacía
class EcuaciónReqFalta(Ecuación):
nombre = 'req falta'
def eval(símismo, paso, sim):
pass
@classmethod
def requísitos(cls, controles=False)... | julienmalard/Tikon | pruebas/test_central/rcrs/req_ecuación_falta.py | Python | agpl-3.0 | 1,475 |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class ActorRole(object):
"""
NOTE: This class is auto ge... | kinow-io/kinow-python-sdk | kinow_client/models/actor_role.py | Python | apache-2.0 | 10,560 |
import pytest
import struct
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rlib.mutbuffer import MutableStringBuffer
class TestMutableStringBuffer(object):
def test_finish(self):
buf = MutableStringBuffer(4)
buf.setzeros(0, 4)
pytest.raises(ValueError, "buf.as_str()")
... | oblique-labs/pyVM | rpython/rlib/test/test_mutbuffer.py | Python | mit | 1,392 |
"""
Django settings for figexample project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | cosmoz/figtest_django | figexample/settings.py | Python | bsd-2-clause | 2,142 |
import logging
from django.http import JsonResponse, Http404
from django.shortcuts import render, get_object_or_404, redirect
from django.core.paginator import Paginator, EmptyPage
# from social_django.models import UserSocialAuth
from django.contrib.auth.models import User
from django.contrib.auth import logout
from ... | kartta-labs/reservoir | third_party/3dmr/mainapp/views.py | Python | apache-2.0 | 19,867 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import model
from . import wizard
| ddico/account-financial-tools | account_loan/__init__.py | Python | agpl-3.0 | 111 |
from __future__ import print_function, absolute_import, division
import math
import numbers
import numpy as np
from llvmlite import ir
from llvmlite.llvmpy.core import Type, Constant
import llvmlite.llvmpy.core as lc
from .imputils import (lower_builtin, lower_getattr, lower_getattr_generic,
... | stefanseefeld/numba | numba/targets/numbers.py | Python | bsd-2-clause | 43,944 |
# -*- encoding: utf-8 -*-
##############################################################################
# product_supplier_price_wizard
# Copyright (c) 2016 Francisco Manuel García Claramonte <francisco@garciac.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | fgclaramonte/Odoo-addons | product_supplier_price_wizard/__init__.py | Python | gpl-3.0 | 1,058 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import diaper
import fauxfactory
import hashlib
import iso8601
import random
import re
import command
import yaml
from contextlib import closing
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.core.mail... | anurag03/integration_tests | sprout/appliances/tasks.py | Python | gpl-2.0 | 100,873 |
import csv
import os
import pdb
previous = None
def main():
cwd = os.getcwd()
cwd = os.path.join(cwd, 'source files')
os.remove(os.path.join(cwd, 'names.csv'))
for f in os.listdir(cwd):
if f.endswith('.csv'):
path = os.path.join(cwd,f)
names = get_names(path)
with open(os.path.join(cwd, 'names.csv'), '... | elibol/saf-study | fix_csv.py | Python | mit | 483 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2020 SHS-AV s.r.l. (<http://www.zeroincombenze.org>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
"""
Zeroincombenze® unit test library for python programs Regression Test Suite
"""
from __future__ import print_function, unicode_literals
import os.pat... | antoniov/tools | zerobug/tests/zerobug_test_01.py | Python | agpl-3.0 | 1,224 |
from odoo.tests import common
class TestBase(common.TransactionCase):
at_install = False
post_install = True
def setUp(self):
super(TestBase, self).setUp()
self.config_param = self.env["ir.config_parameter"]
self.main_company = self.env.user.company_id
self.second_company ... | it-projects-llc/misc-addons | ir_config_parameter_multi_company/tests/test_base.py | Python | mit | 2,168 |
from mcpi import minecraft, block
import time
def flatWorld(mc, x, z):
mc.setBlocks(-10 + x,-10,-10 + z,10 + x,0,10 + z, block.GRASS.id)
mc.setBlocks(-10 + x,0,-10 + z,10 + x,35,10 + z, block.AIR.id)
mc = minecraft.Minecraft.create()
for xVal in range(-7, 7):
for zVal in range(-7, 7):
flatWorld... | Devoxx4KidsDE/workshop-minecraft-modding-raspberry-pi | flat_world/flatWorld.py | Python | mit | 418 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | google/cloud/aiplatform_v1/services/index_service/async_client.py | Python | apache-2.0 | 31,639 |
import copy
import datetime
from django.contrib.auth.models import User
from django.db import models
from django.db.models.query import Q
from django.utils.datastructures import SortedDict
class RevisionableModel(models.Model):
base = models.ForeignKey('self', null=True)
title = models.CharField(blank=True, ... | weigj/django-multidb | tests/regressiontests/extra_regress/models.py | Python | bsd-3-clause | 4,706 |
import StringIO
import threading
import time
from django.core import management
from django.db import connection
from django.test.testcases import TransactionTestCase
from olympia.amo.tests import ESTestCase, addon_factory, create_switch
from olympia.amo.urlresolvers import reverse
from olympia.amo.utils import urlpa... | atiqueahmedziad/addons-server | src/olympia/lib/es/tests/test_commands.py | Python | bsd-3-clause | 6,551 |
# -*- coding: utf-8 -*-
"""
Setuptools script for the apcaccess project.
"""
import os
from textwrap import fill, dedent
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
def required... | flyte/apcaccess | setup.py | Python | mit | 1,931 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['Lag1Trend'] , ['Seasonal_Hour'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_Lag1Trend_Seasonal_Hour_NoAR.py | Python | bsd-3-clause | 152 |
import os
import re
import sys
import time
import logging
from logging.handlers import TimedRotatingFileHandler
VERSION = "8.5.2"
class TimedRotatingFileHandlerCustomHeader(TimedRotatingFileHandler):
def __init__(self, filename, when='S', interval=10, backupCount=0, encoding=None, delay=False, utc=False, header_... | boisde/Greed_Island | snippets/rotate_log.py | Python | mit | 5,809 |
# coding: utf-8
__author__ = 'Administrator'
from DecodeHTML import *
import whyspider
import getAllPageLink
import os
import time
def begindown():
my_spider = whyspider.WhySpider()
source=getHtml('http://www.cl529.com/htm_data/16/1512/1775897.html')
picurl=getImage(source)
print(picurl)
for url in ... | wangfengfighting/Caoliu-master | downpic.py | Python | apache-2.0 | 2,427 |
import tty
import sys
import curses
import datetime
import locale
from decimal import Decimal
import getpass
import logging
from typing import TYPE_CHECKING
import electrum_ltc as electrum
from electrum_ltc import util
from electrum_ltc.util import format_satoshis
from electrum_ltc.bitcoin import is_address, COIN
from... | vialectrum/vialectrum | electrum_ltc/gui/text.py | Python | mit | 19,892 |
#!/usr/bin/python
import os
sjasmCmd = "sjasm"
tmpSrcFileName = "tmp.s"
tmpLstFileName = "tmp.lst"
tmpOutFileName = "tmp.bin"
def compileFile(outputString, fileName, variableList):
inFile = open(fileName, "rb")
outFile = open(tmpSrcFileName, "wb")
while True:
s = inFile.readline()
if s ==... | istvan-v/ep128emu | util/epcompress/z80_asm/makesfx.py | Python | gpl-2.0 | 3,384 |
import sys
import os
brief = "create a test for controller's method"
def usage(argv0):
print("Usage: {} generate test controller_method CONTROLLER_NAME METHOD".format(argv0))
sys.exit(1)
aliases = ['cm']
def execute(argv, argv0, engine):
import lib, inflection, re
os.environ.setdefault("AIOWEB_SE... | kreopt/aioweb | wyrm/modules/generate/test/controller_method.py | Python | mit | 1,445 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "onlineArchiver.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure th... | mrsdz/archiver-django | manage.py | Python | gpl-3.0 | 812 |
# encoding: utf-8
# module gtk.gdk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/pynotify/_pynotify.so
# by generator 1.135
# no doc
# imports
from exceptions import Warning
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
import pango as __pango
import pangocairo as __p... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/gtk/gdk/__init__/Screen.py | Python | gpl-2.0 | 4,507 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division, absolute_import
from datetime import timedelta, datetime
import pytest
from flexget.manager import Session
from flexget.plugins.internal.api_tvmaze import APITVMaze, TVMazeLookup, TVMazeSeries, TVMazeEpisodes
lookup_series = APITVMaze.series... | jawilson/Flexget | flexget/tests/test_tvmaze.py | Python | mit | 21,049 |
# Natural Language Toolkit: Generating RDF Triples from NL Relations
#
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
"""
This code shows how relational information extracted from text
can be converted into an RDF Graph.
"""
from nltk.sem.relextract im... | hectormartinez/rougexstem | taln2016/icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk_contrib/rdf.py | Python | apache-2.0 | 3,095 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.