commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
1d67f755ea0f638c3cabef9e9359665d5b50ff86 | Clean up BeamConstellation | CactusDev/CactusBot | cactusbot/services/beam/constellation.py | cactusbot/services/beam/constellation.py | """Interact with Beam Constellation."""
import re
import json
from .. import WebSocket
class BeamConstellation(WebSocket):
"""Interact with Beam Constellation."""
URL = "wss://constellation.beam.pro"
RESPONSE_EXPR = re.compile(r'^(\d+)(.+)?$')
INTERFACE_EXPR = re.compile(r'^([a-z]+):\d+:([a-z]+)')... | """Interact with Beam Constellation."""
from logging import getLogger
import re
import json
import asyncio
from .. import WebSocket
class BeamConstellation(WebSocket):
"""Interact with Beam Constellation."""
URL = "wss://constellation.beam.pro"
RESPONSE_EXPR = re.compile(r'^(\d+)(.+)?$')
INTERFA... | mit | Python |
948dadbd4aa262c86e561c56e7cd7748cdefa18b | Extend teacher column for institute courses | sonicyang/NCKU_Course,sonicyang/NCKU_Course,sonicyang/NCKU_Course,sonicyang/NCKU_Course | data_center/models.py | data_center/models.py | # -*- coding: utf-8 -*-
from datetime import datetime
from django.db import models
class Course(models.Model):
"""Course database schema"""
no = models.CharField(max_length=20, blank=True)
code = models.CharField(max_length=20, blank=True)
eng_title = models.CharField(max_length=200, blank=True)
... | # -*- coding: utf-8 -*-
from datetime import datetime
from django.db import models
class Course(models.Model):
"""Course database schema"""
no = models.CharField(max_length=20, blank=True)
code = models.CharField(max_length=20, blank=True)
eng_title = models.CharField(max_length=200, blank=True)
... | mit | Python |
f0243e8ab8897d218bcf45af91a7cd03a3f83c5e | Add section comments. | Baza207/CloudKitPy | cloudkitpy/container.py | cloudkitpy/container.py | #
# container.py
# CloudKitPy
#
# Created by James Barrow on 28/04/2016.
# Copyright (c) 2013-2016 Pig on a Hill Productions. All rights reserved.
#
# !/usr/bin/env python
class Container:
# Getting the Public and Private Databases
public_cloud_database = None
private_cloud_database = None
# Getti... | #
# container.py
# CloudKitPy
#
# Created by James Barrow on 28/04/2016.
# Copyright (c) 2013-2016 Pig on a Hill Productions. All rights reserved.
#
# !/usr/bin/env python
class Container:
public_cloud_database = None
private_cloud_database = None
container_identifier = None
environment = None
a... | mit | Python |
7965ce3036f98a9b880f19f688e7e282644e63cf | remove server_name | vcaen/personalwebsite,vcaen/personalwebsite,vcaen/personalwebsite,vcaen/personalwebsite | app/main.py | app/main.py | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def show_about():
return render_template('aboutme.html')
if __name__ == '__main__':
app.run() | from flask import Flask, render_template
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SERVER_NAME'] = "vcaen.com"
@app.route('/')
def show_about():
return render_template('aboutme.html')
if __name__ == '__main__':
app.run() | cc0-1.0 | Python |
a1d9312e1ac6f66aaf558652d890ac2a6bd67e40 | Add parent so we can track versions. | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | backend/loader/model/datafile.py | backend/loader/model/datafile.py | from dataitem import DataItem
class DataFile(DataItem):
def __init__(self, name, access, owner):
super(DataFile, self).__init__(name, access, owner, "datafile")
self.checksum = ""
self.size = 0
self.location = ""
self.mediatype = ""
self.conditions = []
self.... | from dataitem import DataItem
class DataFile(DataItem):
def __init__(self, name, access, owner):
super(DataFile, self).__init__(name, access, owner, "datafile")
self.checksum = ""
self.size = 0
self.location = ""
self.mediatype = ""
self.conditions = []
self.... | mit | Python |
424b50960e7ca42c61ccc98864f9876e9688dcd4 | remove empty elements | pkimber/search,pkimber/search,pkimber/search | example/models.py | example/models.py | from django.db import models
class Cake(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
class Meta:
verbose_name = 'Cake'
verbose_name_plural = 'Cakes'
def __unicode__(self):
return unicode('{}'.format(self.name))
def get_summary_d... | from django.db import models
class Cake(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
class Meta:
verbose_name = 'Cake'
verbose_name_plural = 'Cakes'
def __unicode__(self):
return unicode('{}'.format(self.name))
def get_summary_d... | apache-2.0 | Python |
bcc7692e14b7b695f08dfb39aaccf3dbfa67d857 | Add safeGetInt to BMConfigParser | hb9kns/PyBitmessage,hb9kns/PyBitmessage,bmng-dev/PyBitmessage,bmng-dev/PyBitmessage,bmng-dev/PyBitmessage,hb9kns/PyBitmessage,hb9kns/PyBitmessage | src/configparser.py | src/configparser.py | import ConfigParser
from singleton import Singleton
@Singleton
class BMConfigParser(ConfigParser.SafeConfigParser):
def set(self, section, option, value=None):
if self._optcre is self.OPTCRE or value:
if not isinstance(value, basestring):
raise TypeError("option values must be... | import ConfigParser
from singleton import Singleton
@Singleton
class BMConfigParser(ConfigParser.SafeConfigParser):
def set(self, section, option, value=None):
if self._optcre is self.OPTCRE or value:
if not isinstance(value, basestring):
raise TypeError("option values must be... | mit | Python |
5bce4bb123a086dd116abbd0932d34fa170a83cd | Update view to point to corrected template path | ayleph/mediagoblin-basicsearch,ayleph/mediagoblin-basicsearch | search/views.py | search/views.py | # GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... | # GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... | agpl-3.0 | Python |
d77777c2a011e77b284748d1dfbd3cd31e6c8565 | make verifier regexing more robust | uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco | c_test_environment/verifier.py | c_test_environment/verifier.py | import re
import sys
def verify(testout, expected, ordered):
numpat = re.compile(r'(\d+)')
tuplepat = re.compile(r'Materialized')
test = ({}, [])
expect = ({}, [])
def addTuple(tc, t):
if ordered:
tcl = tc[1]
tcl.append(t)
else:
tcs = tc[0]
... | import re
import sys
def verify(testout, expected, ordered):
test = ({}, [])
expect = ({}, [])
def addTuple(tc, t):
if ordered:
tcl = tc[1]
tcl.append(t)
else:
tcs = tc[0]
if t not in tcs:
tcs[t] = 1
else:
... | bsd-3-clause | Python |
82641a936b2215480e29896cdafed3872c2928c6 | Remove xfails for newly passing tests in test_recipe_integration.py | ahal/active-data-recipes,ahal/active-data-recipes | test/test_recipes_integration.py | test/test_recipes_integration.py | import pytest
import os
import subprocess
import json
# Each test with recipe and appropriate parameters in one line
# Using bracket annotation to set it optional (xfail)
TEST_CASES = [
"activedata_usage",
"backout_rate",
["code_coverage --path caps --rev 45715ece25fc"],
"code_coverage_by_suite --path ... | import pytest
import os
import subprocess
import json
# Each test with recipe and appropriate parameters in one line
# Using bracket annotation to set it optional (xfail)
TEST_CASES = [
"activedata_usage",
["backout_rate"],
["code_coverage --path caps --rev 45715ece25fc"],
"code_coverage_by_suite --pat... | mpl-2.0 | Python |
5ecab61cd66b821d70e73006f60d8f7908bfb403 | Remove comment | davidrobles/mlnd-capstone-code | capstone/mdp/fixed_game_mdp.py | capstone/mdp/fixed_game_mdp.py | from .mdp import MDP
from .game_mdp import GameMDP
from ..utils import utility
class FixedGameMDP(GameMDP):
def __init__(self, game, opp_player, opp_idx):
'''
opp_player: the opponent player
opp_idx: the idx of the opponent player in the game
'''
self._game = game
... | from .mdp import MDP
from .game_mdp import GameMDP
from ..utils import utility
class FixedGameMDP(GameMDP):
def __init__(self, game, opp_player, opp_idx):
'''
opp_player: the opponent player
opp_idx: the idx of the opponent player in the game
'''
self._game = game
... | mit | Python |
b8c3ad8c9eb4cdf2618839b425b8413181a443ff | Fix bug in writePrecisePathToSnapshot not bactracking prperly to the initial structure | AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE | AdaptivePELE/analysis/writePrecisePathToSnapshot.py | AdaptivePELE/analysis/writePrecisePathToSnapshot.py | """
Recreate the trajectory fragments to the led to the discovery of a snapshot,
specified by the tuple (epoch, trajectory, snapshot) and write as a pdb file
"""
import os
import sys
import argparse
import glob
import itertools
from AdaptivePELE.utilities import utilities
def parseArguments():
"""
... | """
Recreate the trajectory fragments to the led to the discovery of a snapshot,
specified by the tuple (epoch, trajectory, snapshot) and write as a pdb file
"""
import os
import sys
import argparse
import glob
import itertools
from AdaptivePELE.utilities import utilities
def parseArguments():
"""
... | mit | Python |
1549510fd9371818cff6644984896a5a9060cb36 | Fix print statements with python3 syntax. | VROOM-Project/vroom-scripts,VROOM-Project/vroom-scripts | benchmarks/TSP/compare_to_BKS.py | benchmarks/TSP/compare_to_BKS.py | # -*- coding: utf-8 -*-
import json, sys, os
import numpy as np
# Compare a set of computed solutions to best known solutions on the
# same problems.
def s_round(v, d):
if d == 0:
return str(int(v))
else:
return str(round(v, d))
def log_comparisons(BKS, files):
print(','.join(["Instance", "Jobs", "Vehi... | # -*- coding: utf-8 -*-
import json, sys, os
import numpy as np
# Compare a set of computed solutions to best known solutions on the
# same problems.
def s_round(v, d):
if d == 0:
return str(int(v))
else:
return str(round(v, d))
def log_comparisons(BKS, files):
print ','.join(["Instance", "Jobs", "Vehi... | bsd-2-clause | Python |
63bd0d8905ea9392e56f501381c054ba3a4ed1a7 | Update __init__.py | ktnyt/chainer,wkentaro/chainer,niboshi/chainer,ronekko/chainer,chainer/chainer,chainer/chainer,okuta/chainer,wkentaro/chainer,ktnyt/chainer,pfnet/chainer,hvy/chainer,keisuke-umezawa/chainer,tkerola/chainer,okuta/chainer,keisuke-umezawa/chainer,hvy/chainer,jnishi/chainer,hvy/chainer,wkentaro/chainer,ktnyt/chainer,jnishi... | chainer/optimizers/__init__.py | chainer/optimizers/__init__.py | -# import classes and functions
from chainer.optimizers.ada_delta import AdaDelta # NOQA
from chainer.optimizers.ada_grad import AdaGrad # NOQA
from chainer.optimizers.adam import Adam # NOQA
from chainer.optimizers.momentum_sgd import MomentumSGD # NOQA
from chainer.optimizers.msvag import MSVAG # NOQA
from chain... | from chainer.optimizers.ada_delta import AdaDelta # NOQA
from chainer.optimizers.ada_grad import AdaGrad # NOQA
from chainer.optimizers.adam import Adam # NOQA
from chainer.optimizers.momentum_sgd import MomentumSGD # NOQA
from chainer.optimizers.msvag import MSVAG # NOQA
from chainer.optimizers.nesterov_ag import... | mit | Python |
7a7661bd03c947212ee46ca598cae5cd316757c1 | Fix flake8 | yuyu2172/chainercv,chainer/chainercv,yuyu2172/chainercv,chainer/chainercv,pfnet/chainercv | chainercv/datasets/__init__.py | chainercv/datasets/__init__.py | from chainercv.datasets.camvid.camvid_dataset import camvid_ignore_label_color # NOQA
from chainercv.datasets.camvid.camvid_dataset import camvid_label_colors # NOQA
from chainercv.datasets.camvid.camvid_dataset import camvid_label_names # NOQA
from chainercv.datasets.camvid.camvid_dataset import CamVidDataset # NO... | from chainercv.datasets.camvid.camvid_dataset import camvid_ignore_label_color # NOQA
from chainercv.datasets.camvid.camvid_dataset import camvid_label_colors # NOQA
from chainercv.datasets.camvid.camvid_dataset import camvid_label_names # NOQA
from chainercv.datasets.camvid.camvid_dataset import CamVidDataset # NO... | mit | Python |
b27398e4dd246d542c0a82ecc35da60911edc9fd | revert to dev version | mathause/regionmask | regionmask/version.py | regionmask/version.py | version = "0.7.0+dev"
| version = "0.7.0"
| mit | Python |
b318ced455f13477743a6d2d81b3556695b27374 | Make to_factorized_noisy support args | toslunar/chainerrl,toslunar/chainerrl | chainerrl/links/noisy_chain.py | chainerrl/links/noisy_chain.py | import chainer
from chainer.links import Linear
from chainerrl.links.noisy_linear import FactorizedNoisyLinear
def to_factorized_noisy(link, *args, **kwargs):
"""Add noisiness to components of given link
Currently this function supports L.Linear (with and without bias)
"""
def func_to_factorized_no... | import chainer
from chainer.links import Linear
from chainerrl.links.noisy_linear import FactorizedNoisyLinear
def to_factorized_noisy(link):
"""Add noisiness to components of given link
Currently this function supports L.Linear (with and without bias)
"""
_map_links(_func_to_factorized_noisy, link)... | mit | Python |
6535755cfdc914efc5e1efc6a89ed9dca7c78b87 | Correct docstrings of result_suite/sample.py | jessamynsmith/fontbakery,googlefonts/fontbakery,vitalyvolkov/fontbakery,vitalyvolkov/fontbakery,davelab6/fontbakery,googlefonts/fontbakery,moyogo/fontbakery,moyogo/fontbakery,graphicore/fontbakery,moyogo/fontbakery,graphicore/fontbakery,graphicore/fontbakery,googlefonts/fontbakery,vitalyvolkov/fontbakery | checker/result_suite/sample.py | checker/result_suite/sample.py | from checker.base import BakeryTestCase as TestCase
class SampleTest(TestCase):
target = 'result'
path = '.'
def setUp(self):
# read ttf
# self.font = fontforge.open(self.path)
pass
def test_ok(self):
""" This test succeeds """
self.assertTrue(True)
def t... | from checker.base import BakeryTestCase as TestCase
class SampleTest(TestCase):
target = 'result'
path = '.'
def setUp(self):
# read ttf
# self.font = fontforge.open(self.path)
pass
def test_ok(self):
""" This test failed """
self.assertTrue(True)
def tes... | apache-2.0 | Python |
0df292fbb34a66ee66fce919ea63b68a5f9eff1a | Set up data structures for parsing projects | albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com,albertyw/albertyw.com | app/data.py | app/data.py | import json
import os
from typing import Dict, List
from app.util import cached_function
class Projects():
def __init__(self) -> None:
self.languages: List[Language] = []
@staticmethod
def load_from_file() -> 'Projects':
current_directory = os.path.dirname(os.path.realpath(__file__))
... | import json
import os
from typing import Dict, List
from app.util import cached_function
class Projects():
def __init__(self) -> None:
self.data: Dict[str, Dict[str, Dict[str, str]]] = {}
@staticmethod
def load() -> 'Projects':
current_directory = os.path.dirname(os.path.realpath(__file_... | mit | Python |
912b1e33eff873a07ca089c69fef51bf05e79051 | Add User and Group to admin custom site | neosergio/vote_hackatrix_backend | ideas/admin.py | ideas/admin.py | from .models import Idea, Outstanding
from django.contrib import admin
from django.contrib.admin import AdminSite
from django.contrib.auth.models import User, Group
class MyAdminSite(AdminSite):
site_header = "Hackatrix Backend"
site_title = "Hackatrix Backend"
index_title = "Administrator"
class IdeaAd... | from .models import Idea, Outstanding
from django.contrib import admin
from django.contrib.admin import AdminSite
class MyAdminSite(AdminSite):
site_header = "Hackatrix Backend"
site_title = "Hackatrix Backend"
index_title = "Administrator"
class IdeaAdmin(admin.ModelAdmin):
list_display = ('name', ... | mit | Python |
1db8627731a2e23693cd9fe38a455956b783c0cd | Update NoticiasTecnologicas.py | HackLab-Almeria/clubpythonalm-taller-bots-telegram | 03-RSSTelegram/NoticiasTecnologicas.py | 03-RSSTelegram/NoticiasTecnologicas.py | #!/usr/bin/env python3
# -*- coding: iso-8859-1 -*-
""" Ejemplo: Leer Noticias RSS en Telegram (II)
Libreria: pyTelegramBotAPI 1.4.2 [ok]
Libreria: pyTelegramBotAPI 2.0 [ok]
Python: 3.5.1
"""
import telebot
import sys
import feedparser
url = "http://blog.bricogeek.com/noticias/arduino/rss/"
rss = feedparser.par... | #!/usr/bin/env python3
# -*- coding: iso-8859-1 -*-
""" Ejemplo: Leer Noticias RSS en Telegram (III)
Libreria: pyTelegramBotAPI 1.4.2 [ok]
Libreria: pyTelegramBotAPI 2.0 [ok]
Python: 3.5.1
"""
import telebot
import sys
import feedparser
url = "http://blog.bricogeek.com/noticias/arduino/rss/"
rss = feedparser.pa... | mit | Python |
f68a10fec5d4dbc743c5d84f8b26d122e81b26e4 | Use standard urlencode() for encoding URLs | joshua-stone/DerPyBooru | derpibooru/request.py | derpibooru/request.py | # Copyright (c) 2014, Joshua Stone
# 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 the ... | # Copyright (c) 2014, Joshua Stone
# 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 the ... | bsd-2-clause | Python |
8188008cf1bd41c1cbe0452ff635dd0319dfecd9 | Add trailing slash to url | Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django | derrida/books/urls.py | derrida/books/urls.py | from django.conf.urls import url
from django.contrib.admin.views.decorators import staff_member_required
from derrida.books.views import (
PublisherAutocomplete, LanguageAutocomplete, InstanceDetailView,
InstanceListView
)
urlpatterns = [
# TODO: come up with cleaner url patterns/names for autocomplete v... | from django.conf.urls import url
from django.contrib.admin.views.decorators import staff_member_required
from derrida.books.views import (
PublisherAutocomplete, LanguageAutocomplete, InstanceDetailView,
InstanceListView
)
urlpatterns = [
# TODO: come up with cleaner url patterns/names for autocomplete v... | apache-2.0 | Python |
c4ea3ce306d4464ac0bc80286a60689972c7bc63 | Test isolation. | pinax/pinax-points,pinax/pinax-points | agon/tests.py | agon/tests.py | from threading import Thread
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.contrib.auth.models import User
from agon.models import award_points, points_awarded
class PointsTestCase(TestCase):
def setUp(self):
self.... | from threading import Thread
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.contrib.auth.models import User
from agon.models import award_points, points_awarded
class PointsTestCase(TestCase):
def setUp(self):
self.... | mit | Python |
ac084c574b58771bd240af3fa4b4a000fc742229 | update to handle different kinds of files | imrehg/labhardware,imrehg/labhardware | projects/allan_cont/showlog_long.py | projects/allan_cont/showlog_long.py | import numpy as np
import pylab as pl
from ourgui import openFile
def plotline(maxx, minx=0, value=0, style="k-", plotfunc=pl.plot):
plotfunc([minx, maxx], [value, value], style)
def quickplot(filename):
alldata = np.loadtxt(filename, comments="#", delimiter=",")
datashape = np.shape(alldata)
... | import numpy as np
import pylab as pl
from ourgui import openFile
def plotline(maxx, minx=0, value=0, style="k-", plotfunc=pl.plot):
plotfunc([minx, maxx], [value, value], style)
def quickplot(filename):
data = np.loadtxt(filename, comments="#")
maxdata, mindata, stddata, meandata = np.max(data),... | mit | Python |
c206936120519912762f30eb269f1733b5593bf8 | fix window edges | niklaskorz/pyglet,adamlwgriffiths/Pyglet,niklaskorz/pyglet,adamlwgriffiths/Pyglet,adamlwgriffiths/Pyglet,seeminglee/pyglet64,adamlwgriffiths/Pyglet,seeminglee/pyglet64,seeminglee/pyglet64,niklaskorz/pyglet,niklaskorz/pyglet | contrib/spryte/balls.py | contrib/spryte/balls.py |
import random
from pyglet import window, clock, gl, event
from pyglet.window import key
import spryte
win = window.Window(vsync=False)
fps = clock.ClockDisplay(color=(1, 1, 1, 1))
layer = spryte.Layer()
balls = []
for i in range(200):
balls.append(spryte.Sprite('ball.png', layer,
(win.width - 64) * ran... |
import random
from pyglet import window, clock, gl, event
from pyglet.window import key
import spryte
win = window.Window(vsync=False)
fps = clock.ClockDisplay(color=(1, 1, 1, 1))
layer = spryte.Layer()
balls = []
for i in range(200):
balls.append(spryte.Sprite('ball.png', layer,
win.width * random.ran... | bsd-3-clause | Python |
b77cb1ac7524e76fd1f29ee6c8e214d12d04226f | Improve variable names. | LuminosoInsight/wordfreq | scripts/gen_regex.py | scripts/gen_regex.py | import unicodedata
from ftfy import chardata
import pathlib
from pkg_resources import resource_filename
CATEGORIES = [unicodedata.category(chr(i)) for i in range(0x110000)]
DATA_PATH = pathlib.Path(resource_filename('wordfreq', 'data'))
def func_to_regex(accept_func):
"""
Given a function that returns True ... | import unicodedata
from ftfy import chardata
import pathlib
from pkg_resources import resource_filename
CATEGORIES = [unicodedata.category(chr(i)) for i in range(0x110000)]
DATA_PATH = pathlib.Path(resource_filename('wordfreq', 'data'))
def func_to_regex(func):
"""
Given a function that returns True or Fals... | mit | Python |
5ff27451b55cdd03fa7913aee9e0762297341e29 | make image printer thingy iterable, and optimize output data | jart/fabulous,jart/fabulous,jart/fabulous | fabulous/image.py | fabulous/image.py | """Print Images to a 256-Color Terminal
"""
import sys
import fcntl
import struct
import termios
import itertools
from PIL import Image as Pills
from grapefruit import Color
from fabulous.xterm256 import rgb_to_xterm
class Image(object):
def __init__(self, path, width=None, bgcolor='black'):
self.bgcol... |
import sys
from PIL import Image
# from fabulous.ansi import fg
from fabulous.test_xterm256 import fg
def image(path, resize=None, resize_antialias=None):
im = Image.open(path)
if resize:
im = im.resize(resize)
elif resize_antialias:
im = im.resize(resize, Image.ANTIALIAS)
pix = im.... | apache-2.0 | Python |
439b977b14b12d42ee886a432f3a4af555d8de10 | add storage stuctures | navierula/Research-Fall-2017 | minMaxCalc.py | minMaxCalc.py | import pandas as pd
# read in dataset
xl = pd.ExcelFile("data/130N_Cycles_1-47.xlsx")
df = xl.parse("Specimen_RawData_1")
df
"""
This is what the dataset currently looks like - it has 170,101 rows and two columns.
The dataset contains data from 47 cycles following an experiment.
The output of these experiments form... | import pandas as pd
# read in dataset
xl = pd.ExcelFile("data/130N_Cycles_1-47.xlsx")
df = xl.parse("Specimen_RawData_1")
df
"""
This is what the dataset currently looks like - it has 170,101 rows and two columns.
The dataset contains data from 47 cycles following an experiment.
The output of these experiments form... | mit | Python |
642cd34041a579fa37ea3790143d79842c7141f3 | add implementation for all makers | ghisvail/ismrmrdpy | ismrmrdpy/backend/acquisition.py | ismrmrdpy/backend/acquisition.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2015, Ghislain Antony Vaillant
# All rights reserved.
#
# This file is distributed under the BSD License, see the LICENSE file or
# checkout the license terms at http://opensource.org/licenses/BSD-2-Clause).
from __future__ import absolute_import, division, print_function... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2015, Ghislain Antony Vaillant
# All rights reserved.
#
# This file is distributed under the BSD License, see the LICENSE file or
# checkout the license terms at http://opensource.org/licenses/BSD-2-Clause).
from __future__ import absolute_import, division, print_function... | bsd-2-clause | Python |
59ba038f117744ca0c5fe8c24b97b64830f8e7ec | Put bulk data into db | bschoenfeld/va-court-scraper,bschoenfeld/va-court-scraper | court_bulk_collector.py | court_bulk_collector.py | from courtreader import readers
from courtutils.logger import get_logger
from datetime import datetime, timedelta
import pymongo
import os
import sys
import time
# configure logging
log = get_logger()
log.info('Worker running')
def get_db_connection():
return pymongo.MongoClient(os.environ['MONGO_DB'])['va_court_... | from courtreader import readers
from courtutils.logger import get_logger
from datetime import datetime, timedelta
import pymongo
import os
import sys
import time
# configure logging
log = get_logger()
log.info('Worker running')
def get_db_connection():
return pymongo.MongoClient(os.environ['MONGO_DB'])['va_court_... | mit | Python |
e3a9db58f03eb73635a94ed6249e3c2a308f4ad0 | Fix some typos found in staging. | fedora-infra/fedmsg-genacls | fedmsg_genacls.py | fedmsg_genacls.py | # -*- coding: utf-8 -*-
""" A fedmsg consumer that listens to pkgdb messages to update gitosis acls
Authors: Janez Nemanič <janez.nemanic@gmail.com>
Ralph Bean <rbean@redhat.com>
"""
import pprint
import subprocess
import os
import fedmsg.consumers
import moksha.hub.reactor
class GenACLsConsumer(fed... | # -*- coding: utf-8 -*-
""" A fedmsg consumer that listens to pkgdb messages to update gitosis acls
Authors: Janez Nemanič <janez.nemanic@gmail.com>
Ralph Bean <rbean@redhat.com>
"""
import pprint
import subprocess
import os
import fedmsg.consumers
import moksha.hub.reactor
class GenACLsConsumer(fed... | lgpl-2.1 | Python |
d6342967598ae7fa822592b42e0f85de2beaf916 | use constants | freedesktop-unofficial-mirror/telepathy__telepathy-rakia,freedesktop-unofficial-mirror/telepathy__telepathy-rakia,freedesktop-unofficial-mirror/telepathy__telepathy-rakia | tests/twisted/test-self-alias.py | tests/twisted/test-self-alias.py | #
# Test alias setting for the self handle
#
from sofiatest import exec_test
import constants as cs
import dbus
def test(q, bus, conn, sip_proxy):
conn.Connect()
q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
self_handle = conn.GetSelfHandle()
default_alias = conn.Aliasing.GetAliases(... | #
# Test alias setting for the self handle
#
from sofiatest import exec_test
from servicetest import tp_name_prefix
import dbus
TEXT_TYPE = tp_name_prefix + '.Channel.Type.Text'
ALIASING_INTERFACE = tp_name_prefix + '.Connection.Interface.Aliasing'
CONTACTS_INTERFACE = tp_name_prefix + '.Connection.Interface.Contact... | lgpl-2.1 | Python |
0a57bcc2faca88d0527bb1f14dae2b0b9b5168f2 | bump filer version to 0.9pbs.54 | pbs/django-filer,pbs/django-filer,pbs/django-filer,pbs/django-filer,pbs/django-filer | filer/__init__.py | filer/__init__.py | #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.54' # pragma: nocover
| #-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9pbs.53' # pragma: nocover
| bsd-3-clause | Python |
006cbb88f2a06cd1411f88126ccf4a43121aa858 | Update app startup process with new servicemanager and websocket communication. | supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer | app/main.py | app/main.py | """
The main module for HomePiServer. Initializes SocketIO, ServiceManager, NavigationChannel,
View Manager.
"""
import signal
from threading import Thread
from gevent import monkey
from flask import Flask
from flask_socketio import SocketIO
from .controllers import CONTROLLERS
from .core.logger import configure_lo... | """
The main module for HomePiServer. Initializes SocketIO, ServiceManager, NavigationChannel,
View Manager.
"""
import signal
from threading import Thread
from gevent import monkey
from flask import Flask
from flask_socketio import SocketIO
from .controllers import CONTROLLERS
from .core.socketchannel import Navig... | mit | Python |
a0a92e237ca91dc8f0318a27dfeec9b9c8e95de5 | Add utility to guess livelock file for an owner | grnet/snf-ganeti,mbakke/ganeti,andir/ganeti,ganeti/ganeti,dimara/ganeti,mbakke/ganeti,grnet/snf-ganeti,ganeti-github-testing/ganeti-test-1,leshchevds/ganeti,leshchevds/ganeti,yiannist/ganeti,yiannist/ganeti,yiannist/ganeti,apyrgio/ganeti,onponomarev/ganeti,mbakke/ganeti,andir/ganeti,ganeti/ganeti,dimara/ganeti,andir/ga... | lib/utils/livelock.py | lib/utils/livelock.py | #
#
# Copyright (C) 2014 Google Inc.
#
# 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.
#
# This program is distributed ... | #
#
# Copyright (C) 2014 Google Inc.
#
# 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.
#
# This program is distributed ... | bsd-2-clause | Python |
a281fd3c49b86012fd370ae82df19525af89ff1c | Disable swift test | swift-lang/swift-e-lab,Parsl/parsl,swift-lang/swift-e-lab,Parsl/parsl,Parsl/parsl,Parsl/parsl | parsl/tests/test_swift.py | parsl/tests/test_swift.py | import pytest
import parsl
from parsl import *
parsl.set_stream_logger()
from parsl.executors.swift_t import *
def foo(x, y):
return x * y
def slow_foo(x, y):
import time
time.sleep(x)
return x * y
def bad_foo(x, y):
time.sleep(x)
return x * y
@pytest.mark.skip('fails intermittently')... | import pytest
import parsl
from parsl import *
parsl.set_stream_logger()
from parsl.executors.swift_t import *
def foo(x, y):
return x * y
def slow_foo(x, y):
import time
time.sleep(x)
return x * y
def bad_foo(x, y):
time.sleep(x)
return x * y
@pytest.mark.local
def test_simple():
... | apache-2.0 | Python |
e9980d7498c0889ecd795a4d2977c1893e0ad7e3 | comment on md5 usage | JsonChiu/openrunlog,JsonChiu/openrunlog,JsonChiu/openrunlog,JsonChiu/openrunlog | app/util.py | app/util.py |
import bcrypt
import md5
def hash_pwd(password):
return bcrypt.hashpw(password, bcrypt.gensalt())
def check_pwd(password, hashed):
return bcrypt.hashpw(password, hashed) == hashed
def validate_time(time):
return True
# XXX md5 module deprecated, use hashlib
def gravatar_html(email):
h = md5.md5(em... |
import bcrypt
import md5
def hash_pwd(password):
return bcrypt.hashpw(password, bcrypt.gensalt())
def check_pwd(password, hashed):
return bcrypt.hashpw(password, hashed) == hashed
def validate_time(time):
return True
def gravatar_html(email):
h = md5.md5(email.lower()).hexdigest()
html = '<img... | bsd-2-clause | Python |
1d443973e8db6265268dd2afe6b6ad7748526335 | Add _read_test_file() function. | rossant/ipymd,bollwyvl/ipymd | ipymd/utils.py | ipymd/utils.py | # -*- coding: utf-8 -*-
"""Utils"""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import os
import os.path as op
import difflib
from .six import exec_
#--------------------------------------... | # -*- coding: utf-8 -*-
"""Utils"""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import os
import os.path as op
import difflib
from .six import exec_
#--------------------------------------... | bsd-3-clause | Python |
95ad2c65fb1b4aacea668c8d9474183b4f107d56 | Test with multi args | thedrow/paver,cecedille1/paver,phargogh/paver,cecedille1/paver,nikolas/paver | paver/tests/test_shell.py | paver/tests/test_shell.py | import sys
from paver.deps.six import b
from mock import patch, Mock
from paver import easy
from subprocess import PIPE, STDOUT
@patch('subprocess.Popen')
def test_sh_raises_BuildFailure(popen):
popen.return_value.returncode = 1
popen.return_value.communicate.return_value = [b('some stderr')]
try:
... | import sys
from paver.deps.six import b
from mock import patch, Mock
from paver import easy
from subprocess import PIPE, STDOUT
@patch('subprocess.Popen')
def test_sh_raises_BuildFailure(popen):
popen.return_value.returncode = 1
popen.return_value.communicate.return_value = [b('some stderr')]
try:
... | bsd-3-clause | Python |
d329787dc6f862e749ca6f490a155186b48553a7 | Fix one more bug; interpreter still broken | ids1024/isbfc | bfinterp.py | bfinterp.py | import sys
import collections
import getch
from parser import parse, optimize
from parser import OUTPUT, INPUT, LOOPSTART, LOOPEND, MOVE
from parser import ADD, SET, MULCOPY, SCAN
BUFSIZE = 8192
def interp(code):
tokens = parse(code)
tokens = optimize(tokens)
i = 0
loops = []
mem = bytearray(BUF... | import sys
import collections
import getch
from parser import parse, optimize
from parser import OUTPUT, INPUT, LOOPSTART, LOOPEND, MOVE
from parser import ADD, SET, MULCOPY, SCAN
BUFSIZE = 8192
def interp(code):
tokens = parse(code)
tokens = optimize(tokens)
i = 0
loops = []
mem = bytearray(BUF... | mit | Python |
4cd44a177147569767a8f53aed67cbee0f759667 | bump verion to 3.0.0-alpha | widdowquinn/pyani | pyani/__init__.py | pyani/__init__.py | # python package version
# should match r"^__version__ = '(?P<version>[^']+)'$" for setup.py
"""Module with main code for pyani application/package."""
__version__ = '0.3.0-alpha'
| # python package version
# should match r"^__version__ = '(?P<version>[^']+)'$" for setup.py
"""Module with main code for pyani application/package."""
__version__ = '0.3.0.dev'
| mit | Python |
3066837091621720be0b0338d12ed66fd24a86b1 | bump version | davidkuep/pyiso,emunsing/pyiso,emunsing/pyiso | pyiso/__init__.py | pyiso/__init__.py | import imp
import os.path
__version__ = '0.2.7'
BALANCING_AUTHORITIES = {
'BPA': {'module': 'bpa', 'class': 'BPAClient'},
'CAISO': {'module': 'caiso', 'class': 'CAISOClient'},
'ERCOT': {'module': 'ercot', 'class': 'ERCOTClient'},
'ISONE': {'module': 'isone', 'class': 'ISONEClient'},
'MISO': {'mo... | import imp
import os.path
__version__ = '0.2.6'
BALANCING_AUTHORITIES = {
'BPA': {'module': 'bpa', 'class': 'BPAClient'},
'CAISO': {'module': 'caiso', 'class': 'CAISOClient'},
'ERCOT': {'module': 'ercot', 'class': 'ERCOTClient'},
'ISONE': {'module': 'isone', 'class': 'ISONEClient'},
'MISO': {'mo... | apache-2.0 | Python |
42ea9fef4203d5acd73e732dbe0e4d8672e81d17 | bump version for pypi | google/jax,google/jax,google/jax,tensorflow/probability,google/jax,tensorflow/probability | jax/version.py | jax/version.py | # Copyright 2018 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 agreed to in writing, ... | # Copyright 2018 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 agreed to in writing, ... | apache-2.0 | Python |
bcc8164f2e6ed4401dc5ecb74a28ebe8554f7b82 | Add Windows support. | octalmage/robotjs,BHamrick1/robotjs,octalmage/robotjs,BHamrick1/robotjs,hristoterezov/robotjs,BHamrick1/robotjs,hristoterezov/robotjs,octalmage/robotjs,octalmage/robotjs,BHamrick1/robotjs,hristoterezov/robotjs,hristoterezov/robotjs | binding.gyp | binding.gyp | {
'targets': [{
'target_name': 'robotjs',
'include_dirs': [
'node_modules/nan/'
],
'cflags': [
'-Wall',
'-Wparentheses',
'-Winline',
'-Wbad-function-cast',
'-Wdisabled-optimization'
],
'conditions': [
['OS == "mac"', {
'include_dirs... | {
'targets': [{
'target_name': 'robotjs',
'include_dirs': [
'<!(node -e \'require("nan")\')'
],
'cflags': [
'-Wall',
'-Wparentheses',
'-Winline',
'-Wbad-function-cast',
'-Wdisabled-optimization'
],
'conditions': [
['OS == "mac"', {
... | mit | Python |
c5da75e3acb4ba4c69204ff1ad3e7e89d6710001 | Add whitespace in tests | jackzhao-mj/ok,jackzhao-mj/ok,Cal-CS-61A-Staff/ok,jordonwii/ok,jordonwii/ok,Cal-CS-61A-Staff/ok,jordonwii/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,jackzhao-mj/ok,Cal-CS-61A-Staff/ok,jackzhao-mj/ok,jordonwii/ok | client/tests/framework_test.py | client/tests/framework_test.py | #!/usr/bin/python3
import unittest
import ok
class TestProtocol(ok.Protocol):
name = "test"
def __init__(self, args, src_files):
ok.Protocol.__init__(args, src_files)
self.called_start = 0
self.called_interact = 0
def on_start(self, buf):
self.called_start += 1
def ... | #!/usr/bin/python3
import unittest
import ok
class TestProtocol(ok.Protocol):
name = "test"
def __init__(self, args, src_files):
ok.Protocol.__init__(args, src_files)
self.called_start = 0
self.called_interact = 0
def on_start(self, buf):
self.called_start += 1
def o... | apache-2.0 | Python |
c7764ac8c1363701b4e7fab1d8ae0e3197853b48 | Update __init__.py | muteness/Pylsy,gnithin/Pylsy,gnithin/Pylsy,shnode/Pylsy,bcho/Pylsy,suhussai/Pylsy,shaunstanislaus/Pylsy,Maijin/Pylsy,janusnic/Pylsy,huiyi1990/Pylsy,muteness/Pylsy,bcho/Pylsy,Geoion/Pylsy,huiyi1990/Pylsy | pylsy/__init__.py | pylsy/__init__.py | #__init__.py
from .pylsy import PylsyTable
__version__="1.003"
| #__init__.py
from .pylsy import PylsyTable
__version__="1.001"
| mit | Python |
eaa17491581cbb52242fbe543dd09929f537a8bc | Add option to ignore static. | meilalina/kotlin-web-site,meilalina/kotlin-web-site,hltj/kotlin-web-site-cn,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,meilalina/kotlin-web-site,JetBrains/kotlin-web-site,meilalina/kotlin... | mysettings.py | mysettings.py | from src.markdown.makrdown import jinja_aware_markdown
PREFERRED_URL_SCHEME = 'http'
SERVER_NAME = 'localhost:5000'
FLATPAGES_EXTENSION = '.md'
FLATPAGES_HTML_RENDERER = jinja_aware_markdown
FREEZER_IGNORE_404_NOT_FOUND = True
FLATPAGES_AUTO_RELOAD = True
FREEZER_STATIC_IGNORE = ["*"]
GITHUB_URL = 'https://github.com/... | from src.markdown.makrdown import jinja_aware_markdown
PREFERRED_URL_SCHEME = 'http'
SERVER_NAME = 'localhost:5000'
FLATPAGES_EXTENSION = '.md'
FLATPAGES_HTML_RENDERER = jinja_aware_markdown
FREEZER_IGNORE_404_NOT_FOUND = True
FLATPAGES_AUTO_RELOAD = True
GITHUB_URL = 'https://github.com/JetBrains/kotlin'
TWITTER_URL ... | apache-2.0 | Python |
9a40bd0d82c5215a8978a7d1c95f2910ee8f7f09 | add UserToken model | CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend | api/models.py | api/models.py | from django.db import models
from django.db.models import Q
from django.utils import timezone
from django.contrib.auth.models import User
class MaintenanceRecord(models.Model):
start_date = models.DateTimeField()
end_date = models.DateTimeField(blank=True, null=True)
title = models.CharField(max_length=25... | from django.db import models
from django.db.models import Q
from django.utils import timezone
class MaintenanceRecord(models.Model):
start_date = models.DateTimeField()
end_date = models.DateTimeField(blank=True, null=True)
title = models.CharField(max_length=256)
message = models.TextField()
disa... | apache-2.0 | Python |
379068d31623662c0b349f26d1cd610612963b82 | add re module to be more reliable | ttlbyte/scripts,ttlbyte/scripts | joinstsfile.py | joinstsfile.py | #!/usr/bin/env python3
import os, re
path=r'/home/ruan/git/stm/'
namespace={}
data=[]
for file in os.listdir(path):
if re.match('A\d{6}\.\d{6}\.L\d{4}\.VERT',file): namespace[int(file.split('.')[2][2:])]=file
keys=sorted([x for x in namespace.keys()])
with open(os.path.join(path,namespace[keys[0]]),'rb') as fo:
... | #!/usr/bin/env python3
import os
path='/home/ruan/git/stm/'
#path为文件所在目录,windows下如‘D:\\data\\’,直接覆盖源文件,请注意保存原始数据
for file in os.listdir(path):
os.rename(os.path.join(path,file),os.path.join(path,file.split('.')[2][2:]))
filenu = len(os.listdir(path)) + 1
data=[]
with open(os.path.join(path,'001'),'rb') as fo:
f... | mit | Python |
85d5712fa1dde952783cbc8d78f904e08cfc9b50 | Remove duplicated dependency | trailofbits/manticore,trailofbits/manticore,trailofbits/manticore | server/setup.py | server/setup.py | from pathlib import Path
from setuptools import Command, find_packages, setup
class GenerateCommand(Command):
description = "generates manticore_server server protobuf + grpc code from protobuf specification file"
user_options = []
def initialize_options(self):
pass
def finalize_options(sel... | from pathlib import Path
from setuptools import Command, find_packages, setup
class GenerateCommand(Command):
description = "generates manticore_server server protobuf + grpc code from protobuf specification file"
user_options = []
def initialize_options(self):
pass
def finalize_options(sel... | agpl-3.0 | Python |
ba43de958266a2906f3ee4cad23b20361db2637a | Add arguments to job | indodutch/sim-city-client,indodutch/sim-city-client,NLeSC/sim-city-client,NLeSC/sim-city-client | scripts/submitJob.py | scripts/submitJob.py | #!/usr/bin/env python
# SIM-CITY client
#
# Copyright 2015 Netherlands eScience Center
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | #!/usr/bin/env python
# SIM-CITY client
#
# Copyright 2015 Netherlands eScience Center
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | apache-2.0 | Python |
8d56a45d0b01dff3e8cd041e7ba09c882d7cbb30 | add logging to file and stdout | google/llvm-premerge-checks,google/llvm-premerge-checks | phabricator-proxy/main.py | phabricator-proxy/main.py | from cmath import log
from flask.logging import default_handler
from urllib.parse import urlparse, parse_qs
import flask
import json
import logging
import logging.handlers
import os
import requests
buildkite_api_token = os.getenv("BUILDKITE_API_TOKEN", "")
app = flask.Flask(__name__)
app.config["DEBUG"] = False
form... | import flask
import requests
import os
from urllib.parse import urlparse, parse_qs
import json
app = flask.Flask(__name__)
app.config["DEBUG"] = False
buildkite_api_token = os.getenv("BUILDKITE_API_TOKEN", "")
@app.route('/', methods=['GET'])
def home():
return "Hi LLVM!"
@app.route('/build', methods=['POST', ... | apache-2.0 | Python |
c90dbc5007b5627b264493c2d16af79cff9c2af0 | Add better custom has_permission check. | MJB47/Jokusoramame,MJB47/Jokusoramame,MJB47/Jokusoramame | joku/checks.py | joku/checks.py | """
Specific checks.
"""
from discord.ext.commands import CheckFailure, check
def is_owner(ctx):
if not ctx.bot.owner_id == ctx.message.author.id:
raise CheckFailure(message="You are not the owner.")
return True
def has_permissions(**perms):
def predicate(ctx):
if ctx.bot.owner_id == ctx... | """
Specific checks.
"""
from discord.ext.commands import CheckFailure
def is_owner(ctx):
if not ctx.bot.owner_id == ctx.message.author.id:
raise CheckFailure(message="You are not the owner.")
return True
| mit | Python |
f9a827b41ed925e22bf1e873e5989bdd327fabbf | Add RefugeeCamp name formatting | HStg2015/backend | api/models.py | api/models.py | from django.db import models
class RefugeeCamp(models.Model):
# Location
city = models.CharField(max_length=64)
postcode = models.CharField(max_length=16)
street = models.CharField(max_length=128)
streetnumber = models.CharField(max_length=32)
def __str__(self):
return "{0} {1}: {2} {3... | from django.db import models
class RefugeeCamp(models.Model):
# Location
city = models.CharField(max_length=64)
postcode = models.CharField(max_length=16)
street = models.CharField(max_length=128)
streetnumber = models.CharField(max_length=32)
class ObjectCategory(models.Model):
title = models... | mit | Python |
ee1f958cb3611ecc3af0329deda7fde5d5281c32 | remove obsolete model creation | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | core/models/__init__.py | core/models/__init__.py | # -*- coding: utf-8 -*-
# flake8: noqa
"""
Collection of models
"""
from core.models.allocation_strategy import Allocation, AllocationStrategy
from core.models.application import Application, ApplicationMembership,\
ApplicationScore, ApplicationBookmark
from core.models.application_tag import ApplicationTag
from co... | from core.models.allocation_strategy import Allocation, AllocationStrategy
from core.models.application import Application, ApplicationMembership,\
ApplicationScore, ApplicationBookmark
from core.models.application_tag import ApplicationTag
from core.models.application_version import ApplicationVersion, Application... | apache-2.0 | Python |
1b2f0be67a8372a652b786c8b183cd5edf1807cd | Swap back to Fuzzer, no monkey patching | jmiserez/sts,jmiserez/sts,ucb-sts/sts,ucb-sts/sts | config/fuzz_pox_mesh.py | config/fuzz_pox_mesh.py | from experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import Fuzzer, Interactive
from sts.input_traces.input_logger import InputLogger
from sts.invariant_checker import InvariantChecker
from sts.simulation_state import SimulationConfig
# Use POX as our controlle... | from experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.invariant_checker import InvariantChecker
from sts.simulation_state import SimulationConfig
# Use POX as our controller
command_lin... | apache-2.0 | Python |
d0ca9aa6cf39c4743e398f65e4c7f5bbc3c03d78 | Clarify API sample | nabla-c0d3/sslyze | api_sample.py | api_sample.py |
# Add ./lib to the path for importing nassl
import os
import sys
sys.path.insert(1, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))
from sslyze.plugins_finder import PluginsFinder
from sslyze.plugins_process_pool import PluginsProcessPool
from sslyze.server_connectivity import ServerConnectivityInfo,... |
# Add ./lib to the path for importing nassl
import os
import sys
sys.path.insert(1, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))
from sslyze.plugins_finder import PluginsFinder
from sslyze.plugins_process_pool import PluginsProcessPool
from sslyze.server_connectivity import ServerConnectivityInfo,... | agpl-3.0 | Python |
a57e38233679bf6d95dad533d87ce1c69c00cc26 | Include process name | aknuds1/docker-memusage | docker-memusage.py | docker-memusage.py | #!/usr/bin/env python
from collections import OrderedDict
import os.path
import re
def parse_mem_file(filename):
data = OrderedDict()
with open(filename, 'rb') as f:
for line in f:
splittage = line.split(':')
data[splittage[0]] = splittage[1].strip()
return data
def get_s... | #!/usr/bin/env python
from collections import OrderedDict
from pprint import pprint
import os.path
import re
import sys
def parse_mem_file(filename):
data = OrderedDict()
with open(filename, 'rb') as f:
for line in f:
splittage = line.split(':')
data[splittage[0]] = splittage[1... | mit | Python |
57b707b7f7e7076f8c1f84e57ba3a3db45135340 | Fix compilations for macos mountain lion | avail/protobuf-int64,JacksonTian/protobuf,JacksonTian/protobuf,avail/protobuf-int64,avail/protobuf-int64,avail/protobuf-int64,pzduniak/protobuf-int64,XadillaX/protobuf,chrisdew/protobuf,XadillaX/protobuf,chrisdew/protobuf,chrisdew/protobuf,pzduniak/protobuf-int64,pzduniak/protobuf-int64,XadillaX/protobuf,JacksonTian/pr... | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "protobuf_for_node",
"include_dirs": ["protobuf/src"],
"dependencies": ["protobuf/protobuf.gyp:protobuf_full_do_not_use"],
"sources": [
"protobuf_for_node.cc", "addon.cc"
],
'conditions': [
[
'OS =="mac"',{
'xcode_settings':{
'OTHER_CFLAGS'... | {
"targets": [
{
"target_name": "protobuf_for_node",
"include_dirs": ["protobuf/src"],
"dependencies": ["protobuf/protobuf.gyp:protobuf_full_do_not_use"],
"sources": [
"protobuf_for_node.cc", "addon.cc"
]
}
]
}
| apache-2.0 | Python |
644fbef7030f0685be7dd056606ab23daaefdc72 | Fix typo in error message variable | pipex/gitbot,pipex/gitbot,pipex/gitbot | app/gitlab.py | app/gitlab.py | from __future__ import absolute_import
from __future__ import unicode_literals
from .webhooks import WebHook
from werkzeug.exceptions import BadRequest, NotImplemented
EVENTS = {
'Push Hook': 'push',
'Tag Push Hook': 'tag_push',
'Issue Hook': 'issue',
'Note Hook': 'note',
'Merge Request Hook': 'me... | from __future__ import absolute_import
from __future__ import unicode_literals
from .webhooks import WebHook
from werkzeug.exceptions import BadRequest, NotImplemented
EVENTS = {
'Push Hook': 'push',
'Tag Push Hook': 'tag_push',
'Issue Hook': 'issue',
'Note Hook': 'note',
'Merge Request Hook': 'me... | apache-2.0 | Python |
893b9947ef8d884ff67c84a60ea2c251b408a6d0 | update build_db.py script | Mause/TransperthCached,Mause/TransperthCached,Mause/TransperthCached | build_db.py | build_db.py | import json
import os
import sqlite3
WEEKDAYS = 0x1
SATURDAY = 0x2
SUNDAY = 0x3
def setup(conn):
cursor = conn.cursor()
cursor.execute(
'''
CREATE TABLE IF NOT EXISTS visit
(
stop_num text,
visit_day_type integer,
route_num integer,
ho... | import json
import os
import sqlite3
WEEKDAYS = 0x1
SATURDAY = 0x2
SUNDAY = 0x3
def setup(conn):
cursor = conn.cursor()
cursor.execute(
'''
CREATE TABLE IF NOT EXISTS visit
(
stop_num text,
visit_day_type integer,
route_num integer,
ho... | apache-2.0 | Python |
7f01aa6deaa9a13ca388fb4c84849bce53d34d5f | Make sure C++11 is used under Mac OS | ozra/mmap-io,ozra/mmap-io,ozra/mmap-io,ozra/mmap-io,ozra/mmap-io | binding.gyp | binding.gyp | {
"targets": [{
"target_name": "mmap-io",
"sources": [ "src/mmap-io.cc" ],
"include_dirs": [
"<!(node -e \"require('nan')\")"
],
"cflags_cc": [
"-std=c++11"
],
"conditions": [
[ 'OS=="mac"',
{ "xcode_settings... | {
"targets": [{
"target_name": "mmap-io",
"sources": [ "src/mmap-io.cc" ],
"include_dirs": [
"<!(node -e \"require('nan')\")"
],
"cflags_cc": [
"-std=c++11"
]
}]
}
| mit | Python |
6b6948b4dcf7400eefcfb2a499c0180d03052550 | Remove unnecessary string formatting | sampadsaha5/sympy,jaimahajan1997/sympy,sampadsaha5/sympy,skidzo/sympy,jaimahajan1997/sympy,jaimahajan1997/sympy,souravsingh/sympy,sampadsaha5/sympy,souravsingh/sympy,chaffra/sympy,skidzo/sympy,aktech/sympy,drufat/sympy,postvakje/sympy,yashsharan/sympy,yashsharan/sympy,aktech/sympy,madan96/sympy,drufat/sympy,madan96/sym... | sympy/matrices/expressions/dotproduct.py | sympy/matrices/expressions/dotproduct.py | from __future__ import print_function, division
from sympy.core import Basic
from sympy.core.sympify import _sympify
from sympy.matrices.expressions.transpose import transpose
from sympy.matrices.expressions.matexpr import MatrixExpr
class DotProduct(MatrixExpr):
"""
Dot Product of vector matrices
""... | from __future__ import print_function, division
from sympy.core import Basic
from sympy.core.sympify import _sympify
from sympy.matrices.expressions.transpose import transpose
from sympy.matrices.expressions.matexpr import MatrixExpr
class DotProduct(MatrixExpr):
"""
Dot Product of vector matrices
""... | bsd-3-clause | Python |
5e2ef9885a65d61edcdffaef9e4f8a960bef567e | Refactor CAS tests. | jgosmann/fridge,jgosmann/fridge | fridge/test/test_cas.py | fridge/test/test_cas.py | import pytest
from fridge.cas import ContentAddressableStorage
from fridge.fstest import (
assert_file_content_equal, assert_open_raises, write_file)
from fridge.memoryfs import MemoryFS
@pytest.fixture
def fs():
return MemoryFS()
@pytest.fixture
def cas(fs):
return ContentAddressableStorage('cas', fs)... | import pytest
from fridge.cas import ContentAddressableStorage
from fridge.memoryfs import MemoryFS
class TestContentAddressableStorage(object):
def create_cas(self, fs=None, path='cas'):
if fs is None:
fs = MemoryFS()
return ContentAddressableStorage(path, fs)
def has_root_prope... | mit | Python |
167101baa4d57d22bc6a40d7ff8afd3688e23580 | fix ControlText focusout bug | UmSenhorQualquer/pyforms | pyforms/gui/Controls/ControlText.py | pyforms/gui/Controls/ControlText.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@author: Ricardo Ribeiro
@credits: Ricardo Ribeiro
@license: MIT
@version: 0.0
@maintainer: Ricardo Ribeiro
@email: ricardojvr@gmail.com
@status: Development
@lastEditedBy: Carlos Mão de Ferro (carlos.maodeferro@neuro.fchampalimaud.org)
'''
from pyforms.gui.Controls.Contro... | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@author: Ricardo Ribeiro
@credits: Ricardo Ribeiro
@license: MIT
@version: 0.0
@maintainer: Ricardo Ribeiro
@email: ricardojvr@gmail.com
@status: Development
@lastEditedBy: Carlos Mão de Ferro (carlos.maodeferro@neuro.fchampalimaud.org)
'''
from pyforms.gui.Controls.Contro... | mit | Python |
22cf663731bc556ef625695ab3213e87432ed4f9 | fix docs link | angr/pyvex,angr/pyvex | pyvex/__init__.py | pyvex/__init__.py | """
PyVEX provides an interface that translates binary code into the VEX intermediate represenation (IR).
For an introduction to VEX, take a look here: https://docs.angr.io/advanced-topics/ir
"""
__version__ = (8, 19, 4, 5)
if bytes is str:
raise Exception("This module is designed for python 3 only. Please instal... | """
PyVEX provides an interface that translates binary code into the VEX intermediate represenation (IR).
For an introduction to VEX, take a look here: https://docs.angr.io/docs/ir.html
"""
__version__ = (8, 19, 4, 5)
if bytes is str:
raise Exception("This module is designed for python 3 only. Please install an o... | bsd-2-clause | Python |
73b66a32763b7efe36612db7f3a3b4566d8e44a2 | set uid=197610(OIdiot) gid=197610 groups=197610 as primary_key instead of | OIdiotLin/ClassManager-backends | app/models.py | app/models.py | from django.db import models
# Create your models here.
class Person(models.Model):
id = models.AutoField(verbose_name = '索引', primary_key = True, unique = True)
student_number = models.CharField(verbose_name = '学号', max_length = 12, unique = True)
name = models.CharField(verbose_name = '姓名', max_length = 10)
pi... | from django.db import models
# Create your models here.
class Person(models.Model):
student_number = models.CharField(verbose_name = '学号', max_length = 12, unique = True, primary_key = True)
name = models.CharField(verbose_name = '姓名', max_length = 10)
pinyin = models.CharField(verbose_name = '拼音', max_length = 2... | mit | Python |
c908db488f3e1d7aab0993780b38baaf4c995eb1 | add docstrings | googlefonts/fontelemetry,googlefonts/fontelemetry | Lib/fontelemetry/datastructures/source.py | Lib/fontelemetry/datastructures/source.py | # Copyright 2019 Fontelemetry Authors and Contributors
# 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... | # Copyright 2019 Fontelemetry Authors and Contributors
# 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... | apache-2.0 | Python |
0e913b3fc20e69a6ff77bafcc144e00175f8ed83 | Put new classes to submodule level import | bgyori/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/belpy,bgyori/indra,sorgerlab/belpy,johnbachman/belpy,sorgerlab/indra,sorgerlab/belpy,bgyori/indra,johnbachman/indra,johnbachman/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/indra | indra/assemblers/english/__init__.py | indra/assemblers/english/__init__.py | from .assembler import EnglishAssembler, AgentWithCoordinates, SentenceBuilder
| from .assembler import EnglishAssembler
| bsd-2-clause | Python |
f6f3073322684beaf49b6fd88f766502b98ee889 | reduce unused imports | PookMook/Scripts,PookMook/Scripts | bibparse.py | bibparse.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, bibtexparser
from bibtexparser.bwriter import BibTexWriter
folder=sys.argv[1] if len(sys.argv) > 1 else "bib"
if os.path.exists(folder+'-clean'):
print 'cleaning '+folder+'-clean/'
for file in os.listdir(folder+'-clean'):
try:
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, bibtexparser
from bibtexparser.bparser import BibTexParser
from bibtexparser.bwriter import BibTexWriter
folder=sys.argv[1] if len(sys.argv) > 1 else "bib"
if os.path.exists(folder+'-clean'):
print 'cleaning '+folder+'-clean/'
for file in os.listd... | mit | Python |
36608c6bd0035e4a78da2cd30d9fcca2c660ec3a | Add prepare in rpc client | redhat-cip/numeter,enovance/numeter,enovance/numeter,redhat-cip/numeter,redhat-cip/numeter,redhat-cip/numeter,enovance/numeter,enovance/numeter | common/numeter/queue/client.py | common/numeter/queue/client.py | from oslo import messaging
from oslo.config import cfg
import logging
LOG = logging.getLogger(__name__)
class BaseAPIClient(messaging.RPCClient):
def __init__(self, transport):
target = messaging.Target(topic='default_topic')
super(BaseAPIClient, self).__init__(transport, target)
def ping(sel... | from oslo import messaging
from oslo.config import cfg
import logging
LOG = logging.getLogger(__name__)
class BaseAPIClient(messaging.RPCClient):
def __init__(self, transport):
target = messaging.Target(topic='default_topic')
super(BaseAPIClient, self).__init__(transport, target)
def ping(sel... | agpl-3.0 | Python |
34a811429e2025f396f8997aeb628253487537fb | Change Sparser call pattern along with actual exec | pvtodorov/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/belpy,sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,bgyori/indra,johnbachman/indra,bgyori/indra,johnbachman/belpy,pvtodorov/indra,sorgerlab/indra | indra/sources/sparser/sparser_api.py | indra/sources/sparser/sparser_api.py | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import json
import logging
import subprocess
import xml.etree.ElementTree as ET
from indra.util import UnicodeXMLTreeBuilder as UTB
from .processor import SparserXMLProcessor, SparserJSONProcessor
logger =... | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import logging
import subprocess
import xml.etree.ElementTree as ET
from indra.util import UnicodeXMLTreeBuilder as UTB
from .processor import SparserProcessor
logger = logging.getLogger('sparser')
sparse... | bsd-2-clause | Python |
a9365aa4a32fbe358a6f74b5730a7a3a0a8b3cda | Convert journal to pickled extra | pianohacker/qualia | qualia/journal.py | qualia/journal.py | import base64
import datetime
import pickle
import sqlite3
class Journal:
def __init__(self, filename):
self.db = sqlite3.connect(
filename,
detect_types = sqlite3.PARSE_DECLTYPES
)
self.upgrade_if_needed()
self.f = open(filename, 'ab')
def upgrade_if_needed(self):
version = self.db.execute('PRAGMA ... | import datetime
import sqlite3
class Journal:
def __init__(self, filename):
self.db = sqlite3.connect(
filename,
detect_types = sqlite3.PARSE_DECLTYPES
)
self.upgrade_if_needed()
self.f = open(filename, 'ab')
def upgrade_if_needed(self):
version = self.db.execute('PRAGMA user_version').fetchone()[0]... | mpl-2.0 | Python |
ce6e67890b5860d89e9c3ea6628a7a94ad9e10b3 | Update Default_Settings.py | jossthomas/Enigma-Machine | components/Default_Settings.py | components/Default_Settings.py | #Sequences of actual rotors used in WWII, format is name, sequences, turnover notch(es)
rotor_sequences = {
'I': ('EKMFLGDQVZNTOWYHXUSPAIBRCJ', ('Q')),
'II': ('AJDKSIRUXBLHWTMCQGZNPYFVOE', ('E')),
'III': ('BDFHJLCPRTXVZNYEIWGAKMUSQO', ('V')),
'IV': ('ESOVPZJAYQUIRHXLNFTGKDCMWB', ('J')),
'V': ('VZ... | #Sequences of actual rotors used in WWII, format is name, sequences, turnover notch(es)
rotor_sequences = {
'I': ('EKMFLGDQVZNTOWYHXUSPAIBRCJ', ('Q')),
'II': ('AJDKSIRUXBLHWTMCQGZNPYFVOE', ('E')),
'III': ('BDFHJLCPRTXVZNYEIWGAKMUSQO', ('V')),
'IV': ('ESOVPZJAYQUIRHXLNFTGKDCMWB', ('J')),
'V': ('VZ... | mit | Python |
64bd44d4338d57a68ff07527d1d2c3b37960c63b | call parent filter, cleanup | masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api | web/impact/impact/v1/views/mentor_program_office_hour_list_view.py | web/impact/impact/v1/views/mentor_program_office_hour_list_view.py | # MIT License
# Copyright (c) 2019 MassChallenge, Inc.
from django.db.models import Value as V
from django.db.models.functions import Concat
from impact.v1.views.base_list_view import BaseListView
from impact.v1.helpers import (
MentorProgramOfficeHourHelper,
)
ID_FIELDS = ['mentor_id', 'finalist_id']
NAME_FIELDS... | # MIT License
# Copyright (c) 2019 MassChallenge, Inc.
from django.db.models import Value as V
from django.db.models.functions import Concat
from impact.v1.views.base_list_view import BaseListView
from impact.v1.helpers import (
MentorProgramOfficeHourHelper,
)
ID_FIELDS = ['mentor_id', 'finalist_id']
NAME_FIELDS... | mit | Python |
abb00ac993154071776488b5dcaef32cc2982f4c | Fix broken functional tests on windows | josephharrington/ClusterRunner,box/ClusterRunner,josephharrington/ClusterRunner,nickzuber/ClusterRunner,Medium/ClusterRunner,nickzuber/ClusterRunner,box/ClusterRunner,Medium/ClusterRunner | test/functional/master/test_endpoints.py | test/functional/master/test_endpoints.py | import os
import tempfile
import yaml
from test.framework.functional.base_functional_test_case import BaseFunctionalTestCase
from test.functional.job_configs import BASIC_JOB
class TestMasterEndpoints(BaseFunctionalTestCase):
def setUp(self):
super().setUp()
self._project_dir = tempfile.Tempora... | import os
import yaml
from test.framework.functional.base_functional_test_case import BaseFunctionalTestCase
from test.functional.job_configs import BASIC_JOB
class TestMasterEndpoints(BaseFunctionalTestCase):
def _start_master_only_and_post_a_new_job(self):
master = self.cluster.start_master()
... | apache-2.0 | Python |
8d4c7c94dba6708758732d74228e1337bd9f0b83 | raise version number | trichter/yam | yam/__init__.py | yam/__init__.py | __version__ = '0.2.2-dev'
from yam.main import run
from yam.commands import read_dicts | __version__ = '0.2.1'
from yam.main import run
from yam.commands import read_dicts | mit | Python |
71d0f02e1274829a302cdd6f716f2fc0680cce49 | Update fab.py | ArabellaTech/ydcommon,ArabellaTech/ydcommon,ArabellaTech/ydcommon | ydcommon/fab.py | ydcommon/fab.py | from fabric.api import local, sudo, run
from fabric.operations import prompt
from fabric.colors import red
from fabric.contrib.console import confirm
def get_branch_name(on_local=True):
cmd = "git branch --no-color 2> /dev/null | sed -e '/^[^*]/d'"
if on_local:
name = local(cmd, capture=True).replace(... | from fabric.api import local, sudo, run
from fabric.operations import prompt
from fabric.colors import red
from fabric.contrib.console import confirm
def get_branch_name(on_local=True):
cmd = "git branch --no-color 2> /dev/null | sed -e '/^[^*]/d'"
if on_local:
name = local(cmd, capture=True).replace(... | mit | Python |
95aa4c210c735bd9ac74a65cdbef418d99beb319 | Bump to v0.2.0 | gisce/sii | sii/__init__.py | sii/__init__.py | # -*- coding: utf-8 -*-
__LIBRARY_VERSION__ = '0.2.0'
__SII_VERSION__ = '0.7'
| # -*- coding: utf-8 -*-
__LIBRARY_VERSION__ = '0.1.0alpha'
__SII_VERSION__ = '0.7'
| mit | Python |
510e04dfd68eeca2e940487eeca9e7474e7f2383 | Fix methodcheck.py for the new API documentation style (split into subsections) | tjfontaine/linode-python,ryanshawty/linode-python | linode/methodcheck.py | linode/methodcheck.py | #!/usr/bin/python
"""
A quick script to verify that api.py is in sync with Linode's
published list of methods.
Copyright (c) 2010 Josh Wright <jshwright@gmail.com>
Copyright (c) 2009 Ryan Tucker <rtucker@gmail.com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and assoc... | #!/usr/bin/python
"""
A quick script to verify that api.py is in sync with Linode's
published list of methods.
Copyright (c) 2010 Josh Wright <jshwright@gmail.com>
Copyright (c) 2009 Ryan Tucker <rtucker@gmail.com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and assoc... | mit | Python |
e0521c1f9a12819fd89f12aed01c623628dc4c4d | Build options added. | JDevlieghere/InTeXration,JDevlieghere/InTeXration | intexration/propertyhandler.py | intexration/propertyhandler.py | import configparser
import os
class Build:
def __init__(self, name, idx, bib):
self._name = name
self._idx = idx
self._bib = bib
def get_name(self):
return self._name
def get_idx(self):
return self._idx
def get_bib(self):
return self._bib
def get... | import configparser
import os
class Build:
def __init__(self, name, idx, bib):
self._name = name
self._idx = idx
self._bib = bib
def get_name(self):
return self._name
def get_idx(self):
return self._idx
def get_bib(self):
return self._bib
def get... | apache-2.0 | Python |
f27dc9d2793bb555d80a5c8e6635ba246278d017 | Add DES support | boppreh/simplecrypto | simplecrypto.py | simplecrypto.py | import hashlib
import math
from base64 import b64encode, b64decode
from Crypto.Cipher import DES, AES
from Crypto import Random
random_instance = Random.new()
algorithms = {'aes': AES, 'des': DES}
def sha1(message):
return hashlib.sha1(message).hexdigest()
def md5(message):
return hashlib.md5(message).hexdi... | import hashlib
import math
import base64
from Crypto.Cipher import DES, AES
from Crypto import Random
random_instance = Random.new()
algorithms = {'aes': AES, 'des': DES}
def sha1(message):
return hashlib.sha1(message).hexdigest()
def md5(message):
return hashlib.md5(message).hexdigest()
def sha256(message... | mit | Python |
1bd814df2c5175ac7745b2d58fbe6b82c5a941ae | add 'debug' hack | jmiserez/sts,jmiserez/sts,ucb-sts/sts,ucb-sts/sts | sts/util/console.py | sts/util/console.py | BEGIN = '\033[1;'
END = '\033[1;m'
class color(object):
GRAY, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, CRIMSON = map(lambda num : BEGIN + str(num) + "m", range(30, 39))
B_GRAY, B_RED, B_GREEN, B_YELLOW, B_BLUE, B_MAGENTA, B_CYAN, B_WHITE, B_CRIMSON = map(lambda num: BEGIN + str(num) + "m", range(40, 49))
... | BEGIN = '\033[1;'
END = '\033[1;m'
class color(object):
GRAY, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, CRIMSON = map(lambda num : BEGIN + str(num) + "m", range(30, 39))
B_GRAY, B_RED, B_GREEN, B_YELLOW, B_BLUE, B_MAGENTA, B_CYAN, B_WHITE, B_CRIMSON = map(lambda num: BEGIN + str(num) + "m", range(40, 49))
... | apache-2.0 | Python |
4987412578744db64984cb40841994b3852287f7 | update evalrunner | selentd/pythontools | pytools/src/IndexEval/evalrunner.py | pytools/src/IndexEval/evalrunner.py | '''
Created on 04.11.2015
@author: selen00r
'''
import datetime
from pymongo.mongo_client import MongoClient
import evalresult
class EvalRunner(object):
'''
Base class to run an evaluation of an index.
'''
def __init__(self):
'''
Constructor
'''
... | '''
Created on 04.11.2015
@author: selen00r
'''
import datetime
from pymongo.mongo_client import MongoClient
import evalresult
class EvalRunner(object):
'''
Base class to run an evaluation of an index.
'''
def __init__(self):
'''
Constructor
'''
... | apache-2.0 | Python |
5ba73b9dd92b55b3f02f76ae981e53744abac750 | Add an option to time SQL statements | jeffweeksio/sir | sir/__main__.py | sir/__main__.py | # Copyright (c) 2014 Wieland Hoffmann
# License: MIT, see LICENSE for details
import argparse
import logging
import multiprocessing
from . import config
from .indexing import reindex
from .schema import SCHEMA
from sqlalchemy import exc as sa_exc
logger = logging.getLogger("sir")
def watch(args):
raise NotImp... | # Copyright (c) 2014 Wieland Hoffmann
# License: MIT, see LICENSE for details
import argparse
import logging
import multiprocessing
from . import config
from .indexing import reindex
from .schema import SCHEMA
from sqlalchemy import exc as sa_exc
logger = logging.getLogger("sir")
def watch(args):
raise NotImp... | mit | Python |
dde133a9ae751ce3caab8e8896c1e04e48c0cc1e | fix typo | adamrp/qiita,adamrp/qiita,RNAer/qiita,josenavas/QiiTa,biocore/qiita,ElDeveloper/qiita,adamrp/qiita,squirrelo/qiita,adamrp/qiita,antgonza/qiita,ElDeveloper/qiita,RNAer/qiita,antgonza/qiita,josenavas/QiiTa,josenavas/QiiTa,biocore/qiita,RNAer/qiita,josenavas/QiiTa,squirrelo/qiita,squirrelo/qiita,wasade/qiita,biocore/qiita... | qiita_pet/handlers/base_handlers.py | qiita_pet/handlers/base_handlers.py | from tornado.web import RequestHandler
class BaseHandler(RequestHandler):
def get_current_user(self):
'''Overrides default method of returning user curently connected'''
user = self.get_secure_cookie("user")
if user is None:
self.clear_cookie("user")
return None
... | from tornado.web import RequestHandler
class BaseHandler(RequestHandler):
def get_current_user(self):
'''Overrides default method of returning user curently connected'''
user = self.get_secure_cookie("user")
if user is None:
self.clear_cookie("user")
return None
... | bsd-3-clause | Python |
f0f3a7ab0b285f447f0573ff537e6252a8752528 | Use pkg-build in binding.gyp | blackbeam/tiff-multipage,blackbeam/tiff-multipage,blackbeam/tiff-multipage,blackbeam/tiff-multipage | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "tiff-multipage",
"sources": [
"src/module.cc",
"src/sync.cc",
"src/async.cc",
"src/tiff_multipage.cc"
],
"include_dirs": [
"<!(node -e \"require('n... | {
"targets": [
{
"target_name": "tiff-multipage",
"sources": [
"src/module.cc",
"src/sync.cc",
"src/async.cc",
"src/tiff_multipage.cc"
],
"include_dirs": ["<!(node -e \"require('nan')\")"],
... | mit | Python |
c34f040ba19c27277d6cc9a1ad46e4c8d668e77b | Apply -DNDEBUG globally on release builds | ranisalt/node-argon2,ranisalt/node-argon2,ranisalt/node-argon2 | binding.gyp | binding.gyp | {
"target_defaults": {
"target_conditions": [
["OS != 'win'", {
"cflags": ["-fdata-sections", "-ffunction-sections", "-fvisibility=hidden"],
"ldflags": ["-Wl,--gc-sections"]
}],
["OS == 'mac'", {
"xcode_settings": {
"MACOSX_DEPLOYMENT_TARGET": "10.9",
}
... | {
"target_defaults": {
"target_conditions": [
["OS != 'win'", {
"cflags": ["-fdata-sections", "-ffunction-sections", "-fvisibility=hidden"],
"ldflags": ["-Wl,--gc-sections"]
}],
["OS == 'mac'", {
"xcode_settings": {
"MACOSX_DEPLOYMENT_TARGET": "10.9",
}
... | mit | Python |
b0dea361dfb27e537c0165dac69e71c20f33e883 | Add helpers to bindings.gyp | musocrat/jsaudio,JsAudioOrg/jsaudio,musocrat/jsaudio,JsAudioOrg/jsaudio,JsAudioOrg/jsaudio,musocrat/jsaudio,JsAudioOrg/jsaudio | binding.gyp | binding.gyp | {
'targets': [
{
'target_name': 'jsaudio',
'sources': ['src/jsaudio.cc', 'src/helpers.cc'],
'include_dirs': [
'<!(node -e "require(\'nan\')")',
'<(module_root_dir)/vendor/'
],
"conditions": [
[
'OS=="win"', {
"conditions": [
[
'target... | {
'targets': [
{
'target_name': 'jsaudio',
'sources': ['src/jsaudio.cc'],
'include_dirs': [
'<!(node -e "require(\'nan\')")',
'<(module_root_dir)/vendor/'
],
"conditions": [
[
'OS=="win"', {
"conditions": [
[
'target_arch=="ia32"', {
... | mit | Python |
7e5cafed3908f829bb8ff334a7d8f6ebb939a7cc | fix test import for python3 | Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService | d4s2_api/dukeds_auth.py | d4s2_api/dukeds_auth.py | from gcb_web_auth.dukeds_auth import DukeDSTokenAuthentication
from gcb_web_auth.backends.dukeds import DukeDSAuthBackend
from gcb_web_auth.backends.base import BaseBackend
from .models import DukeDSUser
class D4S2DukeDSTokenAuthentication(DukeDSTokenAuthentication):
"""
Extends authorization to save users to... | from gcb_web_auth.dukeds_auth import DukeDSTokenAuthentication
from gcb_web_auth.backends.dukeds import DukeDSAuthBackend
from gcb_web_auth.backends.base import BaseBackend
from models import DukeDSUser
class D4S2DukeDSTokenAuthentication(DukeDSTokenAuthentication):
"""
Extends authorization to save users to ... | mit | Python |
7c788c868323aa8c6237caab208d726c5cce24ac | address first time new user condition where user_id may be none | mozilla-iam/cis,mozilla-iam/cis | cis/user.py | cis/user.py | """First class object to represent a user and data about that user."""
import logging
from cis.settings import get_config
logger = logging.getLogger(__name__)
class Profile(object):
def __init__(self, boto_session=None, profile_data=None):
"""
:param boto_session: The boto session object from t... | """First class object to represent a user and data about that user."""
import logging
from cis.settings import get_config
logger = logging.getLogger(__name__)
class Profile(object):
def __init__(self, boto_session=None, profile_data=None):
"""
:param boto_session: The boto session object from t... | mpl-2.0 | Python |
81833470d1eb831e27e9e34712b983efbc38a735 | Convert entire table to cartesian | mikeireland/chronostar,mikeireland/chronostar,mikeireland/chronostar,mikeireland/chronostar | solar_neighbourhood/prepare_data_add_kinematics.py | solar_neighbourhood/prepare_data_add_kinematics.py | """
Add very large RV errors for stars with no known RVs.
Convert to cartesian.
"""
import numpy as np
import sys
sys.path.insert(0, '..')
from chronostar import tabletool
from astropy.table import Table
datafile = Table.read('../data/ScoCen_box_result.fits')
d = Table.read(datafile)
# Set missing radial velocities ... | """
Add very large RV errors for stars with no known RVs.
Convert to cartesian.
"""
import numpy as np
import sys
sys.path.insert(0, '..')
from chronostar import tabletool
from astropy.table import Table
datafile = Table.read('../data/ScoCen_box_result.fits')
d = tabletool.read(datafile)
# Set missing radial velocit... | mit | Python |
0700e25b4dce989fcfc6ee367c7516578c8aaf5b | Update heartbeat in idle times | Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | lava_scheduler_daemon/service.py | lava_scheduler_daemon/service.py | # Copyright (C) 2013 Linaro Limited
#
# Author: Senthil Kumaran <senthil.kumaran@linaro.org>
#
# This file is part of LAVA Scheduler.
#
# LAVA Scheduler is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License version 3 as
# published by the Free Software Fou... | # Copyright (C) 2013 Linaro Limited
#
# Author: Senthil Kumaran <senthil.kumaran@linaro.org>
#
# This file is part of LAVA Scheduler.
#
# LAVA Scheduler is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License version 3 as
# published by the Free Software Fou... | agpl-3.0 | Python |
fedb3768539259568555d5a62d503c7995f4b9a2 | Handle orgs that you don’t own personally. | istresearch/readthedocs.org,CedarLogic/readthedocs.org,KamranMackey/readthedocs.org,SteveViss/readthedocs.org,stevepiercy/readthedocs.org,soulshake/readthedocs.org,kenshinthebattosai/readthedocs.org,takluyver/readthedocs.org,cgourlay/readthedocs.org,soulshake/readthedocs.org,attakei/readthedocs-oauth,hach-que/readthedo... | readthedocs/oauth/utils.py | readthedocs/oauth/utils.py | import logging
from .models import GithubProject, GithubOrganization
log = logging.getLogger(__name__)
def make_github_project(user, org, privacy, repo_json):
if (repo_json['private'] is True and privacy == 'private' or
repo_json['private'] is False and privacy == 'public'):
project, created ... | import logging
from .models import GithubProject, GithubOrganization
log = logging.getLogger(__name__)
def make_github_project(user, org, privacy, repo_json):
if (repo_json['private'] is True and privacy == 'private' or
repo_json['private'] is False and privacy == 'public'):
project, created ... | mit | Python |
bc196c74b3959577f7254d1d5434aeb23d284eea | Convert tabs to spaces | WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder,WycliffeAssociates/translationRecorder | RecordingApp/app/src/scripts/getChunks.py | RecordingApp/app/src/scripts/getChunks.py | #Script to generate a json file containing book name, number of chapters, number of chunks
import json
import urllib.request
import re
result_json_name = "chunks.json"
with open("catalog.json") as file:
data = json.load(file)
output = []
#skip obs for now, loop over all books
for x in range(1, 67):
#gives b... | #Script to generate a json file containing book name, number of chapters, number of chunks
import json
import urllib.request
import re
result_json_name = "chunks.json"
with open("catalog.json") as file:
data = json.load(file)
output = []
#skip obs for now, loop over all books
for x in range(1, 67):
#gives book n... | mit | Python |
c96cccbe7afc282aedbb316a2e9e41e47e68bcb6 | fix efs lvm create (#610) | intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre | chroma-manager/tests/integration/utils/test_blockdevices/test_blockdevice_lvm.py | chroma-manager/tests/integration/utils/test_blockdevices/test_blockdevice_lvm.py | # Copyright (c) 2017 Intel Corporation. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
import re
from tests.integration.utils.test_blockdevices.test_blockdevice import TestBlockDevice
class TestBlockDeviceLvm(TestBlockDevice):
_supporte... | # Copyright (c) 2017 Intel Corporation. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
import re
from tests.integration.utils.test_blockdevices.test_blockdevice import TestBlockDevice
class TestBlockDeviceLvm(TestBlockDevice):
_supporte... | mit | Python |
d0e75c65505713a5f044d67a08e6697c4e332611 | Add djangobower and update static settings | be-ndee/darts,be-ndee/darts | darts/darts/settings.py | darts/darts/settings.py | """
Django settings for darts project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | """
Django settings for darts project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | mit | Python |
5273e0fcdf2b7f1b03301cb0834b07da82064b98 | Remove trailing /n | rmed/zoe-vidmaster,rmed/zoe-vidmaster | mailproc/vidmaster.py | mailproc/vidmaster.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Zoe vidmaster - https://github.com/rmed/zoe-vidmaster
#
# Copyright (c) 2015 Rafael Medina García <rafamedgar@gmail.com>
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documen... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Zoe vidmaster - https://github.com/rmed/zoe-vidmaster
#
# Copyright (c) 2015 Rafael Medina García <rafamedgar@gmail.com>
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documen... | mit | Python |
95d9c3ecd9a8c2aa73fd91ffdf40a55fee541dd3 | Enable flatpages without middleware. | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | suorganizer/urls.py | suorganizer/urls.py | """suorganizer URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | """suorganizer URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.