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 python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from setuptools import setup
setup(extras_require={':python_version < "3.4"': ['enum34']})
| madsmtm/fbchat | setup.py | Python | bsd-3-clause | 180 |
"""
sentry.models.tagvalue
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.core.urlresolvers import reverse
from django.db import models
from django.ut... | imankulov/sentry | src/sentry/models/tagvalue.py | Python | bsd-3-clause | 2,667 |
"""
sentry.plugins.base.structs
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
__all__ = ['ReleaseHook']
from sentry.models import Commit, Release
from sen... | zenefits/sentry | tests/sentry/plugins/interfaces/test_releasehook.py | Python | bsd-3-clause | 3,557 |
from django.core.exceptions import PermissionDenied
from django.utils.translation import ugettext as _
def set_publish(modeladmin, request, queryset):
if not request.user.is_staff:
raise PermissionDenied
queryset.update(publish=True)
set_publish.short_description = _("Set the publish flag for the sel... | StuartMacKay/django-sitepaths | sitepaths/actions.py | Python | bsd-3-clause | 1,062 |
import urllib.request
from user_define_cookie import UserDefineCookie
class XueqiuApi(object):
def __init__(self, name=None):
self.name = name
self.__req_url = 'https://xueqiu.com/stock/screener/screen.json?category=SH&exchange=&areacode=&indcode=&_=1425870008963'
# 动态市盈率
def append_pett... | pinguo-chexing/stock_discover | xueqiu_api.py | Python | apache-2.0 | 3,047 |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 29 20:44:27 2017
@author: finn
"""
import cv2
import sys
import cvutil as u
cap = u.source_video(sys.argv)
while(True):
_, frame = cap.read()
cv2.imshow('frame',frame)
k = cv2.waitKey(5) & 0xFF
if k == ord('q'):
break
cv2.destroyAllWi... | finnhacks42/opencv-play | templates/display_video.py | Python | mit | 328 |
# -*- coding: utf-8 -*-
"""
Module for the generation of docx format documents.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0 (the L... | wtpayne/hiai | a3_src/h70_internal/da/report/html_builder.py | Python | apache-2.0 | 2,607 |
from nose.tools import *
from networkx.utils import reverse_cuthill_mckee_ordering
import networkx as nx
def test_reverse_cuthill_mckee():
# example graph from
# http://www.boost.org/doc/libs/1_37_0/libs/graph/example/cuthill_mckee_ordering.cpp
G = nx.Graph([(0,3),(0,5),(1,2),(1,4),(1,6),(1,9),(2,3),
... | ReganBell/QReview | networkx/utils/tests/test_rcm.py | Python | bsd-3-clause | 1,186 |
from datetime import datetime, timedelta
import logging
import traceback
from openerp import api, models, fields, tools, SUPERUSER_ID
from openerp.addons.booking_calendar.models import SLOT_START_DELAY_MINS, SLOT_DURATION_MINS
_logger = logging.getLogger(__name__)
class pitch_booking_venue(models.Model):
_name =... | ufaks/addons-yelizariev | pitch_booking/models.py | Python | lgpl-3.0 | 6,779 |
"""
Utilities for validating inputs to user-facing API functions.
"""
from textwrap import dedent
from types import CodeType
from functools import wraps
from inspect import getargspec
from uuid import uuid4
from toolz.curried.operator import getitem
from six import viewkeys, exec_, PY3
_code_argorder = (
('co_ar... | bartosh/zipline | zipline/utils/preprocess.py | Python | apache-2.0 | 7,205 |
import os.path
class ProjectReport(object):
def __init__(self, project: 'Project'):
self.project = {
"target": project.target,
"location": os.path.abspath(project.location),
"name": project.name,
"templates": [{"name": t.name, "version": t.version, "origin":... | purduesigbots/pros-cli | pros/conductor/project/ProjectReport.py | Python | mpl-2.0 | 905 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Document'
db.create_table('projects_document', (
('id', self.gf('django.db.mod... | nsi-iff/nsi_site | apps/projects/migrations/0003_auto__add_document.py | Python | mit | 2,496 |
#
# 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, software
# ... | dragorosson/heat | heat/engine/resources/openstack/magnum/baymodel.py | Python | apache-2.0 | 7,315 |
# Copyright 2020 Makani Technologies 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 agreed to... | google/makani | avionics/firmware/monitors/generate_ltc2309_monitor.py | Python | apache-2.0 | 3,670 |
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head is None:
return None
p = head
while p.next is not None:
if p.val == p.next.val:
p.next = p.next.next
... | lunabox/leetcode | python/problems/s83_Remove_Duplicates_from_Sorted_List.py | Python | apache-2.0 | 387 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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... | JamesLinEngineer/RKMC | addons/plugin.video.phstreams/resources/lib/sources/movies14_mv_tv.py | Python | gpl-2.0 | 4,810 |
# Copyright 2013 IBM Corp.
#
# 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 agree... | yatinkumbhare/openstack-nova | nova/objects/base.py | Python | apache-2.0 | 32,043 |
from collections import namedtuple
import pytest
from cfme import test_requirements
from cfme.containers.container import ContainerAllView
from cfme.containers.image_registry import ImageRegistryAllView
from cfme.containers.node import NodeAllView
from cfme.containers.overview import ContainersOverviewView
from cfme.... | nachandr/cfme_tests | cfme/tests/containers/test_start_page.py | Python | gpl-2.0 | 2,618 |
from flask_security.core import RoleMixin
from hangman.models import db
class Role(db.Model, RoleMixin):
__tablename__ = 'roles'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
description = db.Column(db.String(255))
| jrichte43/hangman | hangman/models/role.py | Python | gpl-2.0 | 278 |
def Setup(Settings,DefaultModel):
# set6_variable-base-cnn-model/var_cnn_test_proper_dataset_vgg19.py
Settings["experiment_name"] = "var_cnn_test_proper_dataset_xception_kfold"
Settings["graph_histories"] = ['together'] #['all','together',[],[1,0],[0,0,0],[]]
n=0
Settings["models"][n]["datase... | previtus/MGR-Project-Code | Settings/set6_variable-base-cnn-model/var_cnn_test_proper_dataset_vgg19.py | Python | mit | 1,026 |
# parse_qs
try:
from urlparse import parse_qs
except ImportError:
from cgi import parse_qs
# json
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
from django.utils import simplejson as json
# httplib2
import httplib2
# socks
try:
from ht... | jessekl/flixr | venv/lib/python2.7/site-packages/twilio/rest/resources/imports.py | Python | mit | 602 |
from django.conf.urls import url, patterns, include
from django.contrib.admin import site
from django.conf.urls.i18n import i18n_patterns
from cms_seoutils.sitemaps import CMSI18nSitemap
urlpatterns = patterns(
'',
url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap',
{'sitemaps': {'cmspage... | mpaolini/django-cms-seoutils | cms_seoutils/test_utils/project/urls.py | Python | bsd-3-clause | 480 |
#1/usr/bin/env python3
import setuptools
setuptools.setup(
name = 'rheedsim',
version = '0.1.0',
packages = ['rheedsim'],
entry_points = {
'console_scripts':[
'rheedsim = rheedsim.__main__:main'
]
},
)
| chanjr/rheedsim | src/setup.py | Python | mit | 305 |
N, M = map(int, input().split())
S = input()
actors = list()
for _ in range(M):
_, c = map(int, input().split())
dic = set(list(input()))
actors.append((c, dic))
actors.sort()
ans = 0
for s in S:
for c, d in actors:
if s in d:
ans += c
break
else:
print(-1)
... | knuu/competitive-programming | yandex/yandex2016_b_a.py | Python | mit | 346 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"""Write your forwards methods here."""
# Replace all null values with blanks... | michaelbrooks/twitter-feels | twitter_feels/apps/map/migrations/0003_replace_null_tweetchunk_tz_country.py | Python | mit | 5,898 |
"""
Transform asc files into ply or stl.
"""
from numpy import sqrt, arcsin, arctan2, floor, pi
from collections import namedtuple
Patch = namedtuple('Patch', ['points', 'faces'])
Point = namedtuple('Point', ['pid', 'x', 'y', 'z'])
def get_points_raw(fname):
"Return a list of points from an asc file"
points... | jordibc/mapelia | asc.py | Python | gpl-3.0 | 2,430 |
# 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, software
# distributed under t... | dmcc/bllip-parser | python/tests/test_reranking_parser.py | Python | apache-2.0 | 68,004 |
import ast
import io
import operator
import os
import sys
import token
import tokenize
class Visitor(ast.NodeVisitor):
def __init__(self, lines):
self._lines = lines
self.line_numbers_with_nodes = set()
self.line_numbers_with_statements = []
def generic_visit(self, node):
if h... | lgeiger/ide-python | lib/debugger/VendorLib/vs-py-debugger/pythonFiles/normalizeForInterpreter.py | Python | mit | 4,823 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/subnet_association_py3.py | Python | mit | 1,314 |
# This file is part of MyPaint.
# Copyright (C) 2011-2018 by the MyPaint Development Team.
# Copyright (C) 2007-2012 by Martin Renold <martinxyz@gmx.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 Fou... | briend/mypaint | lib/layer/core.py | Python | gpl-2.0 | 38,035 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from django.utils.translation import activate
from shuup.front.views.check... | shoopio/shoop | shuup_tests/front/test_checkout_methods_phase.py | Python | agpl-3.0 | 898 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2010 kazacube (http://kazacube.com).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | diogocs1/comps | web/addons/l10n_ma/__openerp__.py | Python | apache-2.0 | 2,154 |
# Copyright 2015-2016 Yelp 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 writin... | Yelp/paasta | paasta_itests/steps/setup_steps.py | Python | apache-2.0 | 13,298 |
#!/usr/bin/env python
"""
Created on Sun Feb 9 16:47:35 2014
Author: Oren Freifeld
Email: freifeld@csail.mit.edu
"""
import pickle, pdb
import pylab
from pylab import plt
import numpy as np
#pylab.ion()
pylab.close('all')
#from js.utils.timing import StopWatch
from transform_cuda import CpavfCalcsGPU
from of.utils... | freifeld/cpabDiffeo | cpab/gpu/demo_3d.py | Python | mit | 3,810 |
from pudzu.charts import *
df = pd.read_csv("datasets/flagsyk.csv")
groups = list(remove_duplicates(df.group))
array = [[dict(r) for _,r in df.iterrows() if r.group == g] for g in groups]
data = pd.DataFrame(array, index=list(remove_duplicates(df.group)))
FONT = calibri or sans
fg, bg="black", "#EEEEEE"
default_img =... | Udzu/pudzu | dataviz/flagsyk.py | Python | mit | 1,756 |
from numpy import matrix, array, diag, sqrt, abs, ravel, ones, arange
from scipy import rand, real, isscalar, hstack
from scipy.sparse import csr_matrix, isspmatrix, bsr_matrix, isspmatrix_bsr,\
spdiags
import pyamg
from pyamg.util.utils import diag_sparse, profile_solver, to_type,\
type_prep, get_diagonal,\
... | huahbo/pyamg | pyamg/util/tests/test_utils.py | Python | mit | 56,959 |
"""
问题描述: 你和你的朋友,两个人一起玩 Nim游戏:桌子上有一堆石头,每次你们轮流拿掉 1 - 3 块石头。
拿掉最后一块石头的人就是获胜者。你作为先手。
你们是聪明人,每一步都是最优解。 编写一个函数,来判断你是否可以在给定石头数量的情况下赢得游戏。
示例:
输入: 4
输出: false
解释: 如果堆中有 4 块石头,那么你永远不会赢得比赛;
因为无论你拿走 1 块、2 块 还是 3 块石头,最后一块石头总是会被你的朋友拿走。
方法:
f(4) = False
f(5) = True
f(6) = True
f(7) = True
f(8) = False
可以先多推几个,然后进行猜想和验证。这里可... | ResolveWang/algrithm_qa | 分类代表题目/数学知识/Nim游戏.py | Python | mit | 904 |
# -*- coding: utf-8 -*-
import pytest
from .typeconv import str2bool
from .typeconv import bool201
class Test_str2bool(object):
@pytest.mark.parametrize('s, d, exp', [
(True, None, True),
('1', None, True),
('t', None, True),
('yEs', None, True),
('true', None, True),
('TRUE', None, True),
('oN', Non... | maxkoryukov/route4me-python-sdk | route4me/sdk/_internals/typeconv_test.py | Python | isc | 1,560 |
# 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
#... | lakshmi-kannan/matra | openstack/common/loopingcall.py | Python | apache-2.0 | 4,667 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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 to use, copy, modify, merge, publish... | rwl/PyCIM | CIM14/IEC61970/OperationalLimits/OperationalLimit.py | Python | mit | 3,684 |
class Move(object):
'''
This class represents a move in term of directions
'''
# CONSTANTS
NORTH = ( -1, 0)
SOUTH = ( 1, 0)
EAST = ( 0, 1)
WEST = ( 0, -1) | Shathra/puzzlib | puzz/move.py | Python | bsd-2-clause | 165 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain th... | sub77/kernel_msm | scripts/gcc-wrapper.py | Python | gpl-2.0 | 3,426 |
import gluon.contrib.simplejson as sj
results_per_page = 10
def search():
'''returns the results in json to an audio search'''
page = 0
json_response = {}
search_criteria = None
if len(request.args) > 0:
search_criteria = request.args[0]
if len(request.args) == 2:
... | davidhampgonsalves/mix-tree | init/controllers/audio.py | Python | mit | 1,753 |
#!/usr/bin/env python
""""
File : tests_post_to_producer.py
Author : ian
Created : 04-26-2016
Last Modified By : ian
Last Modified On : 04-26-2016
***********************************************************************
The MIT License (MIT)
Copyright © 2015 Ian Cooper <ian_hammond_cooper@... | BrighterCommand/Brightside | tests/tests_post_to_producer.py | Python | mit | 4,927 |
from heapq import *
from heapq_showtree import show_tree
def merge_sorted_file(ls_of_filedata):
min_heap = []
# (heap : (value, origin))
result = []
for origin, cur_file in enumerate(ls_of_filedata):
if cur_file:
heappush(min_heap, (cur_file[0], origin, 1))
while min_heap:
... | misscindy/Interview | Heap/11_01_Merge_Sorted_Files.py | Python | cc0-1.0 | 916 |
from config import cloudplatform
storage_adapter = None
if cloudplatform == "google":
import googlestorage
storage_adapter = googlestorage
elif cloudplatform == "aws":
import awsstorage
storage_adapter = awsstorage
elif cloudplatform == "azure":
from FlaskWebProject import azurestorage
storage... | ohaz/amos-ss15-proj1 | FlaskWebProject/storageinterface.py | Python | agpl-3.0 | 3,348 |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import re_path, include
from django.views import defaults as default_views
from main.views import HomePageView
urlpatterns = [
re_path(r'^$', HomePageView.as_view(), name='home'),
# ur... | evanepio/dotmanca | config/urls.py | Python | mit | 1,796 |
"""Tests for the Abode cover device."""
from unittest.mock import patch
from homeassistant.components.abode import ATTR_DEVICE_ID
from homeassistant.components.cover import DOMAIN as COVER_DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
SERVICE_CLOSE_COVER,
SERVICE_OPEN_COV... | partofthething/home-assistant | tests/components/abode/test_cover.py | Python | apache-2.0 | 2,112 |
# -*- coding: utf-8 -*-
import os
import pygame
import random
import classes.board
import classes.game_driver as gd
import classes.level_controller as lc
class Board(gd.BoardGame):
def __init__(self, mainloop, speaker, config, screen_w, screen_h):
self.level = lc.Level(self, mainloop, 1, 10)
gd.... | imiolek-ireneusz/eduActiv8 | game_boards/game012.py | Python | gpl-3.0 | 9,202 |
import json
from typing import Any
from urllib.error import URLError
from urllib.request import Request, urlopen
from libqtile.log_utils import logger
from libqtile.widget import base
try:
import xmltodict
def xmlparse(body):
return xmltodict.parse(body)
except ImportError:
# TODO: we could impl... | qtile/qtile | libqtile/widget/generic_poll_text.py | Python | mit | 2,540 |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... | pli3/e2-openwbif | plugin/controllers/views/mobile/about.py | Python | gpl-2.0 | 8,266 |
from django.contrib import admin
from .models import dynamic_models
for model in dynamic_models.values():
admin.site.register(model)
# Register your models here.
| NikitaKoshelev/exam4sovzond | apps/dynamic_models/admin.py | Python | mit | 170 |
#!/usr/bin/env python
# [SublimeLinter pep8-max-line-length:150]
# -*- coding: utf-8 -*-
"""
black_rhino is a multi-agent simulator for financial network analysis
Copyright (C) 2016 Co-Pierre Georg (co-pierre.georg@keble.ox.ac.uk)
Pawel Fiedor (pawel@fiedor.eu)
This program is free software: you can redistribute it a... | cogeorg/black_rhino | examples/degroot/src/runner.py | Python | gpl-3.0 | 4,685 |
VERSION = '0.8.7'
| ophiry/dvc | dvc/__init__.py | Python | apache-2.0 | 18 |
import argparse
import re
import colorama
from django.apps import apps
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand, CommandError
from django.core.urlresolvers import reverse
from termcolor import colored
def show_valu... | exonian/django-grep-db | build/lib.linux-x86_64-2.7/django_grepdb/management/commands/grepdb.py | Python | mit | 12,308 |
def add_native_methods(clazz):
def copyFromShortArray__java_lang_Object__long__long__long__(a0, a1, a2, a3):
raise NotImplementedError()
def copyToShortArray__long__java_lang_Object__long__long__(a0, a1, a2, a3):
raise NotImplementedError()
def copyFromIntArray__java_lang_Object__long__lon... | laffra/pava | pava/implementation/natives/java/nio/Bits.py | Python | mit | 1,550 |
# 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... | gunan/tensorflow | tensorflow/python/ops/ragged/ragged_row_lengths_op_test.py | Python | apache-2.0 | 4,937 |
# -*- coding: utf-8 -*-
import os
import json
import logging
from website import settings
logger = logging.getLogger(__name__)
def load_asset_paths():
try:
return json.load(open(settings.ASSET_HASH_PATH))
except IOError:
logger.error('No "webpack-assets.json" file found. You may need to ru... | kushG/osf.io | website/util/paths.py | Python | apache-2.0 | 1,423 |
#!/usr/bin/env python -u
# coding: utf-8
# -------------------------------------------------------------------------- #
# Copyright (c) 20011 MadeiraCloud, All Rights Reserved.
#
# License
# -------------------------------------------------------------------------- #
import os
import sys
import platform
from setuptool... | BillTheBest/MadeiraAgent | setup.py | Python | bsd-3-clause | 2,380 |
# Advection test evolution: convergence test
from models import advection
from bcs import periodic
from simulation import simulation
from methods import minmod_lf
from rk import euler
from grid import grid
import numpy
from matplotlib import pyplot
Ngz = 2
Npoints_all = 40 * 2**numpy.arange(6)
dx_all = 1 / Npoints_al... | IanHawke/toy-evolve | toy-evolve/advection_sine_minmod_lf_euler_convergence.py | Python | mit | 1,359 |
# Copyright 2013 Georgia Tech Research 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 applicab... | gt-ros-pkg/hrl-haptic-manip | hrl_haptic_mpc/src/hrl_haptic_mpc/hrl_arm.py | Python | apache-2.0 | 6,448 |
from . import logger
from chatnet import prep
import pandas as pd
from collections import Counter
from sklearn.externals import joblib
import os
class Pipeline(object):
"""
Transformer helper functions and state checkpoints
to go from text data/labels to model-ready numeric data
"""
def __init__(s... | bhtucker/chatnet | chatnet/pipes.py | Python | mit | 5,136 |
"""
planex-pin: Generate a new override spec file for a given package
"""
import argparse
import argcomplete
import os
import sys
import re
import glob
import logging
import tempfile
import hashlib
import shutil
import json
import rpm
from planex.util import run
from planex.util import setup_sigint_handler
from planex... | djs55/planex | planex/pin.py | Python | lgpl-2.1 | 13,103 |
"""Custom widgets for Facet."""
from django import forms
class ArrayFieldSelectMultiple(forms.SelectMultiple):
"""Allow selecting multiple items."""
def __init__(self, *args, **kwargs):
self.delimiter = kwargs.pop('delimiter', ',')
super(ArrayFieldSelectMultiple, self).__init__(*ar... | ProjectFacet/facet | project/editorial/widgets.py | Python | mit | 561 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-03-13 11:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questions', '0041_data_migration'),
]
operations = [
migrations.AlterField... | rdmorganiser/rdmo | rdmo/questions/migrations/0042_remove_null_true.py | Python | apache-2.0 | 9,265 |
import binascii
import copy
import ctypes
import itertools
import logging
import os
import sys
import threading
import time
import archinfo
import cffi # lmao
import claripy
import pyvex
from angr.engines.vex.claripy import ccall
from angr.sim_state import SimState
from .. import sim_options as options
from ..errors... | angr/angr | angr/state_plugins/unicorn_engine.py | Python | bsd-2-clause | 71,217 |
from django.contrib.auth import views
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth import get_user_model
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render
import json
from account.models import DepartmentGroup
from task.m... | senkal/gunnery | gunnery/account/views.py | Python | apache-2.0 | 2,675 |
# Copyright 2011 OpenStack Foundation.
# 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 req... | sajuptpm/neutron-ipam | neutron/openstack/common/notifier/rpc_notifier2.py | Python | apache-2.0 | 1,921 |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name='index.html'), name = 'index'),
url(r'^accounts/login/$', 'django.contrib.auth.views.l... | xnnyygn/vmm | vmm/urls.py | Python | apache-2.0 | 554 |
"""
Mac OS X .app build command for distutils
Originally (loosely) based on code from py2exe's build_exe.py by Thomas Heller.
"""
from __future__ import print_function
import imp
import sys
import os
import zipfile
import plistlib
import shlex
import shutil
import textwrap
import pkg_resources
import collections
from... | lovexiaov/SandwichApp | venv/lib/python2.7/site-packages/py2app/build_app.py | Python | apache-2.0 | 77,527 |
from behave import *
from django.test import Client
from django.conf import settings
from features.factories import VisitorFactory
from hamcrest import *
use_step_matcher("parse")
@when('I go to "{url}"')
def step_impl(context, url):
"""
:param url: "/" homepage
:type context: behave.runner.Context
"... | nectR-Tutoring/nectr | features/steps/connection.py | Python | mit | 1,624 |
#
# Copyright (C) 2009, 2010 Brad Howes.
#
# This file is part of Pyslimp3.
#
# Pyslimp3 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, or (at your option) any later version.
#
# Pyslimp3 is... | bradhowes/pyslimp3 | server/PlaybackDisplay.py | Python | gpl-3.0 | 10,676 |
# pylint: disable=missing-docstring,redefined-builtin
from sys import exit
exit(0)
| ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/c/consider/consider_using_sys_exit_exempted.py | Python | mit | 85 |
"""First attempt at setup.py"""
from setuptools import setup, find_packages
setup (
name='ncexplorer',
version='0.7.2'
description='Climate data analysis utility.',
long_description='Climate data analysis utility.',
url='https://github.com/godfrey4000/ncexplorer',
license='MIT',
classifiers=[
'Development S... | godfrey4000/ncexplorer | setup.py | Python | mit | 709 |
# -*- coding: utf-8 -*-
"""Tools for downloading bibtex files from digital object identifiers."""
import bibpy
from urllib.request import Request, urlopen
def retrieve(doi, source='https://doi.org/{0}', raw=False, **options):
"""Download a bibtex file specified by a digital object identifier.
The source is... | MisanthropicBit/bibpy | bibpy/doi/__init__.py | Python | mit | 1,087 |
import sys
from math import log, sqrt
from itertools import combinations
def cosine_distance(a, b):
cos = 0.0
a_tfidf = a["tfidf"]
for token, tfidf in b["tfidf"].iteritems():
if token in a_tfidf:
cos += tfidf * a_tfidf[token]
return cos
def normalize(features):
norm = 1.0 / sqr... | abitofalchemy/ScientificImpactPrediction | NetAnalysis/sandbox.py | Python | mit | 3,493 |
#!/usr/bin/env python
"""
This module gets the application's config from project/etc
We can't log in here, as the logging module has to import
config before it can configure itself to start logging
"""
import os
import json
from twisted.python.modules import getModule
class Config(object):
data = {}
@class... | donalm/webtest | lib/python/webtest/config.py | Python | mit | 1,306 |
# Copyright 2018 SAS Project 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 requ... | Wireless-Innovation-Forum/Spectrum-Access-System | src/harness/reference_models/dpa/dpa_mgr.py | Python | apache-2.0 | 36,632 |
# -*- coding: utf-8 -*-
from acq4.devices.OptomechDevice import OptomechDevice
from acq4.devices.DAQGeneric import DAQGeneric
class PMT(DAQGeneric, OptomechDevice):
def __init__(self, dm, config, name):
self.omConf = {}
for k in ['parentDevice', 'transform']:
if k in config:
... | acq4/acq4 | acq4/devices/PMT/PMT.py | Python | mit | 705 |
from datetime import datetime
from math import floor
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.contrib.auth.password_validation import password_validators_help_texts
from django.http import JsonResponse
from django.urls import reverse_lazy
from dj... | hgpestana/chronos | apps/account/views.py | Python | mit | 6,032 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
# Configure the baseURL
baseUrl = "https://www.expedia.es"
# Create a webDriver instance and maximize window
driver = webdriver.Firefox()
driver.maximize_window()
# Navigage to URL and put ... | twiindan/selenium_lessons | 04_Selenium/exercices/expedia.py | Python | apache-2.0 | 654 |
# proof for AVX512 approach
def length(nibble):
if nibble & 0x8 == 0x0:
return 1
if nibble & 0xc == 0x8:
return 0
if nibble & 0xe == 0xc:
return 2
if nibble & 0xf == 0xe:
return 3
if nibble & 0xf == 0xf:
return 4
assert False
def generate_words():
... | WojciechMula/toys | avx512-utf8-to-utf32/validate/avx512-validate-leading-bytes.py | Python | bsd-2-clause | 3,842 |
#!/usr/bin/python3
"""Script to determine the Pywikibot version (tag, revision and date).
.. versionchanged:: 7.0
version script was moved to the framework scripts folder
"""
#
# (C) Pywikibot team, 2007-2021
#
# Distributed under the terms of the MIT license.
#
import codecs
import os
import sys
import pywikibot
... | wikimedia/pywikibot-core | pywikibot/scripts/version.py | Python | mit | 3,279 |
# 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... | bravomikekilo/mxconsole | mxconsole/backend/event_processing/directory_watcher_test.py | Python | apache-2.0 | 6,673 |
import requests
from flask import current_app
class GoogleMaps:
@classmethod
def get_latlong(cls, address):
params = {
'address': address,
'key': current_app.config['GOOGLE']['maps_api_key'],
}
url = "https://maps.googleapis.com/maps/api/geocode/json"
i... | SalveMais/api | salvemais/util/maps.py | Python | mit | 585 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/primaires/scripting/fonctions/nb_possede.py | Python | bsd-3-clause | 3,519 |
# 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 Ip(CMakePackage):
"""The NCEP general interpolation library (iplib) contains Fortran 90
... | LLNL/spack | var/spack/repos/builtin/packages/ip/package.py | Python | lgpl-2.1 | 1,242 |
# -*- coding:utf-8 -*-
from .utils import github_url, connect_url
class FBRankException(Exception):
""" Base Exception FOr FBRank Project
"""
exit_code = 1
def __init__(self, message):
pass
def __repr__(self):
return "This is Base Exception"
__str__ = __repr__
class Illega... | Allianzcortex/FBRank | FBRank/utils/exceptions.py | Python | apache-2.0 | 1,097 |
import sqlalchemy as sa
from oslo_db.sqlalchemy import types as db_types
from nca47.db.sqlalchemy.models import base as model_base
from nca47.objects import attributes as attr
HasTenant = model_base.HasTenant
HasId = model_base.HasId
HasStatus = model_base.HasStatus
HasOperationMode = model_base.HasOperationMode
c... | willowd878/nca47 | nca47/db/sqlalchemy/models/dns.py | Python | apache-2.0 | 1,680 |
# -*- coding: utf-8 -*-
__author__ = 'shreejoy'
import unittest
from article_text_mining.rep_html_table_struct import rep_html_table_struct
class RepTableStructureTest(unittest.TestCase):
@property
def load_html_table_simple(self):
# creates data table object 16055 with some dummy data
with... | lessc0de/neuroelectro_org | tests/test_rep_html_table_struct.py | Python | gpl-2.0 | 4,428 |
from hashlib import sha1
def grade(autogen, key):
secretkey = "my_key_here"
n = autogen.instance
flag = sha1((str(n) + secretkey).encode('utf-8')).hexdigest()
if flag.lower() in key.lower().strip():
return True, "Correct!"
else:
return False, "Try Again."
def get_hints():
return... | mcpa-stlouis/mcpa-ctf | example_problems/web/hidden-message/grader/grader.py | Python | mit | 397 |
from csp import Channel, put, go, alts, sleep, CLOSED
def produce(chan, value):
yield sleep(0.1)
yield put(chan, value)
def main():
chans = []
for i in range(20):
chan = Channel()
go(produce, chan, i)
chans.append(chan)
def timeout(seconds):
chan = Channel()
... | ubolonton/twisted-csp | example/select.py | Python | epl-1.0 | 627 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "swiftwind_heroku.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure ... | adamcharnock/swiftwind-heroku | manage.py | Python | mit | 814 |
import gzip
import os
import struct
import tempfile
import unittest
from io import BytesIO, StringIO, TextIOWrapper
from unittest import mock
from django.core.files import File
from django.core.files.base import ContentFile
from django.core.files.move import file_move_safe
from django.core.files.temp import NamedTempo... | labcodes/django | tests/files/tests.py | Python | bsd-3-clause | 13,129 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-07 19:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name='Subscription... | renzon/wttd | eventex/subscriptions/migrations/0001_initial.py | Python | agpl-3.0 | 844 |
# 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, software
# d... | phenoxim/cinder | cinder/volume/targets/nvmeof.py | Python | apache-2.0 | 5,303 |
import os
import boto
from boto.s3.key import Key
from boto.s3.connection import OrdinaryCallingFormat
def upload_s3_book(release, directory):
conn = boto.s3.connect_to_region(
'us-west-1', calling_format=OrdinaryCallingFormat())
bucket = conn.get_bucket('readiab.org')
html = {'Content-type': 'te... | gregcaporaso/build-iab | biab/s3.py | Python | bsd-3-clause | 1,217 |
# Copyright The OpenTelemetry 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 to in ... | open-telemetry/opentelemetry-python | opentelemetry-sdk/tests/metrics/test_instrument.py | Python | apache-2.0 | 7,197 |
# 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: symbol.py
"""Non-terminal symbols of Python grammar (from "graminit.h")."""
single_input = 256
file_input = 257
eval_input = 258
decorator = 259
deco... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/symbol.py | Python | unlicense | 1,939 |
# -*- coding: utf-8 -*-
from __future__ import division
# Copyright (C) 2007 Samuel Abels
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at you... | zetaops/SpiffWorkflow | SpiffWorkflow/specs/TaskSpec.py | Python | lgpl-3.0 | 16,586 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.