text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
from app.app import db
class List(db.Model):
id = db.Column(db.Integer, primary_key=True)
locked = db.Column(db.Boolean)
weightclass_id = db.Column(db.Integer,
db.ForeignKey("weightclass.id"))
weightclass = db.relationship("Weightclass",
... | GuidoSchmidt/juli | src/models/list.py | Python | gpl-2.0 | 928 | 0 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | girving/tensorflow | tensorflow/python/ops/ctc_ops.py | Python | apache-2.0 | 13,730 | 0.002185 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Cloudscaling Group, 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/LI... | fajoy/nova | nova/openstack/common/rpc/impl_zmq.py | Python | apache-2.0 | 22,999 | 0.000217 |
from bs4 import BeautifulSoup
from datetime import datetime
from scraper import *
from general import General
def get_arrival_time(arrival_time_str):
time = datetime.strptime(arrival_time_str.strip(), '%H:%M:%S').time()
now = datetime.now()
arrival_time = datetime.combine(now, time)
return arrival_tim... | winiciuscota/OG-Bot | ogbot/scraping/movement.py | Python | mit | 3,821 | 0.003664 |
from flask.ext.script import Command, Manager, Option
from flask import current_app
import os
from subprocess import Popen
class InvalidPathException(Exception):
pass
class SyncJS(Command):
option_list = (
Option('--path', '-p', dest='path'),
)
def run_command(self, command):
cmd = P... | realizeapp/realize-core | core/commands/frontend.py | Python | agpl-3.0 | 1,248 | 0.004006 |
# Copyright 2016 NOKIA
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | naveensan1/nuage-openstack-neutron | nuage_neutron/plugins/common/service_plugins/l3.py | Python | apache-2.0 | 57,131 | 0.000035 |
import subprocess
import json
import collections
import random
import sys
def parse_json_result(out):
"""Parse the provided JSON text and extract a dict
representing the predicates described in the first solver result."""
result = json.loads(out)
assert len(result['Call']) > 0
assert len(result['Call'][0]['Witn... | dnalexander/CMPM146_P7 | p7_driver.py | Python | gpl-3.0 | 2,598 | 0.051193 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | houshengbo/nova_vmware_compute_driver | nova/utils.py | Python | apache-2.0 | 39,324 | 0.000509 |
# -*- coding: utf-8 -*-
#
# AWL simulator - instructions
#
# Copyright 2012-2014 Michael Buesch <m@bues.ch>
#
# 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
... | gion86/awlsim | awlsim/core/instructions/insn_gt_d.py | Python | gpl-2.0 | 1,598 | 0.015645 |
from rpython.jit.metainterp.test.test_list import ListTests
from rpython.jit.backend.x86.test.test_basic import Jit386Mixin
class TestList(Jit386Mixin, ListTests):
# for individual tests see
# ====> ../../../metainterp/test/test_list.py
pass
| jptomo/rpython-lang-scheme | rpython/jit/backend/x86/test/test_list.py | Python | mit | 256 | 0.003906 |
import ConfigParser
import datetime
import os
import posixpath
import re
import shutil
import tempfile
import time
import traceback
from mozdevice import adb
from mozlog.structured import get_default_logger
here = os.path.split(__file__)[0]
class WaitTimeout(Exception):
pass
class DeviceBackup(object):
de... | Conjuror/fxos-certsuite | mcts/utils/handlers/adb_b2g.py | Python | mpl-2.0 | 12,568 | 0.002387 |
from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddProductForm
def category_list(request):
return... | sunlaiqi/fundiy | src/shop/views.py | Python | mit | 1,636 | 0.005501 |
"""
WSGI config for credentials.
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 os.path import abspath, dirname
from sys import path
from django.core.wsgi import get_... | edx/credentials | credentials/wsgi.py | Python | agpl-3.0 | 559 | 0 |
"""
CloudStack Cloud Module
=======================
The CloudStack cloud module is used to control access to a CloudStack based
Public Cloud.
:depends: libcloud >= 0.15
Use of this module requires the ``apikey``, ``secretkey``, ``host`` and
``path`` parameters.
.. code-block:: yaml
my-cloudstack-cloud-config:
... | saltstack/salt | salt/cloud/clouds/cloudstack.py | Python | apache-2.0 | 17,835 | 0.000729 |
'''A module containing a class for storing Creature objects in a
SQLite database.'''
import csv
import sqlite3
__all__ = ['CreatureDB']
class CreatureDB(object):
'''Class for storing Creature objects in a SQLite database.'''
def __init__(self, name='creature.db', use_nominal_cr=False):
self.... | lot9s/pathfinder-rpg-utils | data-mining/bestiary/db/creatureDB.py | Python | mit | 6,403 | 0.00531 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | karllessard/tensorflow | tensorflow/python/keras/feature_column/sequence_feature_column_test.py | Python | apache-2.0 | 28,269 | 0.003007 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | memo/tensorflow | tensorflow/python/layers/core_test.py | Python | apache-2.0 | 14,077 | 0.006607 |
import json
import os
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import TestCase
UserModel = get_user_model()
class BaseTestCase(TestCase):
"""Utilidades para todos los tests relacionados con el sitio.
Incluye Fixtures para los modelos, propiedades a lo... | snicoper/snicoper.com | tests/unit/base_test.py | Python | mit | 2,024 | 0 |
import argparse
import logging
import signal
import time
from server.couchDB_resultwriter import CouchDbResultWriter as ResultWriter
import sys
import os
from utils import daemonize
from utils import get_logger
from utils import configure_logging
parser = argparse.ArgumentParser(description="MoniTunnel server")
parser... | its-lab/MoniTutor-Tunnel | start_couchDB_resultwriter.py | Python | gpl-3.0 | 2,457 | 0.002849 |
from collections.abc import Sequence, Iterable
from functools import total_ordering
import fnmatch
import linecache
import os.path
import pickle
# Import types and functions implemented in C
from _tracemalloc import *
from _tracemalloc import _get_object_traceback, _get_traces
def _format_size(size, sign... | prefetchnta/questlab | bin/x64bin/python/37/Lib/tracemalloc.py | Python | lgpl-2.1 | 17,610 | 0.000227 |
#!/usr/bin/env python
"""rna_filter.py - calculate distances based on given restrants on PDB files or SimRNA trajectories.
The format of restraints::
(d:A1-A2 < 10.0 1) = if distance between A1 and A2 lower than 10.0, score it with 1
Usage::
$ python rna_filter.py -r test_data/restraints.txt -s test_data/C... | mmagnus/rna-pdb-tools | rna_tools/tools/rna_filter/rna_get_dists.py | Python | gpl-3.0 | 9,035 | 0.006419 |
import simplejson as json
import os
import subprocess
import sys
import unittest
if sys.version_info.major >= 3:
from http.server import HTTPServer
from http.server import BaseHTTPRequestHandler
else:
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
tests_dir = o... | backtrace-labs/backtrace-python | tests/__init__.py | Python | mit | 3,903 | 0.003587 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | abhishek-ch/hue | desktop/core/src/desktop/conf.py | Python | apache-2.0 | 37,361 | 0.009716 |
# -*- coding: utf-8 -*-
def outfit():
collection = []
for _ in range(0, 5):
collection.append("Item{}".format(_))
return {
"data": collection,
}
api = [
('/outfit', 'outfit', outfit),
]
| Drachenfels/Game-yolo-archer | server/api/outfits.py | Python | gpl-2.0 | 228 | 0 |
# -*- coding: utf-8 -*-
from .input import Input
class ListInput(Input):
"""
ListInput represents an input provided as an array.
Usage:
>>> input_ = ListInput([('name', 'foo'), ('--bar', 'foobar')])
"""
def __init__(self, parameters, definition=None):
"""
Constructor
... | Romibuzi/cleo | cleo/inputs/list_input.py | Python | mit | 4,973 | 0.000804 |
#! /usr/bin/env python
#-*- coding: utf-8 -*-
# ***** BEGIN LICENSE BLOCK *****
# This file is part of Shelter Database.
# Copyright (c) 2016 Luxembourg Institute of Science and Technology.
# All rights reserved.
#
#
#
# ***** END LICENSE BLOCK *****
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.2 $"
__d... | rodekruis/shelter-database | src/web/views/session_mgmt.py | Python | mit | 5,400 | 0.003704 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/tione/v20191022/models.py | Python | mit | 91,250 | 0.002541 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2018 Fortinet, 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 3 of the Lic... | marc-sensenich/ansible | lib/ansible/modules/network/fortios/fortios_webfilter_urlfilter.py | Python | gpl-3.0 | 12,762 | 0.001254 |
# -*- coding: utf-8 -*-
from sqlalchemy import func, distinct
from sqlalchemy.orm import aliased
from sqlalchemy.sql.expression import literal
from rbm2m.models import Record, Image, Scan, Genre, scan_records
def get_overview(sess):
"""
Returns aggregated statistics about records, scans, genres etc
""... | notapresent/rbm2m | rbm2m/action/stats.py | Python | apache-2.0 | 2,721 | 0 |
import pytest
from plenum.common.startable import Mode
def test_can_send_3pc_batch_by_primary_only(primary_orderer):
assert primary_orderer.can_send_3pc_batch()
primary_orderer._data.primary_name = "SomeNode:0"
assert not primary_orderer.can_send_3pc_batch()
def test_can_send_3pc_batch_not_participatin... | evernym/zeno | plenum/test/consensus/order_service/test_can_send_3pc.py | Python | apache-2.0 | 5,936 | 0.002695 |
#!/usr/bin/env python
"""file_utils.py: convenient file operations used by derpbox"""
__author__ = "Waris Boonyasiriwat"
__copyright__ = "Copyright 2017"
import os
import hashlib
def md5(filename):
hash_md5 = hashlib.md5()
with open(filename, "rb") as f:
for chunk in iter(lambda: f.read(4096), b"")... | warisb/derpbox | DerpBox/file_utils.py | Python | mit | 1,062 | 0 |
#!/usr/bin/python
from subprocess import call
import sys
import os
from socket import *
cs = socket(AF_INET, SOCK_DGRAM)
cs.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
cs.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
###Broadcast according to client group
#Show ports associated with a particular group
file = "group_port.txt" ... | Colviz/Vince | groups/group_server.py | Python | apache-2.0 | 2,451 | 0.020808 |
try:
import urlparse
except ImportError:
#py3k
from urllib import parse as urlparse
import json
from .firebase_token_generator import FirebaseTokenGenerator
from .decorators import http_connection
from .multiprocess_pool import process_pool
from .jsonutil import JSONEncoder
__all__ = ['FirebaseAuthentic... | neversun/sailfish-hackernews | pyPackages/python_firebase-noarch/firebase/firebase.py | Python | mit | 16,320 | 0.001287 |
# -*- coding: UTF-8 -*-
# Copyright 2016 Luc Saffre
# License: BSD (see file COPYING for details)
from lino.api import dd, _
class PartnerEvents(dd.ChoiceList):
verbose_name = _("Observed event")
verbose_name_plural = _("Observed events")
max_length = 50
| khchine5/xl | lino_xl/lib/contacts/choicelists.py | Python | bsd-2-clause | 272 | 0.003676 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | Lilykos/invenio | invenio/celery/tasks.py | Python | gpl-2.0 | 1,196 | 0 |
from .utils.process import to_http
from .consts import BASIC_SERIALIZATION
def serialization(basic=BASIC_SERIALIZATION):
def decorator(view):
def wrapper(request, *args, **kwargs):
response = view(request, *args, **kwargs)
return to_http(request, response, basic_serialization=basic)... | laginha/django-easy-response | src/easy_response/decorators.py | Python | mit | 366 | 0.005464 |
import os
import time
from abc import abstractmethod, ABC
from typing import Dict, Tuple, List
from cereal import car
from common.kalman.simple_kalman import KF1D
from common.realtime import DT_CTRL
from selfdrive.car import gen_empty_fingerprint
from selfdrive.config import Conversions as CV
from selfdrive.controls.l... | commaai/openpilot | selfdrive/car/interfaces.py | Python | mit | 9,765 | 0.009421 |
"""
Implementation of the paper,
Durand and Dorsey SIGGGRAPH 2002,
"Fast Bilateral Fitering for the display of high-dynamic range images"
"""
import numpy as np
import hydra.io
import hydra.filters
def bilateral_separation(img, sigma_s=0.02, sigma_r=0.4):
r, c = img.shape
sigma_s = max(r, c) * sigma_s
... | tatsy/hydra | hydra/tonemap/durand.py | Python | mit | 1,367 | 0.008047 |
import unittest
from shadowcraft.objects import race
class TestRace(unittest.TestCase):
def setUp(self):
self.race = race.Race('human')
def test__init__(self):
self.assertEqual(self.race.race_name, 'human')
self.assertEqual(self.race.character_class, 'rogue')
def test_set_racials(... | Fierydemise/ShadowCraft-Engine | tests/objects_tests/race_tests.py | Python | lgpl-3.0 | 2,806 | 0.003207 |
import socket
import threading
import time
def tcplink(sock, addr):
print 'Accept new connection from %s:%s...' % addr
sock.send('Welcome!')
while True:
data = sock.recv(1024)
time.sleep(1)
if data == 'exit' or not data:
break
sock.send('Hello, %s!' %... | lovekun/Notebook | python/chatroomServer.py | Python | gpl-2.0 | 654 | 0.003058 |
# Written by Mike Smith michaeltsmith.org.uk
from __future__ import division
import numpy as np
from .kern import Kern
from ...core.parameterization import Param
from paramz.transformations import Logexp
import math
class Multidimensional_Integral_Limits(Kern): #todo do I need to inherit from Stationary
"""
I... | ysekky/GPy | GPy/kern/src/multidimensional_integral_limits.py | Python | bsd-3-clause | 6,207 | 0.020622 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | QiJune/Paddle | python/paddle/trainer_config_helpers/tests/configs/projections.py | Python | apache-2.0 | 2,317 | 0 |
# MenuTitle: Copy to Background, Decompose, Remove Overlaps, Correct Path Direction
for layer in Glyphs.font.selectedLayers:
g = layer.parent
for l in g.layers:
l.background = l.copy()
l.decomposeComponents()
l.removeOverlap()
l.correctPathDirection()
| jenskutilek/Glyphs-Scripts | Glyphs/DecRO.py | Python | mit | 292 | 0.006849 |
#!/usr/bin/env python
# Copyright 2012 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 ... | paulftw/titan-files | tests/files/dirs_test.py | Python | apache-2.0 | 5,379 | 0.001487 |
from django.conf import settings
from django.test.client import Client
from .base import BaseRenderer
from django_perseus.exceptions import RendererException
import logging
import mimetypes
import os
logger = logging.getLogger('perseus')
class DefaultRenderer(BaseRenderer):
def render_path(self, path=None, v... | lockwooddev/django-perseus | django_perseus/renderers/default.py | Python | mit | 2,589 | 0.001159 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('lab_members', '0012_scientist_email'),
]
operations = [
migrations.AddField(
model_name='advisor',
n... | mfcovington/django-lab-members | lab_members/migrations/0013_advisor_url.py | Python | bsd-3-clause | 517 | 0.001934 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Mark',
fields=[
('id', models.AutoField(verbose_name... | CarlFK/veyepar | dj/main/migrations/0002_auto_20160116_2028.py | Python | mit | 1,005 | 0.002985 |
#!/usr/bin/env python
###############################################################################
# $Id: ogr_gpsbabel.py 33793 2016-03-26 13:02:07Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: Test read functionality for OGR GPSBabel driver.
# Author: Even Rouault <even dot rouault at mines dash paris ... | nextgis-extra/tests | lib_gdal/ogr/ogr_gpsbabel.py | Python | gpl-2.0 | 4,660 | 0.00515 |
# RUN: %python -m artiq.compiler.testbench.signature +diag %s >%t
# RUN: OutputCheck %s --file-to-check=%t
def f():
delay_mu(2)
def g():
delay_mu(2)
x = f if True else g
def h():
with interleave:
f()
# CHECK-L: ${LINE:+1}: fatal: it is not possible to interleave this function call within... | JQIamo/artiq | artiq/test/lit/interleaving/error_inlining.py | Python | lgpl-3.0 | 447 | 0.008949 |
from django.conf import settings
from mako.template import Template
import os
def include_mustache_templates():
mustache_dir = settings.PROJECT_ROOT / 'templates' / 'discussion' / 'mustache'
def is_valid_file_name(file_name):
return file_name.endswith('.mustache')
def read_file(file_name):
... | malishevg/edugraph | lms/djangoapps/django_comment_client/helpers.py | Python | agpl-3.0 | 926 | 0.007559 |
for _ in range(int(input())):
N, K = map(int, input().split())
print("YES" if all(a + b >= K for a, b in zip(sorted(int(x) for x in input().split()), reversed(sorted(int(x) for x in input().split())))) else "NO")
| knuu/competitive-programming | hackerrank/algorithm/two_arrays.py | Python | mit | 221 | 0.004525 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import copy
import warnings
from itertools import chain
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from haystack import fields as haystack_fields
from haystack.query import EmptySearchQuerySet
... | fladi/drf-haystack | drf_haystack/serializers.py | Python | mit | 10,695 | 0.002525 |
# -*- coding: utf-8 -*-
# Copyright 2015 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | alexhersh/calico | calico/felix/test/__init__.py | Python | apache-2.0 | 659 | 0 |
# coding:utf-8
from django.contrib.auth.models import User
from django.db import models
from block.models import Block
# Create your models here.
class Article(models.Model):
block = models.ForeignKey(Block, verbose_name=u"所属板块")
owner = models.ForeignKey(User, verbose_name=u"作者")
title = models.CharField(verbose... | zalax303/test_django | myforum/article/models.py | Python | apache-2.0 | 786 | 0.01752 |
#!/usr/bin/env python
#
# Copyright 2010-2011 The Regents of the University of California
#
# 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
#... | TonyApuzzo/fuzzyjoin | fuzzyjoin-hadoop/src/test/scripts/plot/timeline.py | Python | apache-2.0 | 2,845 | 0.027768 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2006 Lukáš Lalinský
#
# 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... | mineo/picard | picard/ui/infodialog.py | Python | gpl-2.0 | 15,013 | 0.001666 |
#
# 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 n... | wangyixiaohuihui/spark2-annotation | python/pyspark/sql/utils.py | Python | apache-2.0 | 4,112 | 0.001946 |
import sys
import os
if len(sys.argv) != 3:
print "Useage: %s path size"
path = sys.argv[1]
size = int(sys.argv[2])
if not os.path.isdir(os.path.dirname(path)):
os.mkdir(os.path.dirname(path))
writefile = open(path, 'w')
writefile.seek(1024 * 1024 * size)
writefile.write('\x00')
writefile.close()
| autotest/virt-test | shared/scripts/dd.py | Python | gpl-2.0 | 310 | 0 |
# stdlib, alphabetical
from __future__ import absolute_import
import datetime
import errno
import logging
import os
import re
import shutil
import stat
import subprocess
import tempfile
# Core Django, alphabetical
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.transla... | artefactual/archivematica-storage-service | storage_service/locations/models/space.py | Python | agpl-3.0 | 35,298 | 0.00187 |
##
# Copyright 2012-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | akesandgren/easybuild-framework | test/framework/module_generator.py | Python | gpl-2.0 | 69,283 | 0.003464 |
#!/usr/bin/env python
# coding=utf-8
"""489. Common factors between two sequences
https://projecteuler.net/problem=489
Let G(a, b) be the smallest non-negative integer n for which gcd(n3 \+ b, (n
\+ a)3 \+ b) is maximized.
For example, G(1, 1) = 5 because gcd(n3 \+ 1, (n \+ 1)3 \+ 1) reaches its
maximum value of 7 ... | openqt/algorithms | projecteuler/pe489-common-factors-between-two-sequences.py | Python | gpl-3.0 | 506 | 0.018182 |
"""
Smart Symbols.
pymdownx.smartsymbols
Really simple plugin to add support for:
copyright, trademark, and registered symbols
plus/minus, not equal, arrows via:
copyright = `(c)`
trademark = `(tm)`
registered = `(r)`
plus/minus = `+/-`
care/of = `c/o`
fractions = `1/2` etc.
... | facelessuser/sublime-markdown-popups | st3/mdpopups/pymdownx/smartsymbols.py | Python | mit | 5,483 | 0.002371 |
import pytest
from pandas.errors import OutOfBoundsDatetime
import pandas as pd
from pandas import Period, offsets
from pandas.util import testing as tm
from pandas._libs.tslibs.frequencies import _period_code_map
class TestFreqConversion(object):
"""Test frequency conversion of date objects"""
@pytest.mark... | pratapvardhan/pandas | pandas/tests/scalar/period/test_asfreq.py | Python | bsd-3-clause | 36,821 | 0 |
# This file is part of MSMTools.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# MSMTools is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either ... | trendelkampschroer/msmtools | msmtools/analysis/dense/correlations.py | Python | lgpl-3.0 | 10,071 | 0.001986 |
"""
This script combines training_OnlineContrastiveLoss.py with training_MultipleNegativesRankingLoss.py
Online constrative loss works well for classification (are question1 and question2 duplicates?), but it
performs less well for duplicate questions mining. MultipleNegativesRankingLoss works well for duplicate
quest... | UKPLab/sentence-transformers | examples/training/quora_duplicate_questions/training_multi-task-learning.py | Python | apache-2.0 | 9,356 | 0.007482 |
# 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
"""
TLS handshake fields & logic.
This module covers the handshake TLS subprotocol, except for the key exchange
mechanisms which are addressed wi... | mtury/scapy | scapy/layers/tls/handshake.py | Python | gpl-2.0 | 61,432 | 0 |
import discord
async def donate(cmd, message, args):
if args:
if args[0] == 'mini':
mini = True
else:
mini = False
else:
mini = False
sigma_image = 'https://i.imgur.com/mGyqMe1.png'
sigma_title = 'Sigma Donation Information'
patreon_url = 'https://ww... | AXAz0r/apex-sigma-core | sigma/modules/help/donate.py | Python | gpl-3.0 | 1,698 | 0.0053 |
""" tests can be run from the root dir with:
clean-pyc && \
APP_ID= APP_KEY= coverage run --source=. --branch `which nosetests` tests/* &&\
coverage html
"""
import os
from unittest import TestCase
from mock import patch
from dandelion import Datagem, DandelionException, DataTXT, default_config
from dandelion.base im... | SpazioDati/python-dandelion-eu | tests/base.py | Python | gpl-2.0 | 4,228 | 0 |
from cms.utils.urlutils import admin_reverse
from django.core.urlresolvers import reverse
from cms.utils import get_language_from_request
from cms.utils.compat.dj import python_2_unicode_compatible
from django.db import models
from cms.models.fields import PlaceholderField
from hvad.models import TranslatableModel, Tra... | amaozhao/basecms | cms/test_utils/project/placeholderapp/models.py | Python | mit | 3,065 | 0.001305 |
from __future__ import print_function
from pandas import DataFrame
from pandas.compat import range, zip
import timeit
setup = """
from pandas import Series
import pandas._tseries as _tseries
from pandas.compat import range
import random
import numpy as np
def better_unique(values):
uniques = _tseries.fast_unique(... | linebp/pandas | bench/better_unique.py | Python | bsd-3-clause | 2,143 | 0 |
"""FAQ Wizard customization module.
Edit this file to customize the FAQ Wizard. For normal purposes, you
should only have to change the FAQ section titles and the small group
of parameters below it.
"""
# Titles of FAQ sections
SECTION_TITLES = {
# SectionNumber : SectionTitle; need at least one ent... | google/google-ctf | third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqconf.py | Python | apache-2.0 | 15,699 | 0.001784 |
#!/usr/bin/python
# Author: Zion Orent <zorent@ics.com>
# Copyright (c) 2015 Intel Corporation.
#
# 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 limi... | sasmita/upm | examples/python/grovewfs.py | Python | mit | 2,489 | 0.002009 |
from Networking import Networking
from Model import Playlist
from SpotifyAPI import SpotifyAPI
import Security
import json
class PlaylistAPI(SpotifyAPI):
base_url = "https://api.spotify.com"
def __init__(self, categoryID):
super(PlaylistAPI, self).__init__()
self.list_of_playlist = []
... | fbuitron/FBMusic_ML_be | BATCH/PlaylistAPI.py | Python | apache-2.0 | 1,427 | 0.006307 |
u"""
This is the daemon that must be launched in order to detect motion
and launch signals.
"""
from __future__ import unicode_literals
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
from detection import PirDetector
from busy_processor import RoomBusyStatus
import settings
# Importing motion listeners
... | gleseur/room-status | detector/daemon.py | Python | mit | 1,629 | 0.006139 |
from adsws.testsuite import make_test_suite, \
run_test_suite, AdsWSAppTestCase, FlaskAppTestCase, AdsWSTestCase
import os
import inspect
import tempfile
class FactoryTest(FlaskAppTestCase):
@property
def config(self):
return {
'SQLALCHEMY_DATABASE_URI' : 'sqlite://',
'... | ehenneken/adsws | adsws/tests/test_factory.py | Python | gpl-2.0 | 1,777 | 0.011255 |
# -*- coding: utf-8 -*-
import numbers
import numpy as np
from ..constants import BOLTZMANN_IN_MEV_K
from ..energy import Energy
class Analysis(object):
r"""Class containing methods for the Data class
Attributes
----------
detailed_balance_factor
Methods
-------
integrate
position
... | neutronpy/neutronpy | neutronpy/data/analysis.py | Python | mit | 8,726 | 0.00149 |
# coding: utf-8
import datetime
from sqlalchemy.engine import create_engine
from sqlalchemy.ext.declarative.api import declarative_base
from sqlalchemy.orm.scoping import scoped_session
from sqlalchemy.orm.session import sessionmaker
import imp
from migrate.versioning import api
engine = create_engine('sqlite:///py... | PyIran/website | project/database.py | Python | gpl-3.0 | 2,785 | 0.023339 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | wubr2000/googleads-python-lib | examples/dfa/v1_20/add_advertiser_user_filter.py | Python | apache-2.0 | 2,962 | 0.005402 |
"""Tests for the zip storage module"""
import os
from zipfile import ZipFile
from translate.storage import zip
class TestZIPFile:
"""A test class to test the zip class that provides the directory interface."""
def setup_method(self, method):
"""sets up a test directory"""
print("setup_metho... | translate/translate | translate/storage/test_zip.py | Python | gpl-2.0 | 2,697 | 0.000371 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# config.py
#
# Copyright 2013 Cinnarch
#
# 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... | axaxs/Cnchi | src/config.py | Python | gpl-3.0 | 1,966 | 0.03001 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | nburn42/tensorflow | tensorflow/python/framework/random_seed.py | Python | apache-2.0 | 5,903 | 0.003219 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 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 behavior of headers messages to announce blocks.
Setup:
- Two nodes:
- node0 is the node-und... | ericshawlinux/bitcoin | test/functional/p2p_sendheaders.py | Python | mit | 26,656 | 0.002251 |
# coding: utf-8
import json
import sys
import codecs
python3 = False
if sys.version_info[0] == 3: #Python 3
python3 = True
if not python3:
reload(sys)
sys.setdefaultencoding("utf-8")
input = raw_input
def parseHTML(file_path):
fo = codecs.open(file_path, encoding='utf-8', mode='r+')
origina... | gordon-zhao/Chrome_bookmarks_to_json | src/python/html2json.py | Python | mit | 4,599 | 0.006741 |
import GPy
import numpy as np
from scipy.optimize import check_grad
from emukit.bayesian_optimization.acquisitions import MultipointExpectedImprovement
from emukit.model_wrappers import GPyModelWrapper
# Tolerance needs to be quite high since the q-EI is also an approximation.
TOL = 5e-3
# Tolerance for the gradient ... | EmuKit/emukit | tests/emukit/bayesian_optimization/test_multipoint_expected_improvement.py | Python | apache-2.0 | 2,394 | 0.002924 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PerlInline(PerlPackage):
"""Write Perl Subroutines in Other Programming Languages"""
... | LLNL/spack | var/spack/repos/builtin/packages/perl-inline/package.py | Python | lgpl-2.1 | 603 | 0.004975 |
import bpy
from functions import *
class Combination():
'''A class containing all properties and methods
relative to combination settings for
Curve To Frame addon'''
def update_curves( self, context ):
'''method that must be over ride: update curve when settings have been changed'''
type(self).update_curv... | CaptainDesAstres/Frames-Animated-By-Curve | single_track/Combination.py | Python | gpl-3.0 | 4,675 | 0.056769 |
import unittest
from scripts.migrate_to_whatsapp_templates.prebirth5 import Prebirth5Migration
class Testprebirth5(unittest.TestCase):
def setUp(self):
self.prebirth5 = Prebirth5Migration()
def test_sequence_number_to_weeks(self):
"""
Given a certain sequence number for the prebirth ... | praekeltfoundation/ndoh-hub | scripts/migrate_to_whatsapp_templates/tests/test_prebirth5.py | Python | bsd-3-clause | 1,231 | 0.001625 |
# -*- coding: utf-8 -*-
__author__ = 'iwdev1'
from .settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'pizza_db',
'USER': 'root',
'PASSWORD': 'A8d32e08.',
'HOST': '',
'PORT': '',
}
}
ALLOWED_HOSTS = []
STATIC_ROOT = ''
... | vellonce/PizzaFria | pizzafria/localsettings.py | Python | gpl-2.0 | 585 | 0.001709 |
# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
depends_on = (
('product', '0010_add_discountable_categories'),
)
def forwards(self, orm):
db.rename_table('product_downloadableproduct', 'downloadable_downloadableproduct')
... | dokterbob/satchmo | satchmo/apps/product/modules/downloadable/migrations/0001_split.py | Python | bsd-3-clause | 18,953 | 0.007862 |
# -*- coding: utf-8 -*-
{
'author': "Moldeo Interactive,ADHOC SA,Odoo Community Association (OCA)",
'category': 'Localization/Argentina',
'depends': [
'partner_identification',
# this is for demo data, for fiscal position data on account
# and also beacuse it is essential for argenti... | jobiols/odoo-argentina | l10n_ar_partner/__openerp__.py | Python | agpl-3.0 | 1,050 | 0 |
# Caolan McNamara caolanm@redhat.com
# a simple email mailmerge component
# manual installation for hackers, not necessary for users
# cp mailmerge.py /usr/lib/libreoffice/program
# cd /usr/lib/libreoffice/program
# ./unopkg add --shared mailmerge.py
# edit ~/.openoffice.org2/user/registry/data/org/openoffice/Office/W... | beppec56/core | scripting/source/pyprov/mailmerge.py | Python | gpl-3.0 | 17,916 | 0.030196 |
from __future__ import unicode_literals
from frappe import _
app_name = "erpnext"
app_title = "ERPNext"
app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = """ERP made simple"""
app_icon = "fa fa-th"
app_color = "#e74c3c"
app_email = "info@erpnext.com"
app_license = "GNU General Public License (v3)"
sour... | ESS-LLP/erpnext | erpnext/hooks.py | Python | gpl-3.0 | 28,711 | 0.021351 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from setuptools.command.test import test
REQUIREMENTS = (
"six",
)
with open("README.rst", "r") as resource:
LONG_DESCRIPTION = resource.read()
# copypasted from http://pytest.org/latest/goodpractises.html
class Py... | 9seconds/isitbullshit | setup.py | Python | mit | 2,097 | 0 |
# Copyright (C) 2014 Rémi Bèges
# For conditions of distribution and use, see copyright notice in the LICENSE file
from distantio.DistantIO import DistantIO
from distantio.DistantIOProtocol import distantio_protocol
from distantio.SerialPort import SerialPort
from distantio.crc import crc16
| Overdrivr/DistantIO | distantio/__init__.py | Python | mit | 295 | 0.003413 |
import numpy as np
from itertools import product
from learning.model_free import Problem
from learning.model_free import sarsa
from learning.model_free import qlearning
from learning.model_free import mc_value_iteration
from learning.model_free import sarsa_lambda
from learning.model_free import q_lambda
# from learn... | paulorauber/rl | examples/blackjack.py | Python | mit | 5,813 | 0.001892 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('editorial', '0049_auto_20171116_1526'),
]
operations = [
migrations.AlterField(
model_name='facet',
... | ProjectFacet/facet | project/editorial/migrations/0050_auto_20171117_1716.py | Python | mit | 437 | 0.002288 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Spyder terminal default configuration."""
import os
import sys
WINDOWS = os.name == 'nt'
LINUX = sys.platform.startswith('linux')
CONF_SECTION = 'terminal'
CON... | spyder-ide/spyder-terminal | spyder_terminal/config.py | Python | mit | 1,346 | 0.000743 |
def token_encryption_algorithm():
return 'HS256' | aaivazis/nautilus | nautilus/auth/util/token_encryption_algorithm.py | Python | mit | 52 | 0.019231 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.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.0',
... | fernandezcuesta/ansible | lib/ansible/modules/cloud/vmware/vmware_dvswitch.py | Python | gpl-3.0 | 7,199 | 0.001945 |
#encoding:utf-8
subreddit = 'BaPCSalesEurope'
t_channel = '@r_BaPCSalesEurope'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/r_bapcsaleseurope/app.py | Python | mit | 153 | 0.006536 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.