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 |
|---|---|---|---|---|---|
# coding=utf-8
import unittest
"""889. Construct Binary Tree from Preorder and Postorder Traversal
https://leetcode.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal/description/
Return any binary tree that matches the given preorder and postorder
traversals.
Values in the traversals `pre` and... | openqt/algorithms | leetcode/python/lc889-construct-binary-tree-from-preorder-and-postorder-traversal.py | Python | gpl-3.0 | 1,207 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 21 10:23:46 2016
"""
import argparse
import cPickle
import seaborn as sns
import matplotlib.pylab as plt
import pandas as pd
import numpy as np
from matplotlib.lines import Line2D
import re
sns.set_style("darkgrid")
lscol_ptn = re.compile("LockingState([0-9]+)")
def d... | hildensia/joint_dependency | joint_dependency/interpret_results.py | Python | mit | 3,372 |
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('coapOption')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
from . import coapUtils as u
from . import coapException as e
from . import coapDefines as d
#==================... | ccarrizosa/coap | coap/coapOption.py | Python | bsd-3-clause | 9,071 |
# 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 the... | cneill/barbican | barbican/tests/plugin/crypto/test_manager.py | Python | apache-2.0 | 1,298 |
#!/usr/bin/env python3
import argparse
import glob
import os
import struct
import sys
def clamp_to_min_max(value, min, max):
if value > max:
value = max
elif value < min:
value = min
return value
def clamp_to_u8(value):
return clamp_to_min_max(value, 0, 255)
def parse_args():
pars... | z3ntu/razer-drivers | scripts/razer_mouse/driver/static_effect.py | Python | gpl-2.0 | 1,698 |
#
# Copyright 2013 IBM Corp.
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.com>
#
# 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
#
# ... | ChinaMassClouds/copenstack-server | openstack/src/ceilometer-2014.2.2/ceilometer/api/middleware.py | Python | gpl-2.0 | 5,417 |
import os
import re
import gettext
import locale
import threading # libsearchfilter_toggle starts thread libsearchfilter_loop
import operator
import gtk
import gobject
import pango
import ui
import misc
import formatting
import mpdhelper as mpdh
from consts import consts
import breadcrumbs
def library_set_data(albu... | onto/sonata | sonata/library.py | Python | gpl-3.0 | 66,200 |
#
# Copyright (C) 2009 The Android Open Source Project
#
# 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 la... | lovesecho/xrepo | subcmds/version.py | Python | apache-2.0 | 1,123 |
from babel.dates import format_date
from babel.numbers import format_currency
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from bluebottle.utils.email_backend import send_mail
from tenant_extras.utils import TenantLanguage
def mail_monthly_donation_processed_notifica... | jfterpstra/bluebottle | bluebottle/recurring_donations/mails.py | Python | bsd-3-clause | 1,426 |
# -*-coding: utf-8 -*-
import colander
from . import(
ResourceSchema,
BaseForm,
BaseSearchForm,
BaseAssignForm,
)
from ..resources.mails import MailsResource
from ..models.mail import Mail
from ..models.address import Address
from ..models.note import Note
from ..models.task import Task
from ..lib.qb... | mazvv/travelcrm | travelcrm/forms/mails.py | Python | gpl-3.0 | 2,494 |
from twitterpandas import TwitterPandas
from examples.keys import TWITTER_OAUTH_SECRET, TWITTER_OAUTH_TOKEN, TWITTER_CONSUMER_SECRET, TWITTER_CONSUMER_KEY
__author__ = 'freddievargus'
if __name__ == '__main__':
tp = TwitterPandas(
TWITTER_OAUTH_TOKEN,
TWITTER_OAUTH_SECRET,
TWITTER_CONSUMER... | wdm0006/twitter-pandas | examples/saved_search_methods.py | Python | bsd-3-clause | 576 |
import matplotlib.colors
import matplotlib.cm
import matplotlib.colorbar
import matplotlib.pyplot
import numpy
# colormaps: "viridis", "plasma_r","seismic"
def get_colormap(observable_name=None):
if "diff_minutes" in observable_name:
norm = matplotlib.colors.Normalize(vmin=-30, vmax=30)
cmap = ma... | CxAalto/gtfspy | gtfspy/colormaps.py | Python | mit | 3,330 |
from pycp2k.inputsection import InputSection
class _each211(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... | SINGROUP/pycp2k | pycp2k/classes/_each211.py | Python | lgpl-3.0 | 1,114 |
# coding: utf-8
"""
39. Testing using the Test Client
The test client is a class that can act like a simple
browser for testing purposes.
It allows the user to compose GET and POST requests, and
obtain the response that the server gave to those requests.
The server Response objects are annotated with the details
of t... | faun/django_test | tests/modeltests/test_client/models.py | Python | bsd-3-clause | 21,290 |
import os.path
from django import forms
from django.contrib.admin.helpers import ActionForm
from django.utils.translation import gettext_lazy as _
class ImportForm(forms.Form):
import_file = forms.FileField(
label=_('File to import')
)
input_format = forms.ChoiceField(
label=_('Format... | django-import-export/django-import-export | import_export/forms.py | Python | bsd-2-clause | 2,026 |
# 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 ... | sharadagarwal/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/flatten_parameter_group.py | Python | mit | 1,800 |
{% if cookiecutter.use_celery == "y" %}
from __future__ import absolute_import
import os
from celery import Celery
from django.apps import AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SET... | stepanovsh/project_template | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/taskapp/celery.py | Python | bsd-3-clause | 1,059 |
import codecs
import platform
import subprocess
import tempfile
import paramiko
from pytest import raises
import mockssh
def test_ssh_session(server):
for uid in server.users:
with server.client(uid) as c:
_, stdout, _ = c.exec_command("ls /")
assert "etc" in (codecs.decode(bit, ... | carletes/mock-ssh-server | mockssh/test_server.py | Python | mit | 2,991 |
#!/usr/bin/env python
import os
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('pyALGENCAN', parent_package, top_path)
config.add_library('algencan',
sources=[os.path.join('source', '*.f')],
... | DailyActie/Surrogate-Model | 01-codes/pyOpt-1.2.0/pyOpt/pyALGENCAN/setup.py | Python | mit | 697 |
# -*- 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 field 'BootVersion.source'
db.delete_column(u'boots_bootversion', 'source')
# Deleting f... | sophilabs/djangoboot | app/boots/migrations/0009_auto__del_field_bootversion_source__del_field_bootversion_append__add_.py | Python | mit | 9,284 |
import sys, inspect, pdb
from . import ModelObjs
"""
This module contains definitions for function decorators that are used
to instantiate instances of objects such as Stochs.
"""
def stochastic( label=None, func=None, observed=False, dtype=float ):
"""
Decorator for the Stoch class.
CALLING
For a... | tomevans/pyhm | pyhm/InstantiationDecorators.py | Python | gpl-2.0 | 4,592 |
##
# Copyright 2012-2016 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | wpoely86/easybuild-framework | easybuild/toolchains/linalg/intelmkl.py | Python | gpl-2.0 | 8,106 |
import wave, struct
from array import *
import matplotlib.pyplot as plt
from pylab import *
import sys, getopt, os.path #time
#print "Program Start"
file_name = ""
graph = 0
doAvg = 0
filterOrder = 5 #0
baudrate = 4800.0 #9600.0 #9143.0 # Increase Slightly Some more 9183.0 #
offset = 22 #11 # (-1)
bytes... | StephenCarlson/KatanaLRS-code | Decoder/katanaDecoder.py | Python | gpl-2.0 | 7,912 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | dennybaa/st2 | st2api/st2api/signal_handlers.py | Python | apache-2.0 | 941 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | awni/tensorflow | tensorflow/contrib/testing/python/framework/test_util.py | Python | apache-2.0 | 4,163 |
# ==============================================================================
# Copyright 2019 - Philip Paquette
#
# NOTICE: 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 rest... | diplomacy/research | diplomacy_research/models/policy/order_based/v015_film_transformer_gpt/model.py | Python | mit | 34,103 |
# META: timeout=long
import pytest
from tests.support.asserts import assert_error, assert_dialog_handled, assert_success
def is_element_selected(session, element_id):
return session.transport.send(
"GET", "session/{session_id}/element/{element_id}/selected".format(
session_id=session.session... | chromium/chromium | third_party/blink/web_tests/external/wpt/webdriver/tests/is_element_selected/user_prompts.py | Python | bsd-3-clause | 4,102 |
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
from . import wizard
| linkitspa/l10n-italy | l10n_it_fatturapa_out_triple_discount/__init__.py | Python | agpl-3.0 | 111 |
from paver.easy import * # for sh()
import os
@task
def test():
"""Run unit tests."""
import unittest
import tests
suite = unittest.defaultTestLoader.loadTestsFromModule(tests)
unittest.TextTestRunner().run(suite)
@task
def revbuild():
"""Increment the build number."""
import procgame
version_info = procgam... | mjocean/PyProcGameHD-SkeletonGame | pavement.py | Python | mit | 576 |
'''
Created on Feb 26, 2013
@package: superdesk security
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor
Provides the ally core setup patch.
'''
from .service import assemblyGateways, updateAssemblyGateways, \
registerMethodOverride, updateAssemblyAc... | superdesk/Live-Blog | plugins/superdesk-security/__plugin__/superdesk_security/patch_ally_core.py | Python | agpl-3.0 | 1,986 |
import json
import os
import sys
import getopt
import subprocess
import re
import copy
import hashlib
def parseCmakeBoolean(var):
rejected_strings = ['false','off','no']
if var.lower() in rejected_strings:
return False;
else:
return True;
def getBranchName(directory):
"""Returns the na... | quantumsteve/morebin | cmake/CoverallsGenerateGcov.py | Python | mit | 6,396 |
# coding=utf8
'''
使用mongodb的用户模型
'''
__AUTHOR__ = 'seraphln'
from mongoengine.django.auth import User
from mongoengine import Document, IntField, StringField, ReferenceField
class UserProfile(Document):
''' 用户属性模型 '''
user = ReferenceField(User)
last_ip = StringField(max_length=40) #防止ipv6出现,因此设置大一些... | seraphlnWu/snaker | snaker/account/models.py | Python | gpl-2.0 | 690 |
#!/usr/bin/env python2.7
# Copyright 2015-2016, Google Inc.
# 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, thi... | VcamX/grpc | test/core/end2end/gen_build_yaml.py | Python | bsd-3-clause | 11,531 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-09-09 17:28
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auctions', '0038_offercredit'),
]
operations = [
... | codesy/codesy | auctions/migrations/0039_auto_20160909_1728.py | Python | agpl-3.0 | 573 |
"""
Typical complex rows (extension .txtx as extended txt) are:
1@3 1 2 &if n==1:v=100#else:v=10& 3
or (with the same effect)
1@3 1 2 &if n==1:v=100#if n>1:v=10& 3
or
1@3 &v=100*n& 3
or
1@3 1 2 3
; is quite complicated to be used with if, so we use #
n and v are mandatory names
n is the value in first posit... | terna/SLAPP3 | 6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/$$slapp$$/convert_txtx_txt.py | Python | cc0-1.0 | 2,869 |
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. Th... | ChrisPappalardo/mysql-connector-python | tests/cext/test_cext_cursor.py | Python | gpl-2.0 | 20,005 |
# Copyright (c) 2007 MIPS Technologies, Inc.
# 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 list of conditions and ... | koparasy/faultinjection-gem5 | src/cpu/inorder/InOrderCPU.py | Python | bsd-3-clause | 4,432 |
import time, cmd;
from subproc import Popen, PIPE
class ApertiumProcess(Popen):
def __init__(self, arguments, stdin=PIPE, stdout=PIPE, stderr=PIPE):
super(ApertiumProcess, self).__init__(arguments, stdin=stdin, stdout=stdout, stderr=stderr)
def readChar(self, reader):
last_read = self.recv(1)... | unhammer/lttoolbox-oldsvn | tests/apertium_process.py | Python | gpl-2.0 | 1,117 |
from django.apps import AppConfig
class ShareConfig(AppConfig):
name = 'share'
| Oinweb/py-fly | share/apps.py | Python | bsd-2-clause | 85 |
# FIXME: Remove module
from fscore.deprecated import deprecated
__all__ = ["deprecated"]
| FrodeSolheim/fs-uae-launcher | fsui/decorators.py | Python | gpl-2.0 | 91 |
"""
Models for the custom course feature
"""
from datetime import datetime
import logging
from django.contrib.auth.models import User
from django.db import models
from django.utils.timezone import UTC
from lazy import lazy
from student.models import CourseEnrollment, AlreadyEnrolledError # pylint: disable=import-err... | dkarakats/edx-platform | lms/djangoapps/ccx/models.py | Python | agpl-3.0 | 5,217 |
from __future__ import (division, unicode_literals)
import warnings
import numpy as np
from numpy.testing import assert_almost_equal
from scipy.ndimage.interpolation import zoom, shift
from scipy.ndimage.measurements import center_of_mass
from scipy.spatial import cKDTree
def crop_pad(image, corner, shape):
ndim... | rbnvrw/circletracking | circletracking/artificial.py | Python | bsd-3-clause | 11,656 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publ... | pmghalvorsen/gramps_branch | gramps/gen/filters/rules/event/__init__.py | Python | gpl-2.0 | 2,334 |
# Lint as: python3
# Copyright 2019 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 agr... | google/tf-quant-finance | tf_quant_finance/math/segment_ops.py | Python | apache-2.0 | 8,973 |
from textwrap import dedent
from pprint import pformat
from collections import OrderedDict
import attr
from . import sentinel
from .ordering import Ordering
# adapted from https://stackoverflow.com/a/47663099/1615465
def no_default_vals_in_repr(cls):
"""Class decorator on top of attr.s that omits attributes from... | ricklupton/sankeyview | floweaver/sankey_definition.py | Python | mit | 9,779 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley NV
#
# 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 l... | our-city-app/oca-backend | services/oca3/oca/db/__init__.py | Python | apache-2.0 | 763 |
#! /usr/bin/env python
## @package pygraylog.streams
# This package is used to manage Graylog streams using its remote API thanks to requests.
#
import sys, json, requests
from pygraylog.api import MetaObjectAPI
## This class is used to manage the streams.
class Stream(MetaObjectAPI):
## Creates a stream using th... | MisterG/pygraylog | pygraylog/streams.py | Python | gpl-3.0 | 15,040 |
from abc import ABC, abstractmethod
from demo_python_at.commons.message import Message
class Printer(ABC):
"""Base class for all printers."""
@abstractmethod
def print(self, message: Message):
"""Abstract method for printing."""
pass
class StdoutPrinter(Printer):
"""Class that prin... | tatools/demo-python | demo_python_at/commons/printer.py | Python | apache-2.0 | 527 |
"""SCons.Tool.Packaging.ipk
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# 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 ... | Uli1/mapnik | scons/scons-local-2.4.0/SCons/Tool/packaging/ipk.py | Python | lgpl-2.1 | 6,298 |
import os
import datetime
from collections import defaultdict
from django.db import models
from django.db.models import F, Q
from core.models import PlCoreBase,User,Controller
from core.models.plcorebase import StrippedCharField
from core.models import Controller,ControllerLinkManager,ControllerLinkDeletionManager
cla... | xmaruto/mcord | xos/core/models/controlleruser.py | Python | apache-2.0 | 3,800 |
#!/usr/bin/python
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | GoogleCloudPlatform/datacatalog-connectors-rdbms | google-datacatalog-oracle-connector/system_tests/cleanup_results_test.py | Python | apache-2.0 | 1,324 |
#!/usr/bin/env python2
"""
search for bytes in a WMI repository.
author: Willi Ballenthin
email: william.ballenthin@fireeye.com
"""
import sys
import logging
import binascii
import argparse
import cim
logger = logging.getLogger(__name__)
def find_bytes(repo, needle):
index = cim.Index(repo.cim_type, repo.log... | fireeye/flare-wmi | python-cim/samples/find_bytes.py | Python | apache-2.0 | 3,590 |
from pygame import Surface, Rect, transform, font, image
class PassengerTab(Surface):
def __init__(self, position, size, passenger, resourcePath):
Surface.__init__(self, size)
self.position = position
self.size = size
self.passenger = passenger
self.textFont = font.Font(None, 15)
self.passengerSurface = S... | ZakDoesGaming/OregonTrail | lib/passengerTab.py | Python | mit | 543 |
import datetime
import os.path
import time
from typing import Type
from paramiko.ecdsakey import ECDSAKey
from paramiko.pkey import PKey
from paramiko.rsakey import RSAKey
from pytest import mark, raises
from geofront.keystore import parse_openssh_pubkey
from geofront.masterkey import (EmptyStoreError, FileSystemMast... | spoqa/geofront | tests/masterkey_test.py | Python | agpl-3.0 | 8,697 |
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from web import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DAT... | b4ldr/atlas-traceroute-to-bgp | db_create.py | Python | artistic-2.0 | 474 |
####################################################################################################
# This file is part of the CLBlast project. The project is licensed under Apache Version 2.0.
#
# Author(s):
# Cedric Nugteren <www.cedricnugteren.nl>
#
# This file test PyCLBlast: the Python interface to CLBlast. It... | gpu/CLBlast | src/pyclblast/test/test_pyclblast.py | Python | apache-2.0 | 3,568 |
"""
WSGI config for aniauth project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | randomic/aniauth-tdd | aniauth/wsgi.py | Python | mit | 392 |
from django.conf.urls import url
from cats.views.cat import (
CatList,
CatDetail
)
from cats.views.breed import (
BreedList,
BreedDetail
)
urlpatterns = [
# Cats URL's
url(r'^cats/$', CatList.as_view(), name='list'),
url(r'^cats/(?P<pk>\d+)/$', CatDetail.as_view(), name='detail'),
# Bre... | OscaRoa/api-cats | cats/urls.py | Python | mit | 475 |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... | CalthorpeAnalytics/urbanfootprint | footprint/main/utils/import_GTFS_feeds.py | Python | gpl-3.0 | 918 |
### Elliptic curve math - pybitcointools
#P = 2 ** 256 - 2 ** 32 - 2 ** 9 - 2 ** 8 - 2 ** 7 - 2 ** 6 - 2 ** 4 - 1
P = 115792089237316195423570985008687907853269984665640564039457584007908834671663
N = 115792089237316195423570985008687907852837564279074904382605163141518161494337
A = 0
Gx = 5506626302227734366957871889... | inuitwallet/bippy_old | num/elip.py | Python | mit | 1,709 |
import time
import requests
import pytest
import yaml
from suite.ap_resources_utils import (
create_ap_usersig_from_yaml,
delete_ap_usersig,
create_ap_logconf_from_yaml,
create_ap_policy_from_yaml,
delete_ap_policy,
delete_ap_logconf,
create_ap_waf_policy_from_yaml,
)
from suite.resources_... | nginxinc/kubernetes-ingress | tests/suite/test_batch_startup_times.py | Python | apache-2.0 | 21,598 |
#!.venv/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
api.downgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, v - 1)
v = api.db_version(SQLALCHEMY_DATABASE_U... | benjaminbrinkman/open-ad-platform | db_downgrade.py | Python | mit | 394 |
import hashlib
from wtforms import TextField
from core.manager import ExecutionContext
from core.plugins.lib.fields import IntegerField, Field
from core.plugins.lib.views.forms import SettingsFormView
from core.tests.base import RealizeTest
from core.tests.factories import UserFactory
from core.plugins.lib.models impor... | realizeapp/realize-core | core/plugins/tests.py | Python | agpl-3.0 | 2,951 |
symbols = {}
def intern(name):
try:
return symbols[name]
except KeyError:
symbol = Symbol(name)
symbols[name] = symbol
return symbol
class Symbol(object):
def __init__(self, name):
self.name = name
def __repr__(self):
return self.name
| bendiken/sxp-python | lib/sxp/symbol.py | Python | mit | 269 |
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
import numpy as np
def predictClothesGeneral(temp):
dataFile = open("data.txt")
data = dataFile.read()
data = data.split("\n")
X = []
Y = []
Y2 = []
for i in ra... | epaglier/Project-JARVIS | jarvis-features/Weather AI/weatherai.py | Python | gpl-3.0 | 2,382 |
# Copyright (c) 2010-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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | openstack/swift | swift/container/backend.py | Python | apache-2.0 | 98,964 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import json, traceback
from PyQt4.Qt import QDialogButtonBox
from calibre.gui2 import error_dialog, warning_dialog
from c... | insomnia-lab/calibre | src/calibre/gui2/preferences/template_functions.py | Python | gpl-3.0 | 10,331 |
# remote.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
# Module implementing a remote object allowing easy access to git remotes
from exc import GitCommand... | cool-RR/GitPython | git/remote.py | Python | bsd-3-clause | 27,932 |
#!/usr/bin/python
# Copyright (C) 2014 Belledonne Communications SARL
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.... | Gui13/linphone | tools/python/apixml2python.py | Python | gpl-2.0 | 5,553 |
#!/usr/bin/python
#
# Simple script which convert the FITS headers associated to Brian McLean DSS images into simplified JSON files
# Fabien Chereau fchereau@eso.org
#
import math
import os
import sys
import Image
from astLib import astWCS
import skyTile
levels = ["x64", "x32", "x16", "x8", "x4", "x2", "x1"]
# Defi... | Stellarium/stellarium | util/dssheaderToJSON.py | Python | gpl-2.0 | 8,050 |
from pysqlite2 import dbapi2 as sqlite
con = sqlite.connect("mydb")
cur = con.cursor()
newPeople = (
('Lebed' , 53),
('Zhirinovsky' , 57),
)
for person in newPeople:
cur.execute("insert into people (name_last, age) values (?, ?)", person)
# The changes will not be saved unless the transaction i... | gburd/dbsql | src/py/doc/code/insert_more_people.py | Python | gpl-3.0 | 357 |
# stdlib
from collections import namedtuple
import socket
import subprocess
import time
import urlparse
# 3p
import requests
# project
from checks import AgentCheck
from config import _is_affirmative
from util import headers, Platform
class NodeNotFound(Exception): pass
ESInstanceConfig = namedtuple(
'ESInsta... | JohnLZeller/dd-agent | checks.d/elastic.py | Python | bsd-3-clause | 23,162 |
dict = {'naam': "Anne Goossens", 'age': 22}
'GB-Datum': "07-05-1993",
'GB-Plaats': "'s-Hertogenbosch",
'adres': "Groenstraat 51",
'broer/zussen': 1 zus,
'neven/nichten': 28,
'ooms/tantes': 16,
| ArtezGDA/text-IO | Anne/dict.py | Python | mit | 229 |
"""
Test suite for the config.views module
"""
import pytest
from html import escape
from django.contrib.auth.models import AnonymousUser, User
from django.contrib.messages.storage.fallback import FallbackStorage
from django.core.cache import cache
from django.core.exceptions import PermissionDenied
from django.urls im... | hoelsner/product-database | app/config/tests/test_config_views.py | Python | mit | 21,046 |
#!/usr/bin/env python
"""
Parser for Gene Ontology annotations files
Usage example::
import Bio.GO.Parsers.oboparser as obo
import Bio.GO.Parsers.annotations as annotations
parser = obo.Parser(open("gene_ontology.1_2.obo"))
ontology = parser.parse()
parser = annotations.Parser(open("gene_associ... | marco-mariotti/selenoprofiles | libraries/annotations/GO/Parsers/annotparser.py | Python | gpl-2.0 | 4,007 |
# -*- coding: utf-8 -*-
from pyfr.integrators.std.base import BaseStdIntegrator
class BaseStdStepper(BaseStdIntegrator):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Add kernel cache
self._axnpby_kerns = {}
def collect_stats(self, stats):
super().... | Aerojspark/PyFR | pyfr/integrators/std/steppers.py | Python | bsd-3-clause | 6,858 |
from django.apps import AppConfig
class SssoonConfig(AppConfig):
name = 'sssoon'
| KINGH242/django-sssoon | sssoon/apps.py | Python | bsd-3-clause | 87 |
from __future__ import unicode_literals
import json
import mimetypes
import os
import re
import sys
from copy import copy
from importlib import import_module
from io import BytesIO
from django.conf import settings
from django.core.handlers.base import BaseHandler
from django.core.handlers.wsgi import ISO_8859_1, UTF_... | darkryder/django | django/test/client.py | Python | bsd-3-clause | 27,492 |
# -*- coding: utf-8 -*-
import os
import collections
import _pickle as pickle
import numpy as np
import pandas as pd
class Dataset(object):
def __init__(self, is_training, utils_dir, data_path, batch_size,
seq_length, vocab, labels):
self.data_path = data_path
self.batch_size = ... | koala-ai/tensorflow_nlp | nlp/text_classification/rnn_muticlass/dataset/dataset.py | Python | apache-2.0 | 4,263 |
#! /usr/bin/env python
# coding:utf-8
from numpy import *
from matplotlib.pyplot import *
from scipy.optimize import fmin_bfgs
class ML():
def __init__(self,x=[],y=[]):
self.X=x
self.Y=y
self.Theta=[]
self.Alpha=0.01
self.Iterations=1500
def load(self,fname,d=','):
data=loadtxt(fname,delimiter=d)
sel... | Urinx/Machine_Learning | Logistic-Regression/LogisticRegression.py | Python | gpl-2.0 | 2,429 |
"""
Computes the data to display on the Instructor Dashboard
"""
from collections import defaultdict
from util.json_request import JsonResponse
import json
from courseware import models
from django.conf import settings
from django.db.models import Count
from django.utils.translation import ugettext as _
from xmodule.... | caesar2164/edx-platform | lms/djangoapps/class_dashboard/dashboard_data.py | Python | agpl-3.0 | 31,160 |
import random
def absyourdifference(firstNo, secondNo):
return abs(firstNo - secondNo)
def main():
minimum = raw_input("Type in the minimum number:")
maximum = raw_input("Type in the maximum number:")
output = """I'm thinking of a number between {} and {} """.format(minimum, maximum)
print output
number = ... | bruno1951/bruno1951-cmis-cs2 | oneguess.py | Python | cc0-1.0 | 1,082 |
#!/usr/bin/env python
from __future__ import print_function
from distutils.core import setup, Command
class TestCommand(Command):
description = "PYorick test/check command"
user_options = []
def get_command_name(self):
return "test"
def initialize_options(self):
pass
def finalize_options(self):
... | dhmunro/pyorick | setup.py | Python | bsd-2-clause | 2,231 |
"""
sentry.constants
~~~~~~~~~~~~~~~~
These settings act as the default (base) settings for the Sentry-provided
web-server
: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
import logging... | JTCunning/sentry | src/sentry/constants.py | Python | bsd-3-clause | 6,219 |
#What would we do if one special case, which is A-5 straight comes up
#The one that we should modify is card_ranks function
def card_ranks(hand):
"""Return a list of the ranks, sorted with higher first."""
ranks = ['--23456789TJKA'.index(r) for r,s in hand]
ranks.sort(reverse=True)
return [5,4... | napjon/moocs_solution | design-udacity/card_ranks_modified.py | Python | mit | 365 |
"""
Django settings for djmlang project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
import os
import sys
PROJECT_DIR = os.path.dirname(os.path.dirname(__file_... | waustin/django-multilanguage-testing | djmlang/settings/base.py | Python | apache-2.0 | 7,778 |
# 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... | tensorflow/tensorflow | tensorflow/python/estimator/canned/linear_testing_utils.py | Python | apache-2.0 | 1,244 |
# Copyright 2015 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, s... | bbirand/python-driver | cassandra/cqlengine/query.py | Python | apache-2.0 | 44,467 |
# 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... | majetideepak/arrow | dev/archery/archery/utils/command.py | Python | apache-2.0 | 2,217 |
# 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)
import argparse
import json
import os
import pytest
import spack.cmd as cmd
import spack.cmd.find
import spack.environme... | LLNL/spack | lib/spack/spack/test/cmd/find.py | Python | lgpl-2.1 | 8,978 |
# 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... | tensorflow/io | tensorflow_io/python/ops/avro_dataset_ops.py | Python | apache-2.0 | 3,905 |
import tempfile
import unittest
import PIL.Image
import pillowfight
class TestGaussian(unittest.TestCase):
def test_gaussian(self):
with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile:
in_img = PIL.Image.open("tests/data/crappy_background.jpg")
out_img = pillowfight.gaussi... | jflesch/libpillowfight | tests/tests_gaussian.py | Python | gpl-2.0 | 796 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.db import migrations, models
def migrate_data_forwards(apps, schema_editor):
EmailMarketingConfiguration = apps.get_model('email_marketing', 'EmailMarketingConfiguration')
EmailMarketingConfiguration.objects.all().up... | ESOedX/edx-platform | lms/djangoapps/email_marketing/migrations/0008_auto_20170809_0539.py | Python | agpl-3.0 | 788 |
import json
import logging
from typing import Optional, Tuple
from urllib.error import HTTPError
from urllib.request import urlopen
from yomeka.classic.no_such_omeka_classic_collection_exception import NoSuchOmekaClassicCollectionException
from yomeka.classic.no_such_omeka_classic_item_exception import NoSuchOmekaClas... | minorg/yomeka | yomeka/classic/omeka_classic_rest_api_client.py | Python | bsd-2-clause | 4,875 |
# -*- encoding: utf-8 -*-
import datetime, csv
from base import ReportGenerator
from geraldo.utils import get_attr_value, calculate_size
from geraldo.widgets import Widget, Label, SystemField, ObjectValue
from geraldo.graphics import Graphic, RoundRect, Rect, Line, Circle, Arc,\
Ellipse, Image
from geraldo.exc... | titasakgm/brc-stock | openerp/addons/report_geraldo/lib/geraldo/geraldo/generators/csvgen.py | Python | agpl-3.0 | 4,331 |
# Copyright (C) 2008-2010 Adam Olsen
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that... | virtuald/exaile | xlgui/preferences/cover.py | Python | gpl-2.0 | 3,320 |
import requests
import six.moves.urllib.parse as urlparse
import json
import os
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class Client(object):
"""
Gym client to interface with gym_http_server
"""
def __init__(self, remote_base):
self.remote_base = remot... | Lucsanszky/gym-http-api | gym_http_client.py | Python | mit | 5,544 |
#!/usr/bin/env python
# Install the Python helper library from twilio.com/docs/python/install
import os
from twilio.rest import Client
# To set up environmental variables, see http://twil.io/secure
ACCOUNT_SID = os.environ['TWILIO_ACCOUNT_SID']
AUTH_TOKEN = os.environ['TWILIO_AUTH_TOKEN']
client = Client(ACCOUNT_SID... | TwilioDevEd/api-snippets | notifications/register/send-notification-2/send-notification-2.7.x.py | Python | mit | 550 |
from rest_framework import serializers
from models.place import Category, Place, Like
from models.country import Country
from appls.login.models import BaseUser
from appls.login.serializers import UserSerializer
from appls.points.models.place import Place, Category
class CategorySerializer(serializers.Serializer):... | pasha369/Points | points/appls/points/serializers.py | Python | mit | 2,008 |
from future import standard_library
standard_library.install_aliases()
from builtins import str
from configparser import ConfigParser
import errno
import logging
import os
import sys
import textwrap
try:
from cryptography.fernet import Fernet
except:
pass
def generate_fernet_key():
try:
FERNET_K... | briceburg/airflow | airflow/configuration.py | Python | apache-2.0 | 10,960 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.