code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import copy
import operator
import sys
import warnings
from functools import wraps
from django.utils import six
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.six.moves import copyreg
# You can't trivially replace this with `functools.partial` because this binds
# to clas... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/utils/functional.py | Python | mit | 16,501 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utils.init_weights import init_weights, normalized_columns_initializer
from core.mo... | lukashermann/pytorch-rl | core/models/a3c_mlp_con.py | Python | mit | 4,501 |
#__author__ = 'FuWei'
from __future__ import print_function, division
import sys
import pdb
from os import listdir
from os.path import isfile, join
# from table import *
class o(object):
def __init__(i, **filed):
i.__dict__.update(filed)
return i
class Row(object):
def __init__(i,data):
i.x = data[:-1]
... | ST-Data-Mining/crater | wei/data.py | Python | mit | 2,913 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Aircraft.slug'
db.add_column(u'core_aircraft', 'slug',
... | WillsB3/Sim-Checklist | simchecklist/core/migrations/0008_auto__add_field_aircraft_slug__chg_field_checklistphase_slug.py | Python | mit | 2,870 |
#!/usr/bin/env python
from app import app, db
from flask.ext.script import Manager, Server
from flask.ext.migrate import MigrateCommand
manager = Manager(app)
manager.add_command('runserver', Server())
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run()
| bmbove/flask-api-boilerplate | manage.py | Python | mit | 291 |
# This file is part of curious.
#
# curious 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 later version.
#
# curious is distributed in the ho... | SunDwarf/curious | curious/exc.py | Python | mit | 4,130 |
from .version import __version__
import os
# Load configuration
import ConfigParser
config = ConfigParser.ConfigParser()
config.readfp(open(os.path.join(os.path.dirname(__file__), "conf/via.conf")))
# Logging
import logging.config
logging.config.fileConfig(os.path.join(os.path.dirname(__file__),'conf/logging.conf'))
| pndurette/viatools | viatools/__init__.py | Python | mit | 320 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "csrf_example.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that... | consideratecode/csrf_example | manage.py | Python | mit | 810 |
"""
@author Stephen Jackson <scj7t4@mst.edu>
Removes recordings from a too early period.
"""
import subprocess
import sys
import os
from datetime import datetime, timedelta
from settings import Settings
settings = Settings()
def do_directory(p):
"""
Recurses into directories looking for files.
p i... | KMNR/Webstream | webstreamd/webstreamd/clean.py | Python | mit | 1,688 |
"""Created on Sat Oct 01 2015 16:14.
@author: Nathan Budd
"""
import numpy as np
def mee2coe(MEE, mu=1.):
"""
Convert modified equinoctial elements to classical orbital elements.
Parameters
----------
MEE : ndarray
mx6 array of elements ordered as [p f g h k L].
mu : float
St... | lasr/orbital_mechanics | orbit/mee2coe.py | Python | mit | 1,025 |
"""
Tests for `pyleset` module.
"""
import pytest
from pyleset import pyleset
class TestPyleset(object):
@classmethod
def setup_class(cls):
pass
def test_something(self):
pass
@classmethod
def teardown_class(cls):
pass | westurner/pyleset | test/test_pyleset.py | Python | mit | 267 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE
import gettext
from gettext import gettext as _
gettext.textdomain('brazo')
import logging
logger = logging.getLogger('brazo')
from brazo_lib.AboutDialog import AboutDialog... | nickpascucci/Robot-Arm | software/desktop/brazo/brazo/AboutBrazoDialog.py | Python | mit | 725 |
from collections import Iterable
from copy import deepcopy
from numbers import Real, Integral
import warnings
from xml.etree import ElementTree as ET
import sys
if sys.version_info[0] >= 3:
basestring = str
import openmc
from openmc.checkvalue import check_type, check_value, check_greater_than
from openmc.clean_xm... | lilulu/openmc | openmc/material.py | Python | mit | 18,937 |
#this model represents a request in our system
from google.appengine.ext import ndb
from datetime import datetime
from datetime import timedelta
class Request(ndb.Model):
city = ndb.StringProperty()
phone = ndb.StringProperty()
date = ndb.DateTimeProperty()
description = ndb.StringProperty()
isCarNeeded... | chenbachar/HelpApp | src/versions/Iter2/helpapp-seproject/models/request.py | Python | mit | 739 |
from socket import create_connection
from django.db import models
from django.utils import timezone
class Slave(models.Model):
def __str__(self):
return self.ip + str(self.port)
ip = models.GenericIPAddressField()
port = models.IntegerField()
busy = models.BooleanField(default=False)
def... | theSage21/judge-interface | webserver/contest/models.py | Python | mit | 1,082 |
from SimpleWebSocketServer import WebSocket, SimpleWebSocketServer
class SimpleEcho(WebSocket):
def handleMessage(self):
# echo message back to client
print(self.data)
self.sendMessage(self.data)
def handleConnected(self):
print self.address, 'connected'
def handleClose(self):
... | DooMMasteR/hitview | testserver.py | Python | mit | 432 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014-2016 Alex Forencich
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... | Diti24/python-ivi | ivi/agilent/agilentE4425B.py | Python | mit | 1,494 |
def forenkling(a,b):
while b!=0:
gammel_b=b
b=a%b
a=gammel_b
#print(a,b)
return a
print(forenkling(30,20))
print(forenkling(10,2))
def gcd(a,b):
a=forenkling(a,b)
return a
def reduce_fraction(a,b):
divisor=forenkling(a,b)
a=int(a/diviso... | TorleifHensvold/ITGK3 | Oving5/torleif/07_Forenkling_av_brøker.py | Python | mit | 706 |
import copy
import operator
empty = object()
def unpickle_lazyobject(wrapped):
"""
Used to unpickle lazy objects. Just return its argument, which will be the
wrapped object.
"""
return wrapped
def new_method_proxy(func):
def inner(self, *args):
if self._wrapped is empty:
... | avara1986/gozokia | gozokia/utils/functional.py | Python | mit | 4,105 |
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'... | mtzstngl/RSA_Encryption | .ycm_extra_conf.py | Python | mit | 4,012 |
import os
import re
import nltk
from nltk.tag import tnt
from modules import cleaner
class Location:
def __init__(self):
train_data = []
with open(os.path.join(os.path.dirname(__file__), 'tagged_locations.txt'), 'r') as f:
for line in f:
train_data.append([nltk.tag.st... | dwiajik/twit-macet-mining-v2 | modules/location.py | Python | mit | 1,393 |
# -*- coding: utf-8 -*-
#
# iago documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 28 18:57:03 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | ferchault/iago | docs/conf.py | Python | mit | 8,700 |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'', include('dju_privateurl.urls')),
]
| liminspace/dju-privateurl | tests/urls.py | Python | mit | 188 |
from django.db.models import Min
from django.http import Http404
from django.utils.encoding import force_str
from django.utils.translation import gettext as _
from django.views.generic import DetailView, YearArchiveView
from django.views.generic.detail import SingleObjectMixin
from spectator.core import app_settings
f... | philgyford/django-spectator | spectator/events/views.py | Python | mit | 8,037 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Testcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework import TestcoinTestFramework
from util import *
class ZapWalletTXesTest (TestcoinTestFr... | L5hunter/TestCoin | qa/rpc-tests/zapwallettxes.py | Python | mit | 3,033 |
#!/usr/bin/python
# ck_setup.py - checks the veyepar setup - reports what features are ready.
from process import process
from main.models import Show, Location, Client
from django.conf import settings
import pw
import rax_uploader
import archive_uploader
import steve.richardapi
import os
import xml.etree.Elemen... | EricSchles/veyepar | dj/scripts/ck_setup.py | Python | mit | 10,966 |
import sys
if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
]
# Add any paths that contain templates... | hpk42/pluggy | docs/conf.py | Python | mit | 2,375 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Case',
fields=[
('id', models.AutoField(primary... | Omrigan/diseases | diseases/migrations/0001_initial.py | Python | mit | 1,149 |
import itertools
from unittest import TestCase
from turgles.buffer import ChunkBuffer, ShapeBuffer, BufferManager
from turgles.memory import TURTLE_MODEL_DATA_SIZE, TURTLE_COLOR_DATA_SIZE
MODEL_ZEROS = [0] * TURTLE_MODEL_DATA_SIZE
MODEL_ONES = [1] * TURTLE_MODEL_DATA_SIZE
MODEL_TWOS = [2] * TURTLE_MODEL_DATA_SIZE
MOD... | AllTheWayDown/turgles | turgles/tests/test_buffers.py | Python | mit | 11,668 |
from .addressing_mode import AddressingMode
class ImmediateAddressingMode(AddressingMode):
@property
def instruction_size(self):
return 2
def calculate_address(self, processor, parameter):
raise RuntimeError('This should never be called')
def read_source(self, processor, parameter):
... | Hexadorsimal/pynes | nes/processors/cpu/instructions/addressing_modes/immediate.py | Python | mit | 461 |
from pprint import pprint
from base.models import Colaborador
def get_create_colaborador_by_user(user):
try:
colab = Colaborador.objects.get(user__username=user.username)
except Colaborador.DoesNotExist:
colab = Colaborador(
user=user,
matricula=72000+user.id,
... | anselmobd/fo2 | src/base/queries/models.py | Python | mit | 391 |
from __future__ import unicode_literals
from django.apps import AppConfig
class WawmembersConfig(AppConfig):
name = 'wawmembers'
| heidi666/WorldsAtWar | wawmembers/apps.py | Python | mit | 136 |
# -*- coding: utf-8 -*-
from .permissions import SignedPermission # noqa
from .signing import sign_filter_permissions # noqa
from .views import SignedViewSetMixin # noqa
| chewse/djangorestframework-signed-permissions | signedpermissions/__init__.py | Python | mit | 174 |
# -*- coding: utf-8 -*-
"""Queue data structure."""
from __future__ import unicode_literals
# Use the doubly-linked list as the parent just as we used the singly-linked list as the parent for the stack.
from double import DList
class Queue(object):
"""Create a Queue class."""
def __init__(self, value_list=N... | jefferyrayrussell/data-structures | src/queue.py | Python | mit | 1,028 |
# Copyright 2016 Google 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, ... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/google/cloud/vision/feature.py | Python | mit | 2,864 |
from dic.experiment import Experiment
from dic.plots import generate_plots
'''This script generates data for a given experiment condition and plots it in
a single figure. Plotting options are:
polar: Plots in polar coordinates if true, otherwise Cartesian.
areaplot: Plots the "error area" (\gamma*\sigma_gamma*\sigma... | scott-trinkle/DIC | main.py | Python | mit | 1,049 |
#! /usr/bin/env python
import argparse
def getArgs():
parser = argparse.ArgumentParser(
description = """Factorial calculator
"""
)
parser.add_argument(
"-n",
type = int,
required = True,
help = "Enter n to set N!"
)
return parser.parse_args()
def factorial(n):
if n == 0:
return 1
else:
retur... | jeffreywolf/pyday-2015 | factorial.py | Python | mit | 447 |
import discord
from discord.ext import commands
from PIL import Image, ImageDraw, ImageFont
import pathvalidate
import requests
import os
class Welcome:
def __init__(self, bot):
self.bot = bot
async def on_member_join(self, member):
template = Image.open('extras/template.png')
draw = ImageDraw.Draw(... | heyitswither/Alpha-Bot | cogs/test-welcome.py | Python | mit | 2,775 |
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab 2
# Copyright 2016, 2017 juga (juga at riseup dot net), MIT license.
"""Tests for the FSM of the DHCP client implementation of the Anonymity Profile
([:rfc:`7844`]).
.. todo::
Test for more cases:
- delays getting OFFERs
- delays getting ACK
- RENEWING sta... | DHCPAP/dhcpcanon | tests/test_dhcpcapfsm.py | Python | mit | 6,249 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
编程练习:使用二分查找算法求一个任意非负数的平方根(近似值即可)
"""
while True:
x = input("请输入一个非负数:")
try:
x = int(x)
if x < 0:
print(x, " 不是一个非负数")
else:
break
except ValueError:
print(x, " 不符合要求")
epsilon = 0.0001
num_guesses = ... | felix9064/python | Demo/demo/demo003.py | Python | mit | 721 |
import pyblish.api
class ExtractMindbenderModel(pyblish.api.InstancePlugin):
"""Produce a stripped down Maya file from instance
This plug-in takes into account only nodes relevant to models
and discards anything else, especially deformers along with
their intermediate nodes.
"""
label = "Mo... | mindbender-studio/config | polly/plugins/maya/publish/extract_model.py | Python | mit | 2,116 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from flask import session
from indico.core import signals
from i... | mic4ael/indico | indico/modules/events/persons/operations.py | Python | mit | 843 |
#! /usr/bin/env python3
description = """
Number letter counts
Problem 17
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters woul... | mbuhot/mbuhot-euler-solutions | python/problem-017.py | Python | mit | 1,881 |
import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="colorsrc", parent_name="image.hoverlabel.font", **kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_... | plotly/plotly.py | packages/python/plotly/plotly/validators/image/hoverlabel/font/_colorsrc.py | Python | mit | 424 |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... | sharadagarwal/autorest | AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/paging_tests.py | Python | mit | 6,270 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_information.py | Python | mit | 2,726 |
"""
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process: Starting with any
positive integer, replace the number by the sum of the squares of its digits,
and repeat the process until the number equals 1 (where it will stay), or it
loops endlessly in a cycl... | ufjfeng/leetcode-jf-soln | python/202_happy_number.py | Python | mit | 1,204 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import os
import time
import signal
import inspect
import weakref
import logging
import threading
import curses
import curses.ascii
from contextlib import contextmanager
import six
import praw
import requests
from . import exceptions
_logger... | shaggytwodope/rtv | rtv/objects.py | Python | mit | 24,783 |
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'datelikeus.users'
verbose_name = "Users"
def ready(self):
"""Override this to put in:
Users system checks
Users signal registration
"""
pass
| jeffminsungkim/datelikeus | src/datelikeus/users/apps.py | Python | mit | 276 |
# -*- coding: utf-8 -*-
"""INI temporal mean rate simulator with Tensorflow backend.
This module defines the layer objects used to create a spiking neural network
for our built-in INI simulator
:py:mod:`~snntoolbox.simulation.target_simulators.INI_temporal_mean_rate_target_sim`.
The coding scheme underlying this conv... | NeuromorphicProcessorProject/snn_toolbox | snntoolbox/simulation/backends/inisim/temporal_mean_rate_tensorflow.py | Python | mit | 28,900 |
#!/usr/bin/env python
"""A demo client for Open Pixel Control
http://github.com/zestyping/openpixelcontrol
Sends red, green, and blue to the first 3 LEDs.
To run:
First start the gl simulator using, for example, the included "wall" layout
make
bin/gl_server layouts/wall.json
Then run this script in another... | beneckart/future-robotics | Marquee/python/gif.py | Python | mit | 1,207 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by iFantastic on 15/09/05
import sqlite3
#TODO: Add more class method for Database Class.
class Database():
def __init__(self, db_name):
self.db = sqlite3.connect(db_name.decode('utf-8'))
# self.db = sqlite3.connect(':memory:')
self.... | VirgiliaBeatrice/VocabularyGenerator | src/sqlbase.py | Python | mit | 4,534 |
from setuptools import setup
setup(
name = 'pgdumper',
description = 'Simple PostgreSQL dumper',
author = 'Roman Dolgushin',
author_email = 'rd@roman-dolgushin.ru',
url = 'https://github.com/rdolgushin/pgdumper',
license = 'MIT',
version = '0.1',
packages = ['pgdumper'],
install_requires = ['mydumper... | rdolgushin/pgdumper | setup.py | Python | mit | 642 |
'''
Created on Jun 18, 2015
@author: Subhasis
'''
# Replace the following lines with client IDs obtained from the APIs
# Console or Cloud Console.
WEB_CLIENT_ID = '540614338141-drb3g1kcetlp4sbgaj7dfkjci6n5ove5.apps.googleusercontent.com'
ANDROID_CLIENT_ID = 'replace with Android client ID'
IOS_CLIENT_ID = 'replace wit... | SubhasisDutta/NoteBook | settings.py | Python | mit | 370 |
STYLES = {
"side_color": "#4C9BB0",
"header_color": "#306B7B",
"header_bg_color": "#E4EEF1",
"text_color": "#272B33"
}
def get_documentation(bean_name, file_path, function_name, function_metadata):
model_doc = dict(STYLES)
model_doc["links"] = [{"href": "go_to_definition", "text": "Go to Definition"}]
model_do... | jcberquist/SublimeText-Lucee | src/modelcompletions/documentation.py | Python | mit | 1,258 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test de los LEDs de la tarjeta F2."""
import time
from scribbler2.S2Fluke2 import S2Fluke2
def main():
"""Realiza las pruebas de los LEDs de la tarjeta F2."""
robot = S2Fluke2( "/dev/rfcomm2" )
print( "setBrightLed: 255 " )
robot.setBrightLed( 255 )... | titos-carrasco/Scribbler2-Python | demos/F2LEDs.py | Python | mit | 549 |
from ..library.base import number_to_list
def solve(bound: int=100):
maximal = 0
for a in range(bound):
for b in range(bound):
sum_digits = sum(number_to_list(a ** b))
if sum_digits > maximal:
maximal = sum_digits
return maximal
| cryvate/project-euler | project_euler/solutions/problem_56.py | Python | mit | 294 |
# pymkcmd | dale@pbdr.info | http://pbdr.info
# The main logic of pymkcmd.
import sys
import inspect
import argparse
import logging
from functools import wraps
def mkcmd(func, doc_format='plain', ant_format='auto', parse_bool=True):
'''
Generate a CLI (command line interface) for a function.
:param fun... | pbdr/pymkcmd | pymkcmd/core.py | Python | mit | 8,606 |
"""
`Django Blog Zinnia`_ allows for the management of a blog in your project. It is well integrated into the `cms`_ component but can also be used independently.
""" | emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/django_buildout/project/mods_available/zinnia/__init__.py | Python | mit | 166 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
The Art of an Artificial Intelligence
http://art-of-ai.com
https://github.com/artofai
"""
__author__ = 'xevaquor'
__license__ = 'MIT'
import numpy as np
import util
class LayerBase(object):
def __init__(self):
self.size = None
self.W = np.zeros((0,0))... | artofai/neural-network | layer.py | Python | mit | 4,245 |
"""Web dashboard."""
import os
import sys
import json
import aiohttp
from discord.ext import commands
import util.dynaimport as di
from .cog import Cog
japronto = di.load('japronto')
sanic = di.load('sanic')
response = di.load('sanic.response')
root_dir = os.path.dirname(os.path.abspath(sys.modules['__main__'].core_fi... | Armored-Dragon/goldmine | default_cogs/web.py | Python | mit | 1,742 |
#!/usr/bin/env python2.6
"""
Tue Dec 4 11:54:18 PST 2012
Parse Blast XML output file and cluster sequences using greedy approach.
Input: Blast xml file
Output: Text file, each line = 1 cluster, each element of a cluster is space-separated
Algorithm summary:
Sorted sequences by descending in size
Start with the large... | ngannguyen/immunoseq | src/clusterBlastXml.py | Python | mit | 16,441 |
"""
luas.api
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides methods for interrogating Dublin's Luas tram API
Copyright (c) 2018 Ronan Murray <https://github.com/ronanmu>
Licensed under the MIT License
"""
import logging
from xml.etree import ElementTree
from xml.etree.ElementTree import ParseError
import requests
from luas.mo... | ronanmu/luas.py | luas/api.py | Python | mit | 6,539 |
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
#
"""JavaScript 1.7 keywords"""
keywords = set([
"break",
"case", "catch", "const", "continue",
"debugger", "default", "delete", "do",
"else",
"false", "finally", "for", "function",
"if", "in", "instanceof",
"let",
"new",... | zynga/jasy | jasy/js/tokenize/Lang.py | Python | mit | 458 |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
from datetime import date, datetime, timedelta
from icalendar import Calendar, Event, vRecur
import json
import os.path
from os.path import dirname
from uuid import uuid4
class iCalSchedule(object):
DAYS = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']
def __init_... | bfontaine/edt2ics | edt2ics/ical.py | Python | mit | 3,060 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='api_index'),
url(r'^time$', views.get_server_time, name='api_time'),
url(r'^rooms/available', views.find_available, name='api_available'),
] | Gazing/Frawt | django/frawt/api/urls.py | Python | mit | 253 |
# Goal 1
bread = 4
pb = 3
jelly = 10
sandwich = 0
while bread >= 2 and pb >= 1 and jelly >= 1:
sandwich = sandwich + 1
print "I am making sandwich number {0}".format(sandwich)
bread = bread - 2
pb = pb - 1
jelly = jelly - 1
print "All done! I made {0} sandwich(es)".format(sandwich)
#... | suellenf/hearmecode | playtime/lesson2_pbj.py | Python | mit | 958 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import frappe
import time
from frappe import _, msgprint, is_whitelisted
from frappe.utils import flt, cstr, now, get_datetime_str, file_lock, date_diff
from frappe.model.base_document import BaseDocument, get_controller... | mhbu50/frappe | frappe/model/document.py | Python | mit | 43,429 |
#! /usr/bin/python
"""Linked list Representation and implementation.
"""
# -*- coding: utf-8 -*-
## ------ Imports ------ ##
## ------ Imports ------ ##
__author__ = "Siva Cn (cnsiva.in@gmail.com)"
__website__ = "http://www.cnsiva.com"
class Node:
"""Referential Structure used to create new nodes"""
def ... | SivaCn/Bigdata.model | src/utils/chains.py | Python | mit | 2,013 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from decimal import Decimal
import autoslug.fields
class Migration(migrations.Migration):
dependencies = [
('crm', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Clarity-89/clarityv2 | src/clarityv2/crm/migrations/0002_auto_20150924_1716.py | Python | mit | 1,692 |
from p3 import P3
from pyvows import Vows, expect
import lxml
from lxml.etree import ElementBase
from lxml.html import builder as E
from lxml.html import fromstring, tostring
from lxml.cssselect import CSSSelector
@Vows.batch
class SelectionSelectAll(Vows.Context):
class SelectBody(Vows.Context):
"""se... | sammyt/p3 | tests/p3_select_all_vows.py | Python | mit | 3,512 |
# Copyright (c) 2018-2021, Manfred Moitzi
# License: MIT License
from typing import (
TYPE_CHECKING,
Tuple,
Iterable,
List,
cast,
Optional,
)
import math
from ezdxf.math import Vec3, Vec2, ConstructionRay, UCS
from ezdxf.render.arrows import ARROWS, connection_point
from ezdxf.entities.dimstyleo... | mozman/ezdxf | src/ezdxf/render/dim_linear.py | Python | mit | 24,110 |
"""
@brief test tree node (time=50s)
"""
import sys
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from pyquickhelper.pycode.venv_helper import create_virtual_env
class TestVenvHelper(ExtTestCase):
def test_venv_empty(self):... | sdpython/pyquickhelper | _unittests/ut_pycode/test_venv_helper.py | Python | mit | 902 |
import graphAttack as ga
import numpy as np
import pickle
"""Control script"""
def run(simulationIndex, X, Y=None):
"""Run the model"""
print("Training with:", simulationIndex)
seriesLength, nFeatures = X.shape
# ------ it is important that the exampleLength is the same as
# ------ the number if ... | jgolebiowski/graphAttack | controlTrainRNN.py | Python | mit | 5,411 |
class Solution(object):
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
rowIndex += 1
if rowIndex == 0:
return []
last_row = [1]
for i in range(1, rowIndex):
row = [1]
for j in range(1, i)... | daicang/Leetcode-solutions | 119-pascals-triangle-ii.py | Python | mit | 508 |
#! /usr/bin/env python3
"""Test remove_nans_1D."""
# --- import -------------------------------------------------------------------------------------
import numpy as np
import WrightTools as wt
# --- test ---------------------------------------------------------------------------------------
def test_simple():... | wright-group/WrightTools | tests/kit/remove_nans_1D.py | Python | mit | 875 |
import os
BasketballPlayerDatabase = 'BasketballPlayerDatabase.p'
Root_URL = 'https://' + os.getenv('basketball_root_url')
| VincentMelia/PythonBasketball | Configuration.py | Python | mit | 125 |
import os
from lxml import etree
class device:
def __init__(self,ipadress,name):
self.ipadress=str(ipadress)
self.name=str(name)
self.status="off"
def turn_on(self):
self.status="on"
def turn_off(self):
self.status="off"
def getstatus(devices):
ips=[]
for ins... | RoboWoodhouse/RoboButler | python/scanlibrary.py | Python | mit | 2,231 |
# -*- coding: utf-8 -*-
import os
from locust.main import load_locustfile
def create_settings(
from_environment=False,
locustfile=None,
classes=None,
host=None,
num_users=None,
spawn_rate=None,
reset_stats=False,
run_time="3m",
loglevel="INFO",
):
"""
Returns a settings o... | FutureSharks/invokust | invokust/settings.py | Python | mit | 3,137 |
"""
Pynt is a Python client that wraps the Open Beer Database API.
Questions, comments? m@h0ke.com
"""
__author__ = "Matthew Hokanson <m@h0ke.com>"
__version__ = "0.2.0"
from beer import Beer
from brewery import Brewery
from request import Request
from settings import Settings
| h0ke/pynt | pynt/pynt.py | Python | mit | 290 |
# /models/base.py
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
| TumblrCommunity/PowerPortfolio | portfolio/models/base.py | Python | mit | 101 |
#!/usr/bin/env python3
# Copyright (c) 2021 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test compact blocks HB selection logic."""
from test_framework.test_framework import FujicoinTestFramework... | fujicoin/fujicoin | test/functional/p2p_compactblocks_hb.py | Python | mit | 3,797 |
#!/usr/bin/python3
try:
import qr_tools as qrTools # Module for this project
except:
import gen_3dwallet.qr_tools as qrTools
try:
import TextGenerator as textGen # Module for this project
except:
import gen_3dwallet.TextGenerator as textGen
import bitcoin # sudo pip3 install bitcoin
import argpar... | btcspry/3d-wallet-generator | gen_3dwallet/base.py | Python | mit | 24,069 |
from django.conf.urls import patterns, include, url
from .views import MapView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url('^$', 'mobiletrans.views.index', { 'template_name':'index.html'},
name="index"),
url('^abou... | JoeJasinski/WindyTransit | mobiletrans/urls.py | Python | mit | 1,139 |
# coding: utf-8
# The goal of this assignment is to train a Word2Vec skip-gram model over [Text8](http://mattmahoney.net/dc/textdata) data.
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
import collections
import math
import numpy as np
import os
import ra... | ds-hwang/deeplearning_udacity | tensorflow_examples/word2vec.py | Python | mit | 14,317 |
from google.appengine.ext import ndb
from models import LogLine
def LogAccess(username, request, course_id=None):
'''
Write a log entry line
'''
ll = LogLine(username=username,
course_id=course_id,
url=request.url,
ipaddr=request.remote_addr)
ll.... | mitodl/xanalytics | logger.py | Python | mit | 498 |
# 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 |
import itertools
from operator import itemgetter
from pdfminer.pdftypes import PDFObjRef
from pdfminer.psparser import PSLiteral
from pdfminer.utils import PDFDocEncoding
DEFAULT_X_TOLERANCE = 3
DEFAULT_Y_TOLERANCE = 3
DEFAULT_X_DENSITY = 7.25
DEFAULT_Y_DENSITY = 13
def cluster_list(xs, tolerance=0):
if toleran... | jsvine/pdfplumber | pdfplumber/utils.py | Python | mit | 20,406 |
import os,sys,django
sys.path.append(os.path.dirname(os.path.abspath('.')))
os.environ["DJANGO_SETTINGS_MODULE"] = 'skill_huddle.settings'
django.setup()
from sh_app.models import SH_User,League,Suggestion,Huddle
from django.contrib.auth.models import User
from django_countries import countries
from localflavor.us.us... | skill-huddle/skill-huddle | dummy_data/populatedb.py | Python | mit | 10,113 |
from mock import call
from raptiformica.settings import conf
from raptiformica.settings.load import load_module_configs
from tests.testcase import TestCase
class TestLoadModuleConfigs(TestCase):
def setUp(self):
self.load_module_config = self.set_up_patch(
'raptiformica.settings.load.load_mod... | vdloo/raptiformica | tests/unit/raptiformica/settings/load/test_load_module_configs.py | Python | mit | 849 |
from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import CreateView
from django.contrib.auth.forms import UserCreationForm
from . import views
urlpatterns = patterns('',
... | lewfish/django-social-news | social_news/urls.py | Python | mit | 1,105 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('storeApi', '0012_product_tags'),
]
operations = [
migrations.CreateModel(
name='ProductImages',
fiel... | Arlefreak/MaloBarba | storeApi/migrations/0013_productimages.py | Python | mit | 1,161 |
from pytest import raises
from mio import runtime
from mio.errors import AttributeError, TypeError
def test_clone(mio):
mio.eval("World = Object clone()")
assert mio.eval("World")
assert mio.eval("World parent") == runtime.find("Object")
def test_type(mio):
assert mio.eval("Object type") == "Objec... | prologic/mio | tests/test_objects.py | Python | mit | 4,906 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
RPA Re-Ranker Model.
"""
from parlai.zoo.light_whoami.whoami_download import download_with_model_type
def download(... | facebookresearch/ParlAI | parlai/zoo/light_whoami/rpa_reranker.py | Python | mit | 394 |
#!/usr/bin/python
"""
NumberGuesser
Guesses your number!
Author: Greg Stewart
Copyright 2014 Greg Stewart
Start: 7/15/14
Tries to guess your number, interacts with you via the Raspberry pi's
16x2 CharLCDPlate
It uses a relatively simple algorithm to guess numbers:
Step 1:
Find a number that is larger tha... | GregJohnStewart/NumberGuesser | numberGuesser.py | Python | mit | 7,208 |
#********************************************
# By Ahmed Elbannan
# September 22nd 2013
# Battleship CPSC231 (Limited Edition! ;] )
#********************************************
# global variables
direction = 'horizontal';
x = ord('A');
y = 0;
# Title Screen! Now a function!
def print_titlescreen():
print();
... | FaceTheDream/CPSC231 | Battleship/Ahmed/Battleship41.py | Python | mit | 3,838 |
#!/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 |
import argparse
import github3
import toml
import json
import re
from . import utils
import logging
from threading import Thread, Lock
import time
import traceback
import sqlite3
import requests
from contextlib import contextmanager
from itertools import chain
from queue import Queue
import os
import subprocess
from .g... | barosl/homu | homu/main.py | Python | mit | 37,593 |
#!/usr/bin/env python
# coding: utf-8
class CheckGear():
def __init__(self):
pass
def proc(self):
print 'test'
| sou-komatsu/checkgear | checkgear/checkgear.py | Python | mit | 138 |
import umsgpack
from configfilemanager import ConfigFileManagerBase
class SessionFileManager(ConfigFileManagerBase):
@classmethod
def convertVersion(cls, obj, version):
return obj
| takumak/tuna | src/sessionfilemanager.py | Python | mit | 192 |