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 |
|---|---|---|---|---|---|
from pprint import pprint
from django.conf import settings
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.shortcuts import render
from django.views import View
import lotes.models
import lotes.queries
from lotes.views.lote.conserto_lote import dict_conserto_lote
import cd.forms
import cd.... | anselmobd/fo2 | src/cd/views/enderecar.py | Python | mit | 4,785 |
from rest_framework import routers
from adhocracy4.api.routers import CustomRouterMixin
class LikesRouterMixin(CustomRouterMixin):
prefix_regex = (
r'questions/(?P<question_pk>[\d]+)/{prefix}'
)
class LikesDefaultRouter(LikesRouterMixin, routers.DefaultRouter):
pass
| liqd/a4-meinberlin | meinberlin/apps/likes/routers.py | Python | agpl-3.0 | 293 |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 08 19:51:22 2013
The general object used in MONK
@author: xm
"""
from ..math.flexible_vector import FlexibleVector
import base, crane
import constants as cons
import logging
logger = logging.getLogger('monk.entity')
class Entity(base.MONKObject):
FEATURES = '_features... | xumiao/pymonk | monk/core/entity.py | Python | mit | 1,907 |
import os
import json
import requests
from flask import Flask, Response, request, send_from_directory
# if not os.environ.get("dbo-userid"):
# import secrets
app = Flask(__name__, static_url_path='', static_folder='')
app.debug = True
app.add_url_rule('/', 'root', lambda: app.send_static_file('example2.html'))
... | zachwooddoughty/react-playground | server.py | Python | mit | 1,233 |
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.utils.encoding import force_str
from rest_framework import exceptions
from rest_framework.metadata import SimpleMetadata
from rest_framework.request import clone_request
from peering_manager.api import ContentTypeField
cl... | respawner/peering-manager | peering_manager/api/metadata.py | Python | apache-2.0 | 2,404 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | sxjscience/tvm | python/tvm/_ffi/registry.py | Python | apache-2.0 | 8,457 |
# apis_v1/documentation_source/shared_item_retrieve_doc.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
def shared_item_retrieve_doc_template_values(url_root):
"""
Show documentation about sharedItemRetrieve
"""
required_query_parameter_list = [
{
'name': '... | wevote/WeVoteServer | apis_v1/documentation_source/shared_item_retrieve_doc.py | Python | mit | 3,864 |
"""
Takes a frame, its location, and more info.
Puts that into a bytestream.
"""
import pickle
class MoViPack:
"Handles the logic of assembling information into packets"
def __init__(self):
print("Pickler")
def get_pickles(self, frame):
k = 10
return [pickle.dumps(frame[x:(x+k),... | netsecIITK/moVi | movi/image/pack.py | Python | apache-2.0 | 466 |
import re
import string
import sys
sys.path.append('/Users/exu/PlayGround/readinglists/')
from key.keys import *
from amazon.api import AmazonAPI
from html2text import html2text
pattern = re.compile("https?://.*amazon.com/gp/product/([0-9]+)/.*")
amazon = AmazonAPI(AMAZON_ACCESS_KEY_ID, AMAZON_SECRET_ACCESS_KEY, AMAZ... | xuy/readinglists | md_gen/parse.py | Python | mit | 1,942 |
# Copyright (c) 2013 New Dream Network, LLC (DreamHost)
#
# 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... | ctrlaltdel/neutrinator | vendor/pbr/tests/test_packaging.py | Python | gpl-3.0 | 36,101 |
# Copyright (C) 2020 OpenMotics BV
#
# 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
# License, or (at your option) any later version.
#
# This program is distribu... | openmotics/gateway | src/gateway/mappers/module.py | Python | agpl-3.0 | 1,770 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Dynamic feature configuration.
Introduction
============
The point of feature flags is to let us turn some features of Launchpad on
and off without changing the code or restar... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/services/features/__init__.py | Python | agpl-3.0 | 8,662 |
import os
import sys
lib_path = os.path.abspath('../')
sys.path.append(lib_path)
import makerbot_driver
import serial
import serial.tools.list_ports as lp
import optparse
import argparse
argparser = argparse.ArgumentParser(description="Print this gcode file")
#MONKEY PATCH BEGIN
def argparse_error_override(message):... | Jnesselr/s3g | examples/print_gcode_file_nice.py | Python | agpl-3.0 | 3,003 |
import random
import tensorflow as tf
from sklearn.svm import SVC
from BrainNet import BrainNet
for run in range(0, 1):
batch_size = 5000
alpha = 0.5
learning_rate = 0.0001
l2_weight = 0.001
validation_size = 500
print('Run: {:d}, Alpha: {:1.1f}, Learning Rate: {:3.2e}, L2-Weight: {:3.2e}, Batch Size: {:d}'.for... | krisht/Krishna-Thesis | Thesis/chapters/runner.py | Python | mit | 768 |
"""
homeassistant.components.light.isy994
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for ISY994 lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/isy994/
"""
import logging
from homeassistant.components.isy994 import (
HIDDEN_STRING, ISY, SE... | nnic/home-assistant | homeassistant/components/light/isy994.py | Python | mit | 1,499 |
"""
Tahmatassu Web Server
~~~~~~~~~~~~~~~~~~~~~
Users module hold userinfomation related logic
:copyright: (c) 2014 by Teemu Puukko.
:license: MIT, see LICENSE for more details.
"""
from collections import OrderedDict
from datetime import timedelta
from flask import make_response, request, current_app
from functools im... | puumuki/tahmatassu-api | tahmatassu-server/utils.py | Python | mit | 2,802 |
import importlib
import os
from typing import List, Optional
import django.urls.resolvers
import ujson
from django.test import Client
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Stream
from zproject import urls
class PublicURLTest(ZulipTestCase):
"""
Account creation URLs are... | synicalsyntax/zulip | zerver/tests/test_urls.py | Python | apache-2.0 | 6,829 |
#!/usr/bin/env python3.6
# vim: set fileencoding=utf-8 tabstop=8 expandtab shiftwidth=4 softtabstop=4 smarttab autoindent:
# -*- coding: utf-8 -*-
"""wikiup.broker"""
import difflib
class Broker(object):
def __init__(self, markdown_document, wiki_page):
self.md = markdown_document
self.page = ... | boweeb/wikiup | wikiup/broker.py | Python | isc | 1,015 |
# Copyright (C) 2011 Chris Dekter
# Copyright (C) 2018 Thomas Hess <thomas.hess@udo.edu>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) a... | autokey/autokey | lib/autokey/qtui/settings/engine.py | Python | gpl-3.0 | 4,148 |
"""Setup script for ``dms_tools``.
Written by Jesse Bloom.
"""
import sys
import os
import re
try:
from setuptools import setup
from setuptools import Extension
except ImportError:
from distutils.core import setup
from distutils.core import Extension
if (sys.version_info[0], sys.version_info[1]) != ... | jbloomlab/dms_tools | setup.py | Python | gpl-3.0 | 2,652 |
"""
demo of multiple processes doing processing and publishing the results
to a common subscriber
"""
from multiprocessing import Process
class Worker(Process):
def __init__(self, filename, bind):
self._filename = filename
self._bind = bind
super(Worker, self).__init__()
def run(self... | mabotech/mabo.task | py/pubsub/zmq1.py | Python | mit | 1,804 |
#-*- coding: utf-8 -*-
from decimal import Decimal
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.test.testcases import TestCase
from shop.backends_pool import backends_pool
from shop.models.ordermodel import... | NB-Dev/django-shop | shop/tests/shipping.py | Python | bsd-3-clause | 7,241 |
"""Support for Ambiclimate ac."""
import asyncio
import logging
import ambiclimate
import voluptuous as vol
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_ON_OFF, STATE_HEAT)
from homeassistant.const import AT... | aequitas/home-assistant | homeassistant/components/ambiclimate/climate.py | Python | apache-2.0 | 7,406 |
# Setup file for package int_methods
from setuptools import setup
setup(name="int_methods",
version="0.0.1",
install_requires=["quark==0.0.1"],
py_modules=['int_methods'],
packages=['int_methods', 'int_methods_md'])
| bozzzzo/quark | quarkc/test/emit/expected/py/int-methods/setup.py | Python | apache-2.0 | 242 |
QUERY_LOGGING = {
'formatters': {
'wrapper_verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'wrapper_simple': {
'format': '%(levelname)s %(message)s'
},
'wrapper_json': {
'()': 'jsonlogger.J... | MattBlack85/django-query-logger | query_logger/settings.py | Python | mit | 981 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import products.models
class Migration(migrations.Migration):
dependencies = [
('products', '0005_auto_20150918_1724'),
]
operations = [
migrations.CreateModel(
name='Pro... | abhijitbangera/ecommerce | src/products/migrations/0006_productfeatured.py | Python | mit | 1,038 |
from django.contrib import admin
# Register your models here.
from .models import Survey, Questionnaire
admin.site.register(Survey)
admin.site.register(Questionnaire)
| ONSdigital/alpha-eq-author | survey/admin.py | Python | mit | 169 |
# 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 PyTzlocal(PythonPackage):
"""tzinfo object for the local timezone."""
homepage = "htt... | LLNL/spack | var/spack/repos/builtin/packages/py-tzlocal/package.py | Python | lgpl-2.1 | 681 |
# Copyright 2015-present The Scikit Flow 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 require... | awni/tensorflow | tensorflow/examples/skflow/text_classification_character_rnn.py | Python | apache-2.0 | 2,672 |
import calendar
import datetime
import functools
import hashlib
import logging
import uuid
import user_agents
from bitpack import BitStream, BitField, register_data_type
from bitpack.utils import pack, unpack
from bottle_utils.common import to_bytes
from pytz import utc
FIELD_SEPARATOR = '$'
DESKTOP = 1
PHONE = 2
... | Outernet-Project/librarian-analytics | librarian_analytics/data.py | Python | gpl-3.0 | 4,521 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'litleleprikon'
from random import randint
FIGURES = ['камень', 'бумага', 'ножницы']
FIG_LEN = len(FIGURES)
class Player:
"""
Player class is needed to store tactics and to generate figures by this tactic
-- Doctests --
>>> player = Play... | litleleprikon/innopolis_test_task | problem_2_rock_paper_scissor/player.py | Python | apache-2.0 | 846 |
# -*- coding: utf-8 -*-
"""
shellstreaming.scheduler.worker_select_queue_local_first_and_random
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:synopsis:
"""
# standard module
import random
# my module
import shellstreaming.worker.worker_struct as ws
def select_remote_worker_to_pop(edge_id, workers... | laysakura/shellstreaming | shellstreaming/scheduler/worker_select_queue_local_first_and_random.py | Python | apache-2.0 | 632 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | hanlind/nova | nova/cmd/compute.py | Python | apache-2.0 | 1,917 |
import re
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.utils.translation import ugettext_lazy as _
from reguser.utils import generate_username
EMAIL_WHITELIST_ERROR_MESSAGE = _("Only e-mail addresses from the following domains are allowed: ")
class WhitelistFieldMixin(ob... | a115/reguser | reguser/forms.py | Python | unlicense | 4,433 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#... | drolando/SoftDev | engine/python/fife/extensions/pychan/widgets/containers.py | Python | lgpl-2.1 | 19,385 |
import os
def log(*args):
with open('/sd/can.log', 'a') as f:
print(','.join(args), file=f)
os.sync()
| kamikaze/pyboard-examples | can/logger.py | Python | gpl-3.0 | 122 |
# -*- coding: utf-8 -*-
import json
import zipfile
import os
import re
import configparser
from urllib import request, parse
def parse_class(t, cn=None, array=False):
size = (t[8] << 8) + t[9]
index = 10
count = 1
out = []
pool = [0] * size
indexlist = [0] * size
while count < size:
... | woodensail/ExtractString | extract_string.py | Python | mit | 8,718 |
# -*- coding: utf-8 -*-
from decimal import Decimal
from collections import namedtuple
from sqlalchemy.ext.orderinglist import ordering_list
from ..models import db, BaseMixin, Order, SaleItem
from coaster.utils import LabeledEnum
from baseframe import __
__all__ = ['LineItem', 'LINE_ITEM_STATUS']
class LINE_ITEM_S... | hasgeek/outreach | outreach/models/line_item.py | Python | agpl-3.0 | 3,508 |
# -*- coding: utf-8 -*-
# Copyright 2014-2015 VPAC
# Copyright 2014 The University of Melbourne
#
# This file is part of Karaage.
#
# Karaage 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... | Karaage-Cluster/karaage-debian | karaage/conf/defaults.py | Python | gpl-3.0 | 12,512 |
#!/bin/env python
import os
from setuptools import setup
name = 'django-transfer'
version = '0.4'
readme = os.path.join(os.path.dirname(__file__), 'README.rst')
with open(readme) as readme_file:
long_description = readme_file.read()
setup(
name = name,
version = version,
description = 'A django appli... | smartfile/django-transfer | setup.py | Python | mit | 1,098 |
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^', include('restapi.urls')),
url(r'^.*$',
TemplateView.as_view(template_name='restapi/index.html'),
name='index'),
url(r'^admin/', admin.site.urls)... | andela-ggikera/djangular-bucketlist-app | bucketlist/bucketlist/urls.py | Python | mit | 324 |
from django.conf import settings
from django.core.management.base import BaseCommand
from iati.models import Activity
from iati.transaction.models import Transaction
class Command(BaseCommand):
def update_searchable_activities(self):
"""
Set all activities to searchable if the reporting org is i... | openaid-IATI/OIPA | OIPA/iati/management/commands/set_searchable_activities.py | Python | agpl-3.0 | 1,970 |
# -*- coding: utf-8 -*-
"""
@author: Philippe Giraudeau
Philippe Giraudeau <philippe@giraudeau.eu>
"""
#Modules
import math
import random
import pylab as pl
def rand(a, b):
return (b-a)*random.random() + a
# Number of neuron in Input, Hidden and output layer.
li = 24
lh = 30
lo = 1
iterations = 2000 # Number ... | masterchef8/IUT-PTUT | ia/lastMLP.py | Python | gpl-3.0 | 5,001 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
from tests.common import assert_equal, assert_not_equal
def _item(x):
if isinstance(x, torch.Tensor):
x = x.item... | uber/pyro | tests/poutine/test_counterfactual.py | Python | apache-2.0 | 3,830 |
from __future__ import print_function
from numpy import pi, arange, sin
import numpy as np
import time
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
Plot, DataRange1d, DatetimeAxis,
Colu... | zrhans/python | exemplos/Examples.lnk/bokeh/glyphs/dateaxis.py | Python | gpl-2.0 | 1,293 |
# -*- coding: utf-8 -*-
from tw.api import CSSLink, JSLink, JSSource
from tw.forms.fields import InputField,SingleSelectField,TextArea,RadioButtonList,Form, ListFieldSet, HiddenField,MultipleSelectField
from tg import config
FIXED_WIDTH_CLASS = "width-250"
OPTION_WIDTH_CLASS = "width-220"
FIXED_HEIGHT_CLASS = "heigh... | LamCiuLoeng/gap | gapproject/widgets/components.py | Python | mit | 3,597 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.enums import DBMS
from lib.core.enums import OS
from lib.core.enums import POST_HINT
from lib.core.settings import BLANK
from lib.core.settings import NULL
from ... | undefinedv/Jingubang | sqlmap/lib/core/dicts.py | Python | gpl-3.0 | 9,693 |
#!/usr/bin/env python
# Copyright 2017 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 ag... | somic/paasta | paasta_tools/marathon_dashboard.py | Python | apache-2.0 | 4,448 |
class Solution:
# @param {integer} n
# @return {boolean}
# using set
def isHappy(self, n):
numSet = set()
while n != 1 and n not in numSet:
numSet.add(n)
numSum = 0
while n:
digit = n % 10
numSum += digit ** 2
... | chengzhoukun/LeetCode | 202. Happy Number/Happy Number.py | Python | lgpl-3.0 | 496 |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from setuptools import setup, find_packages
requires = [
'letsencrypt',
]
VERSION = '0.2.0'
setup(
name='letsencrypt_gencsr',
version=VERSION,
description='Command line utility to generate a csr for letsencrypt from a preexisting key'... | cbrand/letsencrypt_gencsr | setup.py | Python | mit | 1,221 |
import io
from nose.tools import istest, assert_equal
from mammoth import documents, style_reader, results
from mammoth.conversion import convert_document_element_to_html
from mammoth.docx.xmlparser import parse_xml
@istest
def plain_paragraph_is_converted_to_plain_paragraph():
result = convert_document_element... | JoshBarr/python-mammoth | tests/conversion_tests.py | Python | bsd-2-clause | 5,892 |
#!/usr/bin/env python
import sys
import os
import urllib
import json
import re
from models import *
from ApiClient import ApiException
class TasksApi(object):
def __init__(self, apiClient):
self.apiClient = apiClient
def DeleteProjectAssignment(self, name, assignmentUid, **kwargs):
"""D... | sohail-aspose/Aspose_Tasks_Cloud | SDKs/Aspose.Tasks_Cloud_SDK_for_Python/asposetaskscloud/TasksApi.py | Python | mit | 143,735 |
# coding:utf8
__author__ = 'Marcelo Ferreira da Costa Gomes'
import pandas as pd
import numpy as np
from fludashboard.libs.flu_data import FluDB
db = FluDB()
def get_all_territories_and_years(filtertype: str='srag'):
table_suffix = {
'srag': '',
'sragnofever': '_sragnofever',
'hospdeath... | FluVigilanciaBR/seasonality | methods/data_filter/contingency_level.py | Python | gpl-3.0 | 8,367 |
#!/usr/bin/python
import sys
fa=sys.stdin
dict={}
ins_count={}
while True:
line=fa.readline()
if not line : break
words=line.split()
pid =words[0].strip() #get pid
tid =words[1].strip() #get tid
tname =words[2].strip() #get tname
pid_tid_tname = pid+' '+tid+' '+tname
for i in range... | elliott10/qemu-instru-tracer | deploy_help_doc/all_work_flow/prog/thread_stat.py | Python | gpl-2.0 | 932 |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
""" Module for statistics calculation side of the ui"""
from PyQt5.QtWidgets import QVBoxLayout, QWidget, QLabel, QPushButton, QFileDialog
class GUIStatisticsCalculation(QWidget):
""" Right side of UI, ie. the statistics calculation settings and parameters."""
de... | ukasofisosaari/kuksa_tilastotyokalu | src/gui_statistics_calculation.py | Python | mit | 1,947 |
# Copyright (C) 2019 Christopher Gearhart
# chris@bblanimation.com
# http://bblanimation.com/
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | feureau/Small-Scripts | Blender/Blender config/2.91/scripts/addons/assemblme_v1-4-0/functions/common_mesh_generate.py | Python | gpl-3.0 | 15,804 |
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | fracpete/python-weka-wrapper3 | python/weka/flow/container.py | Python | gpl-3.0 | 7,930 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may ... | yrobla/nova | nova/virt/xenapi/vm_utils.py | Python | apache-2.0 | 85,356 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Generate a translit_cjk_compat file from a UnicodeData file.
# Copyright (C) 2015 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser G... | lbxl2345/glibc | localedata/unicode-gen/gen_translit_cjk_compat.py | Python | gpl-2.0 | 9,322 |
# The Hazard Library
# Copyright (C) 2015-2022 GEM 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
# License, or (at your option) any later version.
#... | gem/oq-engine | openquake/hazardlib/tests/gsim/atkinson_2015_test.py | Python | agpl-3.0 | 1,428 |
import docx2txt
from Documentclient import *
class Patent:
def __init__(self, file='', patent=''):
'''
Fixed template to parse patents
'''
self.file = file
if patent == '':
self.patent = [] # WIll be initialized by file
else:
self.patent = patent.split('\n')
self.template = {'TITLE':'','INVENTOR':... | anirudhagar13/SS_Graph | Parser.py | Python | apache-2.0 | 2,203 |
"""
Conversion pack for October 2021 release
"""
CONVERSIONS = {
# Renamed items
"Quafe Zero": "Quafe Zero Classic",
"Exigent Sentry Drone Navigation Mutaplasmid": "Exigent Sentry Drone Precision Mutaplasmid",
}
| pyfa-org/Pyfa | service/conversions/releaseOct2021.py | Python | gpl-3.0 | 225 |
from django.conf.urls import url, include
from users.views import UserRegistrationAPIView, UserLoginAPIView, UserLogoutAPIView
urlpatterns = [
url(r'^register/', UserRegistrationAPIView.as_view(), name="create"),
url(r'^login/', UserLoginAPIView.as_view(), name="login"),
url(r'^logout/', UserLogoutAPIView.... | Salomari1987/features-api | features/users/urls.py | Python | mit | 350 |
from annoy import AnnoyIndex
a = AnnoyIndex(3, 'angular')
a.add_item(0, [1, 0, 0])
a.add_item(1, [0, 1, 0])
a.add_item(2, [0, 0, 1])
a.build(-1)
print(a.get_nns_by_item(0, 100))
print(a.get_nns_by_vector([1.0, 0.5, 0.5], 100))
| spotify/annoy | examples/simple_test.py | Python | apache-2.0 | 229 |
#runas solve()
#unittest.skip recursive generator
#pythran export solve()
def solve():
'''
In England the currency is made up of pound, P, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, P1 (100p) and P2 (200p).
It is possible to make P2 in the following way:
... | serge-sans-paille/pythran | pythran/tests/euler/euler31.py | Python | bsd-3-clause | 1,019 |
''' Kivy Widget that accepts data and displas qrcode
'''
from threading import Thread
from functools import partial
from kivy.uix.floatlayout import FloatLayout
from kivy.graphics.texture import Texture
from kivy.properties import StringProperty
from kivy.properties import ObjectProperty, StringProperty, ListPropert... | vcoin-project/electrum | gui/kivy/uix/qrcodewidget.py | Python | gpl-3.0 | 5,346 |
# Run with:
# % python generate_javascript_tests.py > ../javascript/generated_tests.js
import inspect
from pottymouth import Node
from tests import TestPottyMouth
class JavaScriptTestGenerator(TestPottyMouth):
def runTest(self, *a, **kw): pass # I am a fake method
def _helper(self, source, expected):
... | glyphobet/pottymouth | python/generate_javascript_tests.py | Python | bsd-3-clause | 993 |
# quick_info/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
# Diagrams here: https://docs.google.com/drawings/d/1fEs_f2-4Du9knJ8FXn6PQ2BcmXL4zSkMYh-cp75EeLE/edit
from ballot.models import OFFICE, CANDIDATE, POLITICIAN, MEASURE, KIND_OF_BALLOT_ITEM_CHOICES
from django.db import models
from exce... | wevote/WeVoteServer | quick_info/models.py | Python | mit | 40,696 |
# pylint: disable=missing-docstring, pointless-statement
from __future__ import print_function
def totoo():
print('malindented') # [bad-indentation]
def tutuu():
print('good indentation')
def titii():
1 # and this. # [bad-indentation]
def tataa(kdict):
for key in ['1', '2', '3']:
key = key.l... | justathoughtor2/atomicApe | cygwin/lib/python2.7/site-packages/pylint/test/functional/bad_indentation.py | Python | gpl-3.0 | 381 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# beta.1 Regex de Byetv
# Version 0.1 (17.10.2014)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a la librería plugintools de Jesús (www.mimediacenter... | iptvgratis/iptv.stalker.latino | resources/regex/byetv.py | Python | gpl-3.0 | 6,413 |
from rest_framework import serializers
from .models import Activity, Vote, PotentialAttendee, Assistant
class ActivityViewSerializer(serializers.ModelSerializer):
class Meta:
model = Activity
depth = 1
class ActivityPostSerializer(serializers.ModelSerializer):
class Meta:
model = Activ... | david2307/backend_159 | activities/serializers.py | Python | gpl-3.0 | 626 |
"""Provides class and methods for abstracting the data from AFLOW into
python.
"""
from aflow.caster import cast
import aflow.keywords as kw
def _val_from_str(attr, value):
"""Retrieves the specified attribute's value, cast to an
appropriate python type where possible.
"""
clsname = "_{}".format(attr)
... | rosenbrockc/aflow | aflow/entries.py | Python | mit | 69,723 |
#!/bin/python
import praw
import re
import os
import sqlite3
import time
from config_bot import *
import datetime
header = "Type|Artist(s)/Event|Venue|Price|Time\n---|---|---|---|---|---|---|\n"
footer1 = "------------------------\n[Link to next week's draft post]("
footer2 = "). If you know of something awesome hap... | robertbarrett/eventsottawabot | eventsOttawaBot.py | Python | mit | 7,649 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Carlos Jenkins <carlos@jenkins.co.cr>
#
# 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
#
# Unles... | carlos-jenkins/confspec | test/providers/__init__.py | Python | apache-2.0 | 698 |
"""An API for managing OAuth2 tokens."""
from __future__ import unicode_literals
from django.db.models.query import Q
from django.utils.translation import ugettext_lazy as _
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_required,
... | chipx86/reviewboard | reviewboard/webapi/resources/oauth_token.py | Python | mit | 12,036 |
"""SCons.Tool.Packaging.ipk
"""
#
# __COPYRIGHT__
#
# 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, merg... | Distrotech/scons | src/engine/SCons/Tool/packaging/ipk.py | Python | mit | 6,208 |
import time
from typing import List
from src.classes.dto.Block import Block
from src.classes.BlockChainValidator import BlockChainValidator
from src.classes.dto.Transaction import Transaction
class BlockChain(object):
def __init__(self):
self.chain: List[Block] = []
self.new_transactions: List[Tr... | JasonQuinn/BlockChain | src/classes/dto/BlockChain.py | Python | apache-2.0 | 1,351 |
# -*- coding: 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):
# Deleting model 'SkeletonlistDashboard'
db.delete_table('skeletonlist_dashboard')
def backwards(self,... | AdaEne/CATMAID | django/applications/catmaid/migrations/0021_auto__del_skeletonlistdashboard.py | Python | gpl-3.0 | 43,285 |
from StringIO import StringIO
import unittest2 as unittest
from libcloud.compute.base import NodeImage, Node, NodeSize
from libcloud.compute.types import Provider, NodeState
from libcloud.compute.drivers.openstack import OpenStackNetwork
import mock
from littlechef_rackspace.api import RackspaceApi
from littlechef_rac... | thegreenrobot/littlechef-rackspace | test/test_api.py | Python | mit | 10,670 |
import time
print "hello"
time.sleep(1)
print "bye"
| husky-prophet/personal-backup | python.py | Python | mit | 56 |
"""Implementation of __array_function__ overrides from NEP-18."""
import collections
import functools
import os
import textwrap
from numpy.core._multiarray_umath import (
add_docstring, implement_array_function, _get_implementing_args)
from numpy.compat._inspect import getargspec
ARRAY_FUNCTION_ENABLED = bool(
... | grlee77/numpy | numpy/core/overrides.py | Python | bsd-3-clause | 8,273 |
"""
The functionality itself for each task.
Each task is specified with the ``an_action`` decorator
"""
from bespin.errors import BespinError, BadOption, ProgrammerError
from bespin.option_spec.bespin_specs import valid_password_key
from bespin.option_spec.stack_specs import env_spec
from bespin.amazon.credentials im... | delfick/bespin | bespin/actions.py | Python | mit | 22,151 |
# (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any l... | jkettleb/iris | lib/iris/tests/unit/merge/test__CubeSignature.py | Python | lgpl-3.0 | 4,340 |
import os
import sys
from os.path import join, dirname
import mock
import pytest
from .base import all_products, active_products
sys.path.insert(0, join(dirname(__file__), "..", "..", "..", "..")) # repo root
from tools import localpaths
from wptserve import sslutils
from wptrunner import environment
from wptrunn... | mbrubeck/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_products.py | Python | mpl-2.0 | 2,066 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-bigtable | google/cloud/bigtable_admin_v2/types/__init__.py | Python | apache-2.0 | 4,379 |
# No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
#
# 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
#
# U... | opalmer/deprecated-pyfarm-models | tests/test_core_types.py | Python | apache-2.0 | 10,529 |
# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# for py2/py3 compatibility
from __future__ import print_function
import signal
from . import base
from testrunner.local import utils
class SignalProc(... | weolar/miniblink49 | v8_7_5/tools/testrunner/testproc/sigproc.py | Python | apache-2.0 | 1,059 |
#coding: utf-8
## Copyright 2009-2012 Luc Saffre
## This file is part of the Lino project.
## Lino 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 optio... | MaxTyutyunnikov/lino | lino/modlib/notes/fixtures/demo.py | Python | gpl-3.0 | 2,500 |
# from django.conf.urls import url
#
# from .views import ContactUsFormPageView
#
# urlpatterns = [
# url(r'^$', ContactUsFormPageView.as_view(), name='contact_us'),
#
# ] | virbose/demosite | demosite/contact/urls.py | Python | mit | 175 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0025_auto_20150907_1829'),
]
operations = [
migrations.AlterField(
model_name='pollrun',
na... | xkmato/tracpro | tracpro/polls/migrations/0026_auto_20150930_1334.py | Python | bsd-3-clause | 1,095 |
# -*- coding: utf-8 -*-
# Copyright 2007-2011 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | sillvan/hyperspy | hyperspy/axes.py | Python | gpl-3.0 | 28,501 |
# 发布
from distutils.core import setup
setup(
name = 'CankingApp',
version = '1.0',
py_modules = ['method'],
author = 'CankingApp',
author_email = 'king@gmail.com',
url = 'www.baidu.com',
descripthin= 'test',
)
| CankingApp/Python | Demo/method/setup.py | Python | apache-2.0 | 292 |
# -*- coding: utf-8 -*-
import httplib as http
from flask import request
from boto.exception import BotoServerError
from framework.exceptions import HTTPError
from framework.status import push_status_message
from framework.auth.decorators import must_be_logged_in
from website.project.decorators import must_have_per... | GaryKriebel/osf.io | website/addons/s3/views/config.py | Python | apache-2.0 | 5,438 |
'''Various constants.'''
from __future__ import unicode_literals
APP_URL = 'http://vkontakte-feed.appspot.com/'
'''URL of the application.'''
API_URL = 'http://api.vk.com/'
'''URL of VKontakte API.'''
VK_URL = 'http://vk.com/'
'''URL of VKontakte site.'''
MINUTE_SECONDS = 60
'''Number of seconds in minute.'''
HOU... | KonishchevDmitry/vkfeed | vkfeed/constants.py | Python | bsd-2-clause | 515 |
# Copyright 2016 Dell Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | bswartz/cinder | cinder/interface/volume_management_driver.py | Python | apache-2.0 | 3,264 |
# Copyright (c) 2010 Stephen Paul Weber. Based on work by Joao Prado Maia.
# Licensed under the ISC License
import MySQLdb
import time
from mimify import mime_encode_header, mime_decode_header
import re
import settings
import mime
import strutil
import os.path
try:
import html2text
except ImportError:
html2te... | singpolyma/papercut-wordpress | wordpress.py | Python | isc | 25,647 |
# Advent of code day 24 part 1 challenge
# http://adventofcode.com/day/24
# Tiago Almeida, 2015
items = [1,2,3,5,7,13,17,19,23,29,31,37,
41,43,53,59,61,67,71,73,79,83,89,
97,101,103,107,109,113]
def part1():
"""
Solution approach:
- calculate compartment weight (cw) for each compartment (cw)
- generate co... | jumpifzero/advent-of-code-2015 | 24/main.py | Python | gpl-2.0 | 1,395 |
##############################################################################
# Copyright 2018 Rigetti Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://ww... | rigetticomputing/pyquil | pyquil/api/_quantum_computer.py | Python | apache-2.0 | 58,695 |
# -*- coding: utf-8 -*-
# Author: Leonardo Pistone
# Copyright 2015 Camptocamp SA
#
# 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
# License, or... | OpenCode/stock-logistics-workflow | stock_ownership_by_move/__openerp__.py | Python | agpl-3.0 | 1,229 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | savi-dev/heat | heat/db/sqlalchemy/migrate_repo/versions/015_grizzly.py | Python | apache-2.0 | 7,113 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.