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 |
|---|---|---|---|---|---|---|
import os
from nose.tools import eq_
import mapnik
from .utilities import execution_path, run_all
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
if 'shape' in mapnik.DatasourceCache.plugin_names():
de... | mapycz/python-mapnik | test/python_tests/query_tolerance_test.py | Python | lgpl-2.1 | 1,397 | 0.000716 |
"""SCons.Tool.aixc++
Tool-specific initialization for IBM xlC / Visual Age C++ compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is h... | IljaGrebel/OpenWrt-SDK-imx6_HummingBoard | staging_dir/host/lib/scons-2.3.5/SCons/Tool/aixc++.py | Python | gpl-2.0 | 2,413 | 0.002072 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Company',
fields=[
('id', models.AutoField(verb... | guoqiao/django-nzpower | nzpower/migrations/0001_initial.py | Python | mit | 981 | 0.001019 |
# Copyright DataStax, 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 applicable law or agreed to in writing, softwa... | datastax/python-driver | tests/integration/cloud/test_cloud.py | Python | apache-2.0 | 10,950 | 0.003288 |
from django.core.urlresolvers import reverse
from django.db import models
from gamesoup.games.models import *
class Match(models.Model):
game = models.ForeignKey(Game)
state = models.TextField(blank=True)
def __unicode__(self):
return self.game.name
class Meta:
verbose_name_plural = ... | ktonon/GameSoup | gamesoup/matches/models.py | Python | mit | 520 | 0.003846 |
from mock import patch
from pip.vcs.git import Git
from tests.test_pip import (reset_env, run_pip,
_create_test_package,)
from tests.git_submodule_helpers import (
_change_test_package_submodule,
_pull_in_submodule_changes_to_module,
_create_test_package_with_submodule,
)
d... | domenkozar/pip | tests/test_vcs_git.py | Python | mit | 3,904 | 0.001281 |
# coding: utf8
# Copyright 2014-2017 CERN. This software is distributed under the
# terms of the GNU General Public Licence version 3 (GPL Version 3),
# copied verbatim in the file LICENCE.md.
# In applying this licence, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an I... | blond-admin/BLonD | __EXAMPLES/main_files/EX_07_Ions.py | Python | gpl-3.0 | 6,437 | 0.010253 |
#SPDX-License-Identifier: MIT
import io
import os
import re
from setuptools import find_packages
from setuptools import setup
def read(filename):
filename = os.path.join(os.path.dirname(__file__), filename)
text_type = type(u"")
with io.open(filename, mode="r", encoding='utf-8') as fd:
return re.s... | OSSHealth/ghdata | workers/insight_worker/setup.py | Python | mit | 1,388 | 0.003602 |
# -*- coding: utf-8 -*-
import json
from . import check_input_attribute, standard_error_message
from pyipasnhistory import IPASNHistory
from pymisp import MISPAttribute, MISPEvent, MISPObject
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst'], 'format': 'misp_standard'}
moduleinfo = {'ver... | VirusTotal/misp-modules | misp_modules/modules/expansion/ipasn.py | Python | agpl-3.0 | 2,208 | 0.002266 |
"""
=======================================================
Permutation F-test on sensor data with 1D cluster level
=======================================================
One tests if the evoked response is significantly different
between conditions. Multiple comparison problem is addressed
with cluster level permuta... | rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | python-packages/mne-python-0.10/examples/stats/plot_cluster_stats_evoked.py | Python | bsd-3-clause | 2,991 | 0 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/xsky_path9.py | Python | apache-2.0 | 2,040 | 0.015196 |
import scipy
import numpy
import matplotlib.pyplot as pyplot
import pyfits
import VLTTools
ciao = VLTTools.VLTConnection(simulate=False)
ciao.get_InteractionMatrices()
ciao.dumpCommandMatrix(nFiltModes=10)
print "This is where we will Compute the Modal Basis from the IMs"
| soylentdeen/CIAO-commissioning-tools | sandbox/dumpModalBasis.py | Python | mit | 275 | 0 |
# -*- coding: utf-8 -*-
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
#... | ujdhesa/unisubs | utils/tests/multiqueryset.py | Python | agpl-3.0 | 4,283 | 0.000467 |
# Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | google/ml_collections | ml_collections/config_flags/examples/define_config_dataclass_basic.py | Python | apache-2.0 | 1,322 | 0.004539 |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the ... | Micronaet/micronaet-mx8 | mx_pick_in/__openerp__.py | Python | agpl-3.0 | 1,557 | 0.001285 |
import re
import quantities as pq
from numbers import NumberService
class ConversionService(object):
__exponents__ = {
'square': 2,
'squared': 2,
'cubed': 3
}
def _preprocess(self, input):
def handleExponents(input):
m = re.search(r'\bsquare (\w+)', input)
... | jobdash/semantic | semantic/units.py | Python | mit | 4,744 | 0.000211 |
# -*- coding: utf-8 -*-
# Copyright (C) 2007-2018, Raffaele Salmaso <raffaele@salmaso.org>
# Copyright (c) 2012 Omoto Kenji
# Copyright (c) 2011 Sam Stephenson
# Copyright (c) 2011 Josh Peek
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation... | rsalmaso/django-babeljs | babeljs/execjs/runtime.py | Python | mit | 8,806 | 0.000908 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the Account Settings page.
"""
from datetime import datetime
from unittest import skip
import pytest
from bok_choy.page_object import XSS_INJECTION
from pytz import timezone, utc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage, FULL_NAME
from com... | philanthropy-u/edx-platform | common/test/acceptance/tests/lms/test_account_settings.py | Python | agpl-3.0 | 21,442 | 0.002798 |
#
# SNMPv1 message syntax
#
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc1157.txt
#
# Sample captures from:
# http://wiki.wireshark.org/SampleCaptures/
#
from pyasn1.type import univ, namedtype, namedval, tag
from pyasn1_modules import rfc1155
class Version(univ.Integer):
namedValues = namedval.NamedValues(
... | itielshwartz/BackendApi | lib/pyasn1_modules/rfc1157.py | Python | apache-2.0 | 3,309 | 0.001511 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
from... | kwlzn/pants | tests/python/pants_test/engine/test_storage.py | Python | apache-2.0 | 4,071 | 0.012282 |
import pymongo
class BaseMigration(object):
def __init__(self,
host='127.0.0.1',
port='27017',
database=None,
user=None,
password=None,
url=None):
if url and database and user is not None: #provide auth_d... | DoubleCiti/mongodb-migrations | mongodb_migrations/base.py | Python | gpl-3.0 | 967 | 0.004137 |
import unittest
from graph_search import Graph
from graph_topological_ordering import find_topological_order
class TestGraphTopologicalOrdering(unittest.TestCase):
def check_labels(self, graph, smaller, larger):
self.assertTrue(graph.get_node(smaller).label < graph.get_node(larger).label)
def test_1(... | codebox/algorithms | test_graph_topological_ordering.py | Python | mit | 943 | 0.020148 |
from django.conf import settings
from django.test import TestCase, override_settings
from freezegun import freeze_time
from adyen.gateway import MissingFieldException
from adyen.scaffold import Scaffold
TEST_RETURN_URL = 'https://www.example.com/checkout/return/adyen/'
EXPECTED_FIELDS_LIST = [
{'type': 'hidden',... | oscaro/django-oscar-adyen | tests/test_requests.py | Python | bsd-3-clause | 3,128 | 0.001598 |
# -*- coding: utf-8 -*-
# django-po2xls
# tests/management/commands/test_po-to-xls.py
import os
import pathlib
from typing import List
from importlib import import_module
from django.test import TestCase
# po-to-xls management command imported on the fly
# because we can't import something from the module that co... | vint21h/django-po2xls | tests/management/commands/test_po-to-xls.py | Python | gpl-3.0 | 1,479 | 0.002705 |
# EasyShells Module - API for easier Shell Model Construction in Salome
# MidSurface.py: Mid surface extraction for EasyShells module
#
# Copyright (C) 2013 Stefan Reiterer - maldun.finsterschreck@gmail.com
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser ... | maldun/EasyShells | MidSurface.py | Python | lgpl-2.1 | 2,382 | 0.011335 |
__kupfer_name__ = _("Vim")
__kupfer_sources__ = ("RecentsSource", "ActiveVim", )
__kupfer_actions__ = ("InsertInVim", )
__description__ = _("Recently used documents in Vim")
__version__ = "2011-04"
__author__ = "Plugin: Ulrik Sverdrup, VimCom: Ali Afshar"
def initialize_plugin(name):
global RecentsSource
global Act... | Theragon/kupfer | kupfer/plugin/vim/__init__.py | Python | gpl-3.0 | 423 | 0.009456 |
#!/usr/bin/env python
telescope = "ATCA"
latitude_deg = -30.312906
diameter_m = 22.0
import os
import sys
from util_misc import ascii_dat_read
#-----------------------------------------------------------------------------#
def main():
# Read the station lookup table
col, dummy = ascii_dat_read("ATCA_statio... | crpurcell/friendlyVRI | arrays/array_data/ATCA/mk_ATCA_array_configs.py | Python | mit | 3,761 | 0.003191 |
from datetime import timedelta
from django.contrib import admin
from django.db.models import Case, Value, When
from django.utils import timezone
from .models import Channel, Post, RssFeed
@admin.register(Channel)
class ChannelAdmin(admin.ModelAdmin):
list_display = ('__str__', 'title', 'username', 'publish_pict... | vaniakosmos/memes-reposter | apps/rss/admin.py | Python | mit | 1,262 | 0.001585 |
from tfidf import *
import psycopg2
import psycopg2.extensions
import math
def cos_sim(A,B):
def dot_product(a,b):
sum = 0.0
for key in a.keys():
if key in b:
sum += a[key]*b[key]
return sum
return dot_product(A,B)/(math.sqrt(dot_product(A,A)) * math.sqrt(dot_... | JohnCEarls/AUREA | scripts/testScripts/testTFIDF.py | Python | agpl-3.0 | 1,566 | 0.009579 |
from django.shortcuts import render
from SharedFunctions.models import *
from Lights.models import *
def HandlePhoneRequest(request):
area = request.GET.get('area', 'None')
if area == 'None':
return PhoneHomePage(request)
elif area == 'lights':
if request.GET.get('room', 'None') != 'None':
if request.GET.get... | Tomcuzz/OctaHomeAutomation | Api/ciscophone.py | Python | mit | 3,020 | 0.036755 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.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, eith... | dtschan/weblate | weblate/accounts/tests/test_models.py | Python | gpl-3.0 | 1,853 | 0 |
import Queue
import handlers
import inspect
import threading
import pkgutil
import os
import sys
import imp
from gatherer import Gatherer
import signal
import platform
import ConfigParser
class GatherAgent(object):
"""
A simple layer between inputs (gatherers) and output (handler) using a simple
implementa... | burmanm/gather_agent | gather_agent/gather_agent.py | Python | apache-2.0 | 5,283 | 0.005111 |
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Timesheet on Issues',
'version': '1.0',
'category': 'Project Management',
'description': """
This module adds the Timesheet support for the Issues/Bugs Management in Project.
================... | akhmadMizkat/odoo | addons/project_issue_sheet/__openerp__.py | Python | gpl-3.0 | 850 | 0.002353 |
"""An NNTP client class based on:
- RFC 977: Network News Transfer Protocol
- RFC 2980: Common NNTP Extensions
- RFC 3977: Network News Transfer Protocol (version 2)
Example:
>>> from nntplib import NNTP
>>> s = NNTP('news')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print('Group',... | prefetchnta/questlab | bin/x64bin/python/37/Lib/nntplib.py | Python | lgpl-2.1 | 44,234 | 0.000701 |
# Author: matigonkas
# URL: https://github.com/SiCKRAGETV/sickrage
#
# This file is part of SickRage.
#
# SickRage 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... | hale36/SRTV | sickbeard/providers/strike.py | Python | gpl-3.0 | 3,919 | 0.003572 |
import os
import subprocess
import sys
import tempfile
import threading
import time
import unittest
from subscription_manager import lock
class TestLock(unittest.TestCase):
lf_name = "lock.file"
def setUp(self):
self.tmp_dir = self._tmp_dir()
self.other_process = None
def _tmp_dir(self)... | vritant/subscription-manager | test/test_lock.py | Python | gpl-2.0 | 6,575 | 0.000608 |
from __future__ import absolute_import
from builtins import filter
import os
import sys
import zipfile
from gi.repository import Gtk, Gio, GdkPixbuf, GLib
from sunflower.common import UserDirectory, get_user_directory, get_static_assets_directory
class IconManager:
"""Icon manager class provides easy and abstract ... | MeanEYE/Sunflower | sunflower/icons.py | Python | gpl-3.0 | 3,797 | 0.025283 |
"""
the handlers that respond to requests from browsers or clients.
Each view function is mapped to one or more request URLs.
"""
from flask import render_template, flash, redirect, session, url_for, reqeust, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, l... | r2k0/flask-apps | mega-tut/app/views.py | Python | mit | 2,555 | 0.005479 |
from django.conf.urls import url, include
from snippets.views import SnippetViewSet, UserViewSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'snippets', SnippetViewSet)
router.register(r'users', UserViewSet)
urlpatterns = [
url(r'^', include(router.urls)),
]
| datyayu/cemetery | [Python][Django] Rest framework tutorial/snippets/urls.py | Python | mit | 314 | 0 |
import time
import pyupm_ttp223 as ttp223
import requests
import json
url = "http://requestb.in/1mj62581?inspect"
headers = {'content-type': 'application/json'}
touch1 = ttp223.TTP223(4)
touch1Pressed = False
touch2 = ttp223.TTP223(8)
touch2Pressed = False
def sendInfo(touch, tId, Pressed):
if touch.isPressed()... | OpenParking/Open-Parkinig---Edison | source/touh.py | Python | gpl-2.0 | 1,004 | 0.000996 |
""""""
from __future__ import annotations
from flask import Flask
from .criterion import TagCriterion
from .extension import TagsExtension
__all__ = ["TagsExtension", "TagCriterion"]
def register_plugin(app: Flask):
TagsExtension(app)
| abilian/abilian-core | src/abilian/web/tags/__init__.py | Python | lgpl-2.1 | 244 | 0 |
import datetime
import time
from django.db.utils import DatabaseError
try:
from django.utils.six.moves import _thread as thread
except ImportError:
from django.utils.six.moves import _dummy_thread as thread
from collections import namedtuple
from contextlib import contextmanager
from django.conf import setti... | mariosky/evo-drawings | venv/lib/python2.7/site-packages/django/db/backends/__init__.py | Python | agpl-3.0 | 47,905 | 0.001232 |
import easygui
from os import listdir
from os.path import isfile, join
# Import Custom Libraries
from libs.requestStripper import *
file_path = "/home/tyler/Documents/Thesis Testing"
print(file_path)
files = [f for f in listdir(file_path) if isfile(join(file_path, f))]
for i, value in enumerate(files):
files[i]... | xTVaser/Schoolwork-Fall-2016 | Thesis/Parser/main.py | Python | gpl-3.0 | 526 | 0.001901 |
"""Utility functions for copying and archiving files and directory trees.
XXX The functions here don't copy the resource fork or other metadata on Mac.
"""
import os
import sys
import stat
from os.path import abspath
import fnmatch
import collections
import errno
try:
from pwd import getpwnam
except ImportError... | Symmetry-Innovations-Pty-Ltd/Python-2.7-for-QNX6.5.0-x86 | usr/pkg/lib/python2.7/shutil.py | Python | mit | 18,302 | 0.002186 |
#!/usr/bin/python2
import os, glob
os.chdir( '/workspace/Shared/Tech_Projects/ALFRESCO_Inputs/project_data/CODE/tem_ar5_inputs' )
base_dir = '/workspace/Shared/Tech_Projects/ESGF_Data_Access/project_data/data/prepped'
output_base_dir = '/workspace/Shared/Tech_Projects/ALFRESCO_Inputs/project_data/TEM_Data/downscaled'... | ua-snap/downscale | old/old_bin/downscaling_launcher.py | Python | mit | 3,849 | 0.043128 |
from mock import *
from .gp_unittest import *
from gpconfig_modules.compare_segment_guc import MultiValueGuc
from gpconfig_modules.database_segment_guc import DatabaseSegmentGuc
from gpconfig_modules.file_segment_guc import FileSegmentGuc
class CompareSegmentGucTest(GpTestCase):
def setUp(self):
row = ['c... | 50wu/gpdb | gpMgmt/bin/gppylib/test/unit/test_unit_compare_segment_guc.py | Python | apache-2.0 | 8,167 | 0.003061 |
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2014 Håvard Gulldahl
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... | havardgulldahl/perpetual-yearcal | models.py | Python | mit | 1,783 | 0.011223 |
import re, sys
import functools
import graphviz as gv
from graphviz import Source
bad_words = [ 'jns', 'js', 'jnz', 'jz', 'jno', 'jo', 'jbe', 'jb', 'jle', 'jl', 'jae', 'ja', 'jne loc', 'je', 'jmp', 'jge', 'jg', 'SLICE_EXTRA', 'SLICE_ADDRESSING', '[BUG]', 'SLICE_VERIFICATION', 'syscall', '#PARAMS_LOG']
instrEdges = []... | WesCoomber/dataFlowGraphProjecto | presentgetBothNodesEdges.py | Python | mit | 22,404 | 0.010266 |
from django.urls import path
from . import views
urlpatterns = [
path('', views.events),
]
| fanout/django-eventstream | django_eventstream/urls.py | Python | mit | 96 | 0 |
"""
*2014.09.10 16:10:05
DEPRECATED!!!!
please use building.models.search_building and building.models.make_building
instead of the make_unit and make_building functions found here...
out of date.
"""
import sys, os, json, codecs, re
sys.path.append(os.path.dirname(os.getcwd()))
from geopy import geocoders, distan... | City-of-Bloomington/green-rental | scripts/helpers.py | Python | agpl-3.0 | 22,169 | 0.011728 |
import numpy as np
from matplotlib import pyplot as plt
from pylab import rcParams
from matplotlib.ticker import ScalarFormatter
from subprocess import call
fs = 8
order = np.array([])
nsteps = np.array([])
error = np.array([])
# load SDC data
file = open('conv-data.txt', 'r')
while True:
line = file.readline... | danielru/pySDC | playgrounds/deprecated/acoustic_1d_imex/ploterrorconstants.py | Python | bsd-2-clause | 3,326 | 0.02285 |
import datetime
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import Sum
from django.contrib.contenttypes.models import ContentType
class TrendingManager(models.Manager):
def trending(self, model, days=30, kind=""):
views = self.filter(
... | eldarion/django-trending | trending/managers.py | Python | bsd-3-clause | 1,033 | 0.000968 |
"""
thetvdb.com Python API
(c) 2009 James Smith (http://loopj.com)
(c) 2014 Wayne Davison <wayne@opencoder.net>
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... | KODeKarnage/script.sub.missing | resources/lib/thetvdbapi.py | Python | gpl-3.0 | 10,006 | 0.006696 |
#!/usr/bin/python
"""Thermistor Value Lookup Table Generator
Generates lookup to temperature values for use in a microcontroller in C format based on:
http://en.wikipedia.org/wiki/Steinhart-Hart_equation
The main use is for Arduino programs that read data from the circuit board described here:
http://reprap.org/wiki/... | pandel/Marlin | buildroot/share/scripts/createTemperatureLookupMarlin.py | Python | gpl-3.0 | 6,204 | 0.009349 |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... | deepmind/acme | acme/utils/counting.py | Python | apache-2.0 | 4,636 | 0.003883 |
"""
Django settings for movie_organizer project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Bu... | jlaurelli/movie_organizer | movie_organizer/settings.py | Python | mit | 2,681 | 0 |
__author__ = 'lucifurtun'
| sensidev/serpisori | app/__init__.py | Python | mit | 26 | 0 |
'''
Extract Ways from OSM PBF files
'''
import osmium as o
import json, os, requests, sys, time
import shapely.wkb as wkblib
# http://docs.osmcode.org/pyosmium/latest/intro.html
# A global factory that creates WKB from a osmium geometry
wkbfab = o.geom.WKBFactory()
# set in Dockerfile as env variable
GEO_DATA_DIR = ... | silberman/Deep-OSM | src/download_labels.py | Python | mit | 4,752 | 0.016204 |
import tempfile
import synapse.common as s_common
import synapse.lib.msgpack as s_msgpack
_readsz = 10000000
def splice(act, **info):
'''
Form a splice event from a given act name and info.
Args:
act (str): The name of the action.
**info: Additional information about the event.
... | vivisect/synapse | synapse/lib/splice.py | Python | apache-2.0 | 2,652 | 0.000754 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Course.start_time'
db.alter_column(u'courses_course', ... | HackBulgaria/Odin | courses/south_migrations/0003_auto__chg_field_course_start_time__chg_field_course_end_time.py | Python | agpl-3.0 | 1,387 | 0.005047 |
"""Tests related to retraction of public registrations"""
import datetime
from rest_framework import status as http_status
import mock
import pytest
from django.utils import timezone
from django.db import DataError
from nose.tools import * # noqa
from framework.auth import Auth
from framework.exceptions import Perm... | mfraezz/osf.io | tests/test_registrations/test_retractions.py | Python | apache-2.0 | 43,805 | 0.003196 |
#!/usr/bin/env python
# ./postit.py http://localhost:5000/db/loadpost users fixtures/users.txt
# alternately, if you are running locally, visit
# http://localhost:5000/db/loadfixture/users/users.txt
# to drop the db go to
# http://localhost:5000/db/drop
# to show the db go to
# http://localhost:5000/db/show
import... | ejconlon/iwantaride | postit.py | Python | mit | 1,204 | 0.004153 |
# Generated by Django 2.2.25 on 2022-01-03 12:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0022_auto_20191015_0510"),
]
operations = [
migrations.AlterField(
model_name="user",
name="notify_unassig... | watchdogpolska/poradnia | poradnia/users/migrations/0023_auto_20220103_1354.py | Python | mit | 618 | 0.001618 |
# -*- coding: utf-8 -*-
# flake8: noqa
import unittest
import datetime
import uuid
from urllib.error import HTTPError
from mock import Mock
from mailman.email.message import Message
from mailman.interfaces.archiver import ArchivePolicy
#import kittystore.utils
#from kittystore import get_store
#from kittystore.cachi... | systers/hyperkitty | hyperkitty/tests/_test_caching.py | Python | gpl-3.0 | 9,926 | 0.004332 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | kmarius/qutebrowser | qutebrowser/browser/webengine/webenginetab.py | Python | gpl-3.0 | 37,530 | 0.00008 |
#!/usr/bin/env python
from random import Random
colors_support = True
try:
from colorama import init, Fore
init()
except:
colors_support = False
print "For colors install colorama"
hint_table = \
{('5',): {'A': 'h', '10': 'h', '3': 'h', '2': 'h', '5': 'h', '4': 'h', '7': 'h', '6': 'h', '9': '... | itaiag/blackjack | blackjack.py | Python | apache-2.0 | 17,936 | 0.004014 |
from __future__ import absolute_import
import community
import networkx as nx
from networkx.algorithms.community import asyn_lpa_communities
import numpy as np
from .base import LabelGraphClustererBase
from .helpers import _membership_to_list_of_communities
class NetworkXLabelGraphClusterer(LabelGraphClustererBase)... | scikit-multilearn/scikit-multilearn | skmultilearn/cluster/networkx.py | Python | bsd-2-clause | 6,829 | 0.003075 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2017-12-27 14:32
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('candidates', '0026_auto_20171227_1429'),
]
operations = [
migrations.RemoveField(
... | macwis/simplehr | candidates/migrations/0027_auto_20171227_1432.py | Python | gpl-3.0 | 507 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""General utility functions module."""
from functools import partial
import six
fr... | tiborsimko/invenio-records-restapi | invenio_records_rest/utils.py | Python | gpl-2.0 | 7,700 | 0 |
# Create your views here.
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext, loader
from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404
from django.utils import timezone
from django.views import generic
from polls.mode... | Drhealsgood/learning_django | polls/views.py | Python | mit | 1,526 | 0.006553 |
# -*- coding: utf-8 -*-
# File: webframe/models.py
# Author: Kenson Man <kenson@kensonidv.hk>
# Date: 2020-10-17 12:29
# Desc: Provide the basic model for webframe
from datetime import datetime
from deprecation import deprecated
from django.conf import settings
from django.core.serializers.json import Dja... | kensonman/webframe | models.py | Python | apache-2.0 | 46,692 | 0.029256 |
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext_lazy
from django_countries import countries
from django_countries.fields import CountryField
COUNTRIES = [(ugettext_lazy(name), code) for (name, code) in list(countries)]
class Company(models.Model):
# Company credenti... | samupl/simpleERP | apps/contacts/models.py | Python | mit | 6,028 | 0.003484 |
# -*- coding: utf-8 -*-
# Description: NSD `nsd-control stats_noreset` netdata python.d module
# Author: <383c57 at gmail.com>
from base import ExecutableService
import re
# default module values (can be overridden per job in `config`)
priority = 60000
retries = 5
update_every = 30
# charts order (can be overridden... | seamless-distribution-systems/galilei | galieli-netdata-installer/netdata/python.d/nsd.chart.py | Python | gpl-3.0 | 3,581 | 0.002793 |
"""
This file contains the DynamicsValidator class for validating component
:copyright: Copyright 2010-2017 by the NineML Python team, see AUTHORS.
:license: BSD-3, see LICENSE for details.
"""
from builtins import object
from nineml.visitors.validators import NoDuplicatedObjectsValidator
from .general import (
Ti... | INCF/lib9ML | nineml/abstraction/dynamics/visitors/validators/base.py | Python | bsd-3-clause | 2,819 | 0 |
import socket
# List of the top 25 sites according to Alexa
websites = [ "Google.com",
"Facebook.com",
"Youtube.com",
"Baidu.com",
"Yahoo.com",
"Amazon.com",
"Wikipedia.org",
"Qq.com",
"Twitter.com",
"G... | mmirabent/sniffle | generate_connections.py | Python | apache-2.0 | 1,066 | 0.002814 |
from urlparse import urljoin
from django.conf import settings
def trailing_slash_or_none():
"""
Return a slash or empty string based on tastypie setting
"""
if getattr(settings, 'TASTYPIE_ALLOW_MISSING_SLASH', False):
return ''
return '/'
def urljoin_forced(base, path, **kwargs):
""... | benthomasson/django-tastypie-swagger | tastypie_swagger/utils.py | Python | bsd-2-clause | 499 | 0 |
from collections import defaultdict
# Regresar similitudes de un objeto index en un diccionario
def index2dict(index, file_list, num_sims=5):
file_list = [i.replace('.txt','') for i in file_list]
sims = {} #defaultdict(dict)
for i, idx in enumerate(index):
s = []
for j in range(len(file_list)):
s.append({
... | felipegerard/arte_mexicano_antiguo | felipegerard/entregable/itm/itm/similarity_functions.py | Python | agpl-3.0 | 629 | 0.041335 |
#!/usr/bin/env python
#
# Copyright 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.
"""Creates symlinks to native libraries for an APK.
The native libraries should have previously been pushed to the device (in
option... | sencha/chromium-spacewalk | build/android/gyp/create_device_library_links.py | Python | bsd-3-clause | 3,509 | 0.014249 |
from django.db import connections
from django.db.models.manager import Manager as DJManager
from django.db.utils import DatabaseError
from bson.objectid import ObjectId
import re
from .utils import dict_keys_to_str
try:
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
except ImportE... | theofilis/elasticsearch-engine | elasticsearch_engine/manager.py | Python | gpl-2.0 | 20,982 | 0.001716 |
#!/usr/bin/env python2.7
# Author: echel0n <echel0n@sickrage.ca>
# URL: https://sickrage.ca
#
# This file is part of SickRage.
#
# SickRage 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 t... | gborri/SickRage | tests/test_xem.py | Python | gpl-3.0 | 2,900 | 0.01 |
# -*- coding: utf-8 -*-
"""Communication commands package."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
| whutch/cwmud | cwmud/core/commands/communication/__init__.py | Python | mit | 246 | 0 |
"""
News resource
=============
It is an alias for archive without filtering out published items.
"""
from superdesk.resource import build_custom_hateoas
from apps.archive.archive import ArchiveResource, ArchiveService
from apps.archive.common import CUSTOM_HATEOAS
class NewsResource(ArchiveResource):
datasour... | superdesk/superdesk-core | apps/archive/news.py | Python | agpl-3.0 | 767 | 0 |
from django.conf.urls import url
from . import views
app_name='manage'
urlpatterns = [
url(r'^index/$', views.index, name='index'),
url(r'^db/(\w+)/$', views.db, name='db'),
url(r'^import/index/$', views.import_index, name='import'),
url(r'^import/dir/$', views.import_dir, name='import-dir'),
url(r'^import/statu... | tangyanhan/homesite | manage_videos/urls.py | Python | mit | 370 | 0.016216 |
# (c) 2017, Patrick Deelman <patrick@patrickdeelman.nl>
# (c) 2017 Ansible Project
# 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
DOCUMENTATION = """
lookup: passwordstore
vers... | alxgu/ansible | lib/ansible/plugins/lookup/passwordstore.py | Python | gpl-3.0 | 11,134 | 0.003413 |
# coding=utf-8
# Author: Mr_Orange <mr_orange@hotmail.it>
# URL: https://sickrage.github.io
#
# This file is part of SickRage.
#
# SickRage 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 ... | cortedeltimo/SickRage | sickbeard/clients/transmission_client.py | Python | gpl-3.0 | 5,187 | 0.00135 |
#! /usr/bin/env python
# -*- Mode: python; py-indent-offset: 4; tab-width: 8; indent-tabs-mode: t; -*-
#
# A script for generating a number of flows.
#
# The output of the script should be saved to a file, and the flows from
# that file should be added by the following command:
#
# web/add_flow.py -f filename
#
# N... | opennetworkinglab/spring-open | scripts/perf-scripts/generate_flows.py | Python | apache-2.0 | 2,622 | 0.017162 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jmesteve/saas3 | openerp/addons/hr_contract/hr_contract.py | Python | agpl-3.0 | 4,997 | 0.005803 |
import asyncio
import enum
import logging
import concurrent.futures
logger = logging.getLogger("cloudbot")
@enum.unique
class EventType(enum.Enum):
message = 0
action = 1
# TODO: Do we actually want to have a 'notice' event type? Should the NOTICE command be a 'message' type?
notice = 2
join = 3
... | nidhididi/CloudBot | cloudbot/event.py | Python | gpl-3.0 | 15,182 | 0.003557 |
from time import localtime, gmtime, strftime, strptime
from os.path import expanduser, join
from pprint import pprint
from decimal import *
def scrivi_movimento(path, m):
with open(path, 'a') as f:
f.write(m['tipo'] + m['valore'])
f.write(';')
f.write(m['data'])
f.write(';')
... | scompo/money | money/money.py | Python | bsd-3-clause | 3,277 | 0.01007 |
from setuptools import setup, find_packages
setup(name='monsql',
version='0.1.7',
packages = find_packages(),
author='firstprayer',
author_email='zhangty10@gmail.com',
description='MonSQL - Mongodb-style way for using mysql.',
url='https://github.com/firstprayer/monsql.git',
i... | firstprayer/monsql | setup.py | Python | mit | 371 | 0.013477 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Script to search vcf files for mutations within specific coordinates
# Input:
# -A vcf file
#
# Output:
# -A Roary-like file with mutations sorted in rows, strains as columns and presence/absence in cells
# -Columns: Chromosome, Position, variant (eg C->T), type (eg mis... | AdmiralenOla/Scoary | scoary/vcf2scoary.py | Python | gpl-3.0 | 8,390 | 0.005364 |
from yaml import load_all
try:
from yaml import CLoader as Loader
except ImportError:
print("Using pure python YAML loader, it may be slow.")
from yaml import Loader
from iengine import IDocumentFormatter
__author__ = 'reyoung'
class YAMLFormatter(IDocumentFormatter):
def __init__(self, fn=None, con... | reyoung/SlideGen2 | slidegen2/yaml_formatter.py | Python | mit | 933 | 0.001072 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-02-17 23:04
from __future__ import unicode_literals
from django.db import migrations, models
import theme.utils
class Migration(migrations.Migration):
dependencies = [
('hs_access_control', '0032_auto_20210607_2027'),
]
operations = ... | hydroshare/hydroshare | hs_access_control/migrations/0033_auto_20220217_2304.py | Python | bsd-3-clause | 756 | 0.002646 |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-cli | qingcloud/cli/iaas_client/actions/alarm_policy/add_alarm_policy_actions.py | Python | apache-2.0 | 2,067 | 0.000968 |
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2015 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
"""The lib389 module.
IMPORTANT: Ternary operator syntax is unsupported on RHEL5
x if cond else y #don't!
... | Ilias95/lib389 | lib389/__init__.py | Python | gpl-3.0 | 123,763 | 0.000525 |
#!/usr/bin/env python
#coding:utf8
class Solution(object):
def permuteUnique(self, nums):
length = len(nums)
if length == 0:
return [[]]
rlists = [[nums[0]]]
for i in range(1, length):
tlists = []
for L in rlists:
v = nums[i]
... | matrix65537/lab | leetcode/permutations/permutation2.py | Python | mit | 785 | 0.003822 |
#!/usr/bin/env python3
"""
A Module containing the classes which generate schema files from JSON.
"""
import json
def cmp_to_key(mycmp):
'Convert a cmp= function into a key= function'
class K:
def __init__(self, obj, *args):
self.obj = obj
def __lt__(self, other):
retu... | GluuFederation/community-edition-setup | schema/generator.py | Python | mit | 8,810 | 0.000908 |
import itertools
import logging
import time
from _sha256 import sha256
from collections import defaultdict, OrderedDict, deque
from functools import partial
from typing import Tuple, List, Set, Optional, Dict, Iterable, Callable
from orderedset._orderedset import OrderedSet
from sortedcontainers import SortedList
fro... | evernym/plenum | plenum/server/consensus/ordering_service.py | Python | apache-2.0 | 109,275 | 0.00205 |
# Copyright 2013 NEC Corporation
#
# 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 ag... | orbitfp7/horizon | openstack_dashboard/test/api_tests/network_tests.py | Python | apache-2.0 | 34,720 | 0 |
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/lag | libml/layers.py | Python | apache-2.0 | 18,151 | 0.001598 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.