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 sys import numpy as np ####################### #### Feature Class ### Extracts features from a labeled corpus ####################### from eval.ner.readers.brown import prepare_cluster_map from eval.ner.sequences.id_feature import IDFeatures class ExtendedFeatures(IDFeatures): def __init__(self, dataset,...
rug-compling/hmm-reps
eval/ner/sequences/extended_feature.py
Python
mit
21,598
from django.db import models from django.contrib.auth.models import User # Create your models here. class Payment(models.Model): created = models.DateTimeField(auto_now_add=True) amount = models.DecimalField(max_digits=16, decimal_places=2) payer = models.ForeignKey(User, related_name='payments', null=Tr...
linkleonard/braintree-tutorial
myapp/mysite/models.py
Python
mit
373
import keras import numpy as np from keras.datasets import cifar10 from keras.preprocessing.image import ImageDataGenerator from keras.layers.normalization import BatchNormalization from keras.layers import Conv2D, Dense, Input, add, Activation, GlobalAveragePooling2D from keras.initializers import he_normal fro...
WenmuZhou/cifar-10-cnn
4_Residual_Network/ResNet_keras.py
Python
mit
5,307
import activity from provider import cloudfront_provider """ activity_InvalidateCdn.py activity """ class activity_InvalidateCdn(activity.activity): def __init__(self, settings, logger, conn=None, token=None, activity_task=None): activity.activity.__init__(self, settings, logger, conn, token, activity_tas...
gnott/elife-bot
activity/activity_InvalidateCdn.py
Python
mit
2,596
import os import time import datetime import random from django.db import models from django.conf import settings from django.test import TestCase, LiveServerTestCase, RequestFactory from django.test.client import Client from django.core.urlresolvers import reverse from django.contrib.auth.models import User, Group fr...
aronysidoro/django-payasyougo
payg/account/tests/factory.py
Python
mit
3,347
#!/bin/env python """ The MIT License Copyright (c) 2010 The Chicago Tribune & Contributors 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 ...
tylerturk/beeswithmachineguns
beeswithmachineguns/main.py
Python
mit
9,593
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel 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 ...
jgaul/python-oauth2
oauth2/__init__.py
Python
mit
29,092
# This file implements routines for extracting links from response objects. import re import lxml import urlparse import feedparser # We have sought to disperse power, to set men and women free. # That really means: to help them to discover that they are free. # Everybody's free. The slave is free. # The ultimate weapo...
LukeB42/Emissary
emissary/controllers/parser.py
Python
mit
4,656
# coding: utf-8 """ Talon.One API The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #...
talon-one/talon_one.py
talon_one/models/account_additional_cost.py
Python
mit
10,814
# coding=utf-8 import inspect def multiton(cls): """ Class decorator to make a class a multiton. That is, there will be only (at most) one object existing for a given set of initialization parameters. """ instances = {} def getinstance(*args, **kwargs): key = _gen_key(cls, *args, *...
sait-berkeley-infosec/pynessus-api
nessusapi/utils.py
Python
mit
1,726
#!/usr/bin/python2.7 import os import fileinput # the version of the release with open("version.txt") as f: version = f.read() def getVersionTuple(v): return tuple(map(int, (v.split(".")))) version_major = str(getVersionTuple(version)[0]) version_minor = str(getVersionTuple(version)[1]) version_patch = str(getV...
onqtam/doctest
scripts/update_stuff.py
Python
mit
1,583
#! /usr/bin/python # -*- coding: utf-8 -*- # from application import module from application import agent as _agent from libraries import irclib import threading import time import sys import Queue class Module(module.AbstractModule): thread = None channels = None targets = None __password = None def __in...
martinkozak/pyircgate-daemon
modules/ircgate/ircgate.py
Python
mit
7,493
with open("input.txt") as f: data = f.read() bots = 1000 inputs = [[False] for i in range(bots)] outputs = [[] for i in range(bots)] maps = [[] for i in range(bots)] for line in data.splitlines(): if line.startswith("value"): p = line.split() val = int(p[1]) bot = int(p[-1]) in...
lamperi/aoc
2016/10/solve.py
Python
mit
1,547
import sys import warnings def saveit(func): """A decorator that caches the return value of a function""" name = '_' + func.__name__ def _wrapper(self, *args, **kwds): if not hasattr(self, name): setattr(self, name, func(self, *args, **kwds)) return getattr(self, name) re...
zrzka/blackmamba
blackmamba/lib/rope/base/utils/__init__.py
Python
mit
2,730
import sys, logging logging.basicConfig(level=15, stream=sys.stderr, format="%(levelname)1s:%(filename)10s:%(lineno)3d:%(message)s") # make log level names shorter so that we can show them logging.addLevelName(50, 'C') logging.addLevelName(40, 'E') logging.ad...
hexhex/hexlite
java-api/src/test/python/test-jpype.py
Python
mit
3,537
#!/usr/bin/env python import os import sys import time from subprocess import CalledProcessError, check_output, STDOUT certs_dir = '{{ letsencrypt_certs_dir }}' failed = False sites = {{ sites }} sites = (k for k, v in sites.items() if 'ssl' in v and v['ssl'].get('enabled', False) and v['ssl'].get('provider', 'manua...
afonsoduarte/ansible-stacey
roles/letsencrypt/templates/renew-certs.py
Python
mit
1,905
# coding: utf-8 from django.conf.urls import patterns, url urlpatterns = patterns( 'todo.core.views', url(r'^user/list/$', 'user_list', name="user_list"), url(r'^user/form/$', 'user_create', name="user_form"), url(r'^user/form/(?P<pk>\d+)/$', 'user_update', name="user_form"), url(r'^user/delete/(?...
zokis/TODO-agenda
todo/todo/core/urls.py
Python
mit
372
from . import pos_longpolling_controller
it-projects-llc/pos-addons
pos_longpolling/controllers/__init__.py
Python
mit
41
__author__ = 'vialette'
vialette/ultrastorage
ultrastorage/tools/__init__.py
Python
mit
24
from graph_tool.all import * from sets import Set import random from geopy import geocoders, distance from decimal import * def randomize(iterable, bufsize=1000): ''' generator that randomizes an iterable. space: O(bufsize). time: O(n+bufsize). ''' buf = [None] * bufsize for x in iterable: i = random.r...
philipbjorge/WTA-Bus-Routing
WTA App.py
Python
mit
4,459
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from django.contrib.auth.models import AbstractUser from django.core.urlresolvers import reverse from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy...
luftdanmark/fifo.li
fifo/users/models.py
Python
mit
883
#!/usr/bin/env python3 import os import argparse import sys from time import sleep import subprocess import imp import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib import datetime import pickle matplotlib.style.use('fivethirtyeight') # print(plt.style.available) # mypath = os.envi...
luwei0917/awsemmd_script
pulling.py
Python
mit
2,102
import numpy as np import cv2 import pickle import os import matplotlib.pyplot as plt class cameraCalib(): def __init__(self, calib_image_path = 'camera_cal/'): self.mtx = None self.dist = None self.calib_image_path = calib_image_path self.calib_file = self.calib_image_path + 'cam...
sridhar912/Self-Driving-Car-NanoDegree
CarND-Advanced-Lane-Lines/CameraCalibration.py
Python
mit
4,101
# ./_sac.py # -*- coding: utf-8 -*- # PyXB bindings for NM:bd794131cb7c2b1e52ff4e6220a49c5d8509c55c # Generated 2015-02-11 21:35:49.975586 by PyXB version 1.2.4 using Python 2.6.9.final.0 # Namespace urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2 [xmlns:sac] from __future__ import unicode_...
getodacu/eSENS-eDocument
profiles/e_confirmation/xb_request/_sac.py
Python
mit
11,405
"""Endpoints for listing Projects, Versions, Builds, etc.""" import json import logging from allauth.socialaccount.models import SocialAccount from django.conf import settings from django.db.models import BooleanField, Case, Value, When from django.shortcuts import get_object_or_404 from django.template.loader import...
rtfd/readthedocs.org
readthedocs/api/v2/views/model_views.py
Python
mit
12,622
# -- encoding: UTF-8 -- import sys from click import echo from colorama import Fore, Style can_use_real_emoji = ( sys.stdout.isatty() and sys.platform != "win32" ) def success(msg): if can_use_real_emoji: sign = "\U0001F44C" else: sign = "[+] " echo(Fore.GREEN + Style.BRIGHT + si...
wurstfabrik/wurst-cli
wurstc/cli/utils.py
Python
mit
461
import gammu.smsd import thread class smsd(object): """Starts gammu in another thread so the bot can interpret incoming sms""" def __init__(self, configpath): self.sms = gammu.smsd.SMSD(configpath) self.thread = None def start(self): self.thread = thread.start_new_thread(self.sms...
WaltonSimons/PhoneBot
smsd.py
Python
mit
904
#!/usr/bin/env python3 # Copyright (c) 2015-2017 The Doriancoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the ZMQ notification interface.""" import configparser import os import struct from test_frame...
doriancoins/doriancoin
test/functional/interface_zmq.py
Python
mit
4,806
import cv2 import skimage.io import skimage.transform import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from CatFinder import CatFinder from CatPlayer import CatPlayer from DrawGui import DrawArea def load_image(path, size=224): img = skimage.io.imread(path) short_edge = min(img.sha...
sigmunjr/VirtualPetFence
runSegmentation.py
Python
mit
2,367
#!/usr/bin/python class Solution(object): def reconstructQueue(self, people): print people people = sorted(people, key=lambda x: x[1]) print people people = sorted(people, key=lambda x: -x[0]) print people res = [] for p in people: res.insert(p[1...
pisskidney/leetcode
medium/406.py
Python
mit
1,289
#!BPY """ Name: 'TikZ (.tex)...' Blender: 245 Group: 'Export' Tooltip: 'Export selected curves as TikZ paths for use with (La)TeX' """ __author__ = 'Kjell Magne Fauske' __version__ = "1.0" __url__ = ("Documentation, http://www.fauskes.net/code/blend2tikz/documentation/", "Author's homepage, http://www.fausk...
kjellmf/blend2tikz
tikz_export.py
Python
mit
20,546
import pymarkdownlint from pymarkdownlint.filefinder import MarkdownFileFinder from pymarkdownlint.lint import MarkdownLinter from pymarkdownlint.config import LintConfig import os import click DEFAULT_CONFIG_FILE = ".markdownlint" def echo_files(files): for f in files: click.echo(f) exit(0) def ge...
jorisroovers/pymarkdownlint
pymarkdownlint/cli.py
Python
mit
1,924
""" .. module:: counters :synopsis: SFlow counter object interfaces .. moduleauthor:: Colin Alston <colin@imcol.in> """ from construct import Struct, UBInt32, Array, Bytes class InterfaceCounters(object): """Counters for network interfaces """ def __init__(self, u): self.if_index = u.unpack_ui...
ducted/duct
duct/protocol/sflow/protocol/counters.py
Python
mit
10,161
import configparser import importlib.util import random from pdb import set_trace from warnings import warn import numpy as np import pygame from PIL import Image import os from behaviours.Collide import Collide from src.utils.CodeItWarning import CodeItWarning from tiles.base.Tile import Tile level_paths = {} leve...
cthit/CodeIT
src/level/Level.py
Python
mit
7,583
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-07-29 18:16 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('django_sendgrid_parse', '0001_initial'), ] operations = [ migrations.RenameF...
letops/django-sendgrid-parse
django_sendgrid_parse/migrations/0002_auto_20160729_1816.py
Python
mit
626
import datetime import calendar import dabo dabo.ui.loadUI("wx") from dabo.ui import dForm, dPanel, dSizer, dGridSizer, dButton, dEditBox, \ dTextBox, dControlMixin, callAfterInterval, dKeys, \ dLabel, dHyperLink from dabo.lib.dates import goMonth, goDate import biz __all__ = ["...
pmcnett/pmcalendar
pmcalendar/ui.py
Python
mit
15,413
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy class NewsItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() # pass news_thread=scrapy.Field() ...
DavidFnck/Python_Stock_Github
news/news/items.py
Python
mit
494
from django import forms class SearchMovieForm(forms.Form): search = forms.CharField(label='', max_length=25, widget=forms.TextInput( attrs={'class': 'form-control'})) choices = [('movie', 'MOVIES'), ('series', 'TV')] choice = forms.ChoiceField(label='', choices=choices, widget=fo...
rish4bhn/movieclue
movieclue/forms.py
Python
mit
370
from django.contrib import admin from cathedra.models import Lector, Room, Position, Science, Aspirant, Technician admin.site.register(Lector) admin.site.register(Aspirant) admin.site.register(Technician) admin.site.register(Room) admin.site.register(Position) admin.site.register(Science)
Axik/eapu
apps/cathedra/admin.py
Python
mit
293
import sublime_plugin from php_coverage.data import CoverageDataFactory from php_coverage.finder import CoverageFinder from php_coverage.matcher import Matcher class CoverageCommand(sublime_plugin.TextCommand): """ Base class for a text command which has a coverage file. """ def __init__(self, view...
bradfeehan/SublimePHPCoverage
php_coverage/command.py
Python
mit
1,636
from tests import TestCase from werkzeug.urls import url_quote from datamart.models import Role from flask.ext.security import current_user class TestRoles(TestCase): def test_show_roles_anon(self): """Verify unathenticated users can't see the roles page.""" response = self.client.get('/roles/', f...
msscully/datamart
tests/test_roles.py
Python
mit
2,860
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "seeker.settings.prod") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
LomaxRx/service-seeker
manage.py
Python
mit
254
from voluptuous import All, Match, Coerce from datatypes.core import SingleValueValidator price_schema = All(Coerce(float), Coerce(unicode), Match('^[0-9]+(,[0-9]+)?(\.\d{1,2})?$')) class Price(SingleValueValidator): def define_schema(self): return price_schema def define_error_message(self): ...
LandRegistry/datatypes-alpha
datatypes/validators/price_validator.py
Python
mit
373
# # Walks every page that it can find in a website # # It's an excuse to play with BeautifulSoup import re from io import BytesIO from bs4 import BeautifulSoup from pycurl import Curl from queue import Queue, Empty as QueueEmpty from urllib.parse import urlsplit, urlunsplit, urljoin from sys import stdout class PageF...
nada-labs/sitemap-generator
spider.py
Python
mit
5,128
from decimal import Decimal import pytest from django.conf import settings from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient from openslides.core.config import config from openslides.motions.models import Motion, ...
jwinzer/OpenSlides
server/tests/integration/motions/test_polls.py
Python
mit
67,548
"""Auto-generated file, do not edit by hand. EE metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_EE = PhoneMetadata(id='EE', country_code=None, international_prefix=None, general_desc=PhoneNumberDesc(national_number_pattern='1\\d{2,5}', possible_length=(3, 6)), ...
samdowd/drumm-farm
drumm_env/lib/python2.7/site-packages/phonenumbers/shortdata/region_EE.py
Python
mit
699
#!/usr/bin/env python # -*- coding: utf-8 -*- #------------------------------------------------------------------------------ __author__ = 'James T. Dietrich' __contact__ = 'james.t.dietrich@dartmouth.edu' __copyright__ = '(c) James Dietrich 2016' __license__ = 'MIT' __date__ = 'Wed Nov 16 11:33:39 2016' __version__ = ...
geojames/Dart_EnvGIS
Week6-1_Pandas.py
Python
mit
7,208
""" Created on Sep 01, 2017 @author: StarlitGhost """ import datetime import time from twisted.plugin import IPlugin from twisted.words.protocols.irc import assembleFormattedText, attributes as A from zope.interface import implementer from desertbot.message import IRCMessage from desertbot.moduleinterface import IMo...
DesertBot/DesertBot
desertbot/modules/commands/Splatoon.py
Python
mit
3,155
# -*- coding: utf-8 -*- """ Created on Tue Apr 28 08:19:21 2015 @author: Roger """ from math import * import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Polygon wheelbase = 100 #inches vel = 20 *12 # fps to inches per sec steering_angle = radians(1) t = 1 # second orientation = 0. #...
zaqwes8811/micro-apps
self_driving/deps/Kalman_and_Bayesian_Filters_in_Python_master/experiments/bicycle.py
Python
mit
875
# -*- coding: utf-8 -*- import numpy as np from scipy.spatial import distance_matrix from scipy import sparse import pandas as pd from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout, Activation, Flatten from keras.optimizers import SGD,RMSprop #from keras.wrapper...
hstorm/nn_spatial
notebooks/test_spatial.py
Python
mit
5,525
import thread from time import sleep, ctime def loop0(): print 'start loop 0 at: ', ctime() sleep(4) print 'loop 0 done at: ', ctime() def loop1(): print 'start loop 1 at: ', ctime() sleep(2) print 'loop 1 done at: ', ctime() def main(): print 'starting at: ', ctime() thread.start_n...
seerjk/reboot06
arch_pre_work/mtsleep1.py
Python
mit
467
""" Provides a test case for issue 283 - "Inheritance breaks". The issue is outlined here: https://github.com/neo4j-contrib/neomodel/issues/283 More information about the same issue at: https://github.com/aanastasiou/neomodelInheritanceTest The following example uses a recursive relationship for economy, but the ide...
robinedwards/neomodel
test/test_issue283.py
Python
mit
10,529
"""distutils.command.build_py Implements the Distutils 'build_py' command.""" # created 1999/03/08, Greg Ward __revision__ = "$Id: build_py.py,v 1.34 2001/12/06 20:59:17 fdrake Exp $" import sys, string, os from types import * from glob import glob from distutils.core import Command from distutils.errors import * ...
MalloyPower/parsing-python
front-end/testsuite-python-lib/Python-2.2/Lib/distutils/command/build_py.py
Python
mit
15,090
# Python - 3.6.0 solution = lambda M1, M2, m1, m2, V, t: ((m1 / M1) + (m2 / M2)) * 0.082 * (t + 273.15) / V
RevansChen/online-judge
Codewars/8kyu/total-pressure-calculation/Python/solution1.py
Python
mit
109
from distutils.core import setup setup( name="tornado-stub-client", version="0.2", author="Danny Cosson", author_email="support@venmo.com", license="MIT", description="Stubs out tornado AsyncHTTPClient.fetch with a nice interface, for testing code that relies on async code", long_description...
dcosson/tornado-stub-client
setup.py
Python
mit
469
from django.shortcuts import render_to_response, get_object_or_404 from django.http import HttpResponseRedirect, Http404 from django.template import RequestContext from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User from django...
andriibekker/django-swaps
swaps/views.py
Python
mit
11,444
from os import remove from flask import jsonify, request from sqlalchemy import create_engine from sqlalchemy.schema import MetaData from sqlite3 import dbapi2 as sqlite from cv2 import imread, COLOR_RGB2GRAY, cvtColor from cv2.face import LBPHFaceRecognizer_create from faces_recognizer import Recognizer engine = cr...
Koisell/SmartCoffeeMachine
python/recognitionService_api/flask_app.py
Python
mit
3,964
# -*- coding: utf-8 -*- import unittest from .context import pso class PSOTestSuite(unittest.TestCase): def test_absolute_truth_and_meaning(self): assert False if __name__ == '__main__': unittest.main()
JoaoGFarias/comparing_swarm_intelligence
tests/pso.py
Python
mit
223
""" ******** UnitTest BayesNet ******** Method Checks that assertEqual(a, b) a == b assertNotEqual(a, b) a != b assertTrue(x) bool(x) is True assertFalse(x) bool(x) is False assertIs(a, b) a is b assertIsNot(a, b) a is not b assertIsNone(x) x is None assertIsNotNone(x) x is not None assertIn(a, b) a in b asser...
ncullen93/pyBN
pyBN/classes/_tests/test_bayesnet.py
Python
mit
4,002
from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from rest_framework.compat import unicode_to_repr from rest_framework.exceptions import ValidationError from rest_framework.utils.representation import smart_repr from csp import settings class EqualityValidator(object): ...
shriyanka/daemo-forum
crowdsourcing/validators/utils.py
Python
mit
2,693
#!/usr/bin/env python # -*- coding: utf-8 -*- """An example CRUD CLI app.""" from __future__ import ( absolute_import, print_function, unicode_literals ) import argparse import json import logging import sys TAGS = ( 'red', 'orange', 'yellow', 'green', 'blue', 'violet', 'bla...
lukassup/python-cli
crud_cli/__init__.py
Python
mit
4,021
import uuid import datetime import time import numpy as np import threading import vehicle import azurehook import json class SpeedCamera(object): TOPIC = "speedcamera" EVENT_ACTIVATION = "ACTIVATION" EVENT_DEACTIVATION = "DEACTIVATION" EVENT_VEHICLE = "OBSERVATION" def __init__(self, street, cit...
PedrosWits/smart-cameras
smartcameras/speedcamera.py
Python
mit
4,814
""" License MIT License Copyright (c) 2017 OpenAdaptronik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,...
IT-PM-OpenAdaptronik/Webapp
apps/register/forms.py
Python
mit
1,676
import os from pipeline import aminer aminer_requirements = aminer.AminerNetworkData() paths = [target.output().path for target in aminer_requirements.output()] all_good = True for path in paths: if not os.path.exists(path): all_good = False print("Download was unsuccessful or config is invalid;"...
macks22/dblp
verify_download.py
Python
mit
469
#!/usr/bin/env python3 import sys from math import sqrt, hypot from random import randint from array import array class Vector3d: ''' //Define a vector class with constructor and operator: 'v' struct v{ f x,y,z; // Vector has three float attributes. v operator+(v r){return v(x+r.x,y+r.y,z+...
WittscraftStudios/business-card-raytracer
python/card.py
Python
mit
10,620
from distutils.core import setup setup(name="Complicated build", version="1.4.2", description="library which provides a simple interface to perform complex compilation tasks with multi-ligual sources.", author="Joe Jordan", author_email="tehwalrus@h2j9k.org", url="https://github.com/joe-jordan/complicated_bu...
joe-jordan/complicated_build
setup.py
Python
mit
346
#!/usr/bin/env python # # Use the raw transactions API to spend bitcoins received on particular addresses, # and send any change back to that same address. # # Example usage: # spendfrom.py # Lists available funds # spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00 # # Assumes it will talk to a bitcoind or Bit...
ikarutoko/Tradercoin
Contrib/Spendfrom/spendfrom.py
Python
mit
10,053
from operator import itemgetter points = [{"coords":[14,48]},{"coords":[15,50]}, ] s = [p["coords"] for p in points] s = [p["coords"] for p in points if p["coords"][0]>14] print(s) def twice(n): return 2*n numbers = ["12","14","23"] nums = list(map(int,numbers)) doubled = list(map(twice,nums)) print(nums)...
xtompok/uvod-do-prg
cv12/cv12.py
Python
mit
660
import time import urllib import urllib2 from Queue import Queue, Empty from functools import partial from threading import Thread, Lock import tornado.httpserver import tornado.ioloop from tornado.web import HTTPError, RequestHandler, Application, asynchronous from msgbox import logger from msgbox.sim import sim_man...
paolo-losi/msgbox
msgbox/http.py
Python
mit
3,832
from django.contrib.contenttypes.models import ContentType from django.db import models from django_page_views.templatetags.django_page_views import views_count from django_vote_system.templatetags.vote import downvote_count, upvote_count class Common(models.Model): class Meta: abstract = True @prope...
hakancelik96/coogger
core/cooggerapp/models/common.py
Python
mit
1,003
# Validate TensorFlow installation import tensorflow as tf message = tf.constant('TensorFlow installation successful!') sess = tf.Session() print(sess.run(message))
guosibs/learning
src/validate.py
Python
mit
165
from splitwise import Splitwise import unittest try: from unittest.mock import patch except ImportError: # Python 2 from mock import patch @patch('splitwise.Splitwise._Splitwise__makeRequest') class GetCurrentUserTestCase(unittest.TestCase): def setUp(self): self.sObj = Splitwise('consumerkey', ...
namaggarwal/splitwise
tests/test_getCurrentUser.py
Python
mit
2,597
from runipy.notebook_runner import NotebookRunner from IPython.nbformat.current import read from glob import glob files = glob("./[01]*ipynb") for file in files: print("Doing file {}".format(file)) notebook = read(open(file), 'json') r = NotebookRunner(notebook) r.run_notebook(skip_exceptions=True) ...
IanHawke/maths-with-python
run_notebooks.py
Python
mit
456
from datetime import timedelta from celery import Celery app = Celery('twitch', backend='db+sqlite:///celeryresdb.sqlite', broker='sqla+sqlite:///celerydb.sqlite', include=['tasks']) app.conf.CELERYBEAT_SCHEDULE = { 'clear-db': { 'task': 'twitch.clear_dbs', '...
Redpoint1/Twitch-SlinxBot
twitch.py
Python
mit
406
#coding: utf-8 """ @Author: Well @Date: 2014 - 04 - 14 """ """ 求某一个英文文本中完整句子的数目, 文本中只包含大小写字母、空格、“,”和“.”, 完整的句子是指以“.”结束,且“.”号前必须出现至少一个字母。 """ import os # 文件名 name_ = os.path.basename(__file__).split('.')[0] dir_ = os.path.dirname(__file__) # 绝对文件夹路径 # file2 = os.path.dirname(__file__) # print file2 # # # 绝对路径 #file...
neiltest/neil_learn_python
src/learn_python/python_other/neil_06_txt_split.py
Python
mit
691
#!/usr/bin/env python # encoding: utf-8 # # The MIT License (MIT) # # Copyright (c) 2013-2015 CNRS # # 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 li...
tvd-dataset/tvd
tvd/rip/avconv.py
Python
mit
4,097
#!/usr/bin/env python from setuptools import setup, find_packages # Get version with open('compare_versions/version.py') as f: exec(f.read()) # Get documentation def readme(): with open('README.rst') as f: return f.read() setup( name='compare_versions', version=__version__, author='Luke...
lukeyeager/compare-versions
setup.py
Python
mit
830
""" WSGI config for codex 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.7/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "codex.settings") from django.core.wsgi ...
mod2/codex
codex/wsgi.py
Python
mit
385
from .. import Provider as BaseProvider class Provider(BaseProvider): """ A Faker provider for the Luxembourgish VAT IDs """ vat_id_formats = ( 'LU########', ) def vat_id(self): """ http://ec.europa.eu/taxation_customs/vies/faq.html#item_11 :return: a random L...
danhuss/faker
faker/providers/ssn/lb_LU/__init__.py
Python
mit
423
""" WSGI config for pyjobs 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.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTIN...
pyshop/pyjobs
src/pyjobs/wsgi.py
Python
mit
389
"""Value change dump stuff.""" class VCDObject: """Abstract VCD object class.""" class VCDScope(VCDObject): """VCD scope.""" def __init__(self, *scopes: str): """Initialize. Parameters ---------- scopes List of scope names """ self._scopes = []...
brunosmmm/hdltools
hdltools/vcd/__init__.py
Python
mit
2,238
# -*- coding: utf-8 -*- # test/unit/stat/test_flushtosql.py # Copyright (C) 2016 authors and contributors (see AUTHORS file) # # This module is released under the MIT License. """Test flushtosql()""" # ============================================================================ # Imports # ===========================...
arielmakestuff/loadlimit
test/unit/stat/test_flushtosql.py
Python
mit
7,022
#!/usr/bin/env python3 # Copyright (c) 2016-2019 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test processing of feefilter messages.""" from decimal import Decimal import time from test_framework...
FeatherCoin/Feathercoin
test/functional/p2p_feefilter.py
Python
mit
3,641
import datetime import os from time import strftime from reportlab.lib.colors import black from reportlab.lib.pagesizes import letter from reportlab.lib.enums import TA_JUSTIFY from reportlab.pdfbase import pdfmetrics from reportlab.platypus import Paragraph, Spacer, Table, PageTemplate, \ BaseDocTemplate, Frame, ...
adriansoghoian/security-at-home
models.py
Python
mit
8,450
#!/usr/bin/env python # # import needed modules. # pyzabbix is needed, see https://github.com/lukecyca/pyzabbix # import argparse import ConfigParser import os import os.path import sys import distutils.util from xml.etree import ElementTree as ET from pyzabbix import ZabbixAPI # define config helper function def Conf...
q1x/zabbix-gnomes
ztmplimport.py
Python
mit
6,615
__author__ = 'ilblackdragon@gmail.com' from pymisc import log, decorators class RegisterSystem(object): interfaces = [] classes = [] @classmethod @decorators.logprint(log) def register(self, cls): if cls.__name__[0] == 'I': print("Regirstring interface `%s`" % cls.__name__) ...
ilblackdragon/pymisc
pymisc/abstract.py
Python
mit
1,152
import openmc ############################################################################### # Simulation Input File Parameters ############################################################################### # OpenMC simulation parameters batches = 20 inactive = 10 particles = 10000 #########...
mjlong/openmc
examples/python/lattice/nested/build-xml.py
Python
mit
5,849
# sublimelint.py # SublimeLint is a code checking framework for Sublime Text # # Project: https://github.com/lunixbochs/sublimelint # License: MIT import sublime import sublime_plugin import os from threading import Thread import time import json from .lint.edit import apply_sublimelint_edit from .lint.edit import E...
lunixbochs/sublimelint
sublimelint.py
Python
mit
6,546
import time from datetime import date import numpy from PIL import Image import zbar import os,sys import wx # GUI # Handle time lapse! scanner = zbar.ImageScanner() # configure the reader scanner.parse_config('enable') #scanner.set_config(0, zbar.Config.ENABLE, 0) #scanner.set_conf...
LionelDupuy/ARCHI_PHEN
ImageJ/DatabaseInput_deprecated.py
Python
mit
5,558
import requests import json from decimal import Decimal from i3pystatus import IntervalModule from i3pystatus.core.util import internet, require class Coin(IntervalModule): """ Fetches live data of all cryptocurrencies available at coinmarketcap <https://coinmarketcap.com/>. Coin setting should be equal ...
enkore/i3pystatus
i3pystatus/coin.py
Python
mit
2,896
#!/usr/bin/env python # -*- coding: utf-8 -*- """from python cookbook 2rd edition""" import sys class Progressbar(object): def __init__(self, finalcount, block_char = "."): self.finalcount = finalcount self.blockcount = 0 self.block = block_char self.f = sys.stdout if not s...
ptrsxu/snippetpy
shdisplay/progressbar.py
Python
mit
1,671
import os from onitu.api import Plug, ServiceError, DriverError # A dummy library supposed to watch the file system from fsmonitor import FSWatcher plug = Plug() @plug.handler() def get_chunk(metadata, offset, size): try: with open(metadata.filename, 'rb') as f: f.seek(offset) r...
onitu/onitu
docs/examples/driver.py
Python
mit
2,035
from django.test import TestCase from test_app.models import MonitorAllFields, MonitorSomeFields class MonitoredModelGetChanges(TestCase): def test_monitor_all_fields_no_changes___result_is_empty_dict(self): m = MonitorAllFields(first_field=1) self.assertEqual({}, m.get_changes()) def test_m...
OmegaDroid/django-model-monitor
src/test_app/test/unit/test_monitored_model_get_changes.py
Python
mit
1,523
""" __graph_MT_post__Model_T.py___________________________________________________________ Automatically generated graphical appearance ---> MODIFY DIRECTLY WITH CAUTION _____________________________________________________________________________ """ import tkFont from graphEntity import * from GraphicalForm i...
levilucio/SyVOLT
UMLRT2Kiltera_MM/graph_MT_post__Model_T.py
Python
mit
2,614
PENDING = 0 RESOLVED = 1 STATUS = { PENDING: 'pending', RESOLVED: 'resolved', }
kvchen/officehour-queue
oh_queue/entries/constants.py
Python
mit
84
# Generated by Django 2.1.4 on 2019-01-23 20:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('guide', '0002_auto_20181116_1617'), ] operations = [ migrations.AddField( model_name='rule', name='is_active', ...
stefanw/froide
froide/guide/migrations/0003_rule_is_active.py
Python
mit
385
import win32com.client.makepy import win32com.client import os # Generate type library so that we can access constants win32com.client.makepy.GenerateFromTypeLibSpec('Acrobat') # Use Unicode characters instead of their ascii psuedo-replacements UNICODE_SNOB = 0 def convertHTML2PDF(htmlPath, pdfPath): 'Convert an...
ryan413/gotem
web_html_pdf_zip/html_to_pdf.py
Python
mit
1,227
#------------------------------------------------------------------------------ # Copyright (c) 2008 Richard W. Lincoln # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restricti...
rwl/godot
godot/common.py
Python
mit
7,329
import warnings from datapackage_pipelines.wrapper import ingest from datapackage_pipelines.utilities.flow_utils import spew_flow from datapackage_pipelines.lib.update_package import flow if __name__ == '__main__': warnings.warn( 'add_metadata will be removed in the future, use "update_package" instead'...
frictionlessdata/datapackage-pipelines
datapackage_pipelines/lib/add_metadata.py
Python
mit
426
''' Faça um Programa que peça dois números e imprima o maior deles. ''' num1 = int (input('Primeiro numero: ')) num2 = int(input('Segundo numero: ')) if num1 > num2: print(num1) else: print(num2)
GiordaneOliveira/Exercicios-resolvidos-em-python
01.py
Python
mit
222