commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
3b77fbb82d2ba098f00f7221070f9610d0d90809
add unknown person
game.py
game.py
import random from adventurelib import Item, Bag, when, start import rooms import characters from sys import exit people = '123456' rooms = 'abcdef' # murder configuration # who was where # who is the murderer # current configuration # who was where # player location murder_config_people = list(people) random....
import random from adventurelib import Item, Bag, when, start import rooms import characters from sys import exit people = '123456' rooms = 'abcdef' # murder configuration # who was where # who is the murderer # current configuration # who was where # player location murder_config_people = list(people) random....
Python
0.999999
55ff20aa2d2504fb85fa2f63cc9b52934245b849
make the subscription also work for new minions, fixes #8
saltobserver/redis_stream.py
saltobserver/redis_stream.py
from saltobserver import app, redis_pool import gevent from redis import Redis from distutils.version import StrictVersion import json import time class RedisStream(object): def __init__(self): self.redis = Redis(connection_pool=redis_pool) actual_version = StrictVersion(self.redis.info()['redi...
from saltobserver import app, redis_pool import gevent from redis import Redis from distutils.version import StrictVersion import json import time class RedisStream(object): def __init__(self): self.redis = Redis(connection_pool=redis_pool) actual_version = StrictVersion(self.redis.info()['redi...
Python
0
144a35d639ccd3a60f100793df00fd62aa81766b
document no trust algo
game.py
game.py
""" Play with trust: for player in game: if current player: send move else: listen for move receive move decide winner Play trusting no one: Swap hashes: for player in game: if current player: send hasher(move + salt) else: listen for hash ...
""" For player in game: if current player: send move else: listen for move receive move decide winner """
Python
0
866e0ec72163debd9f46b1ecb8e4d07b040694b4
Fix absolute import
sand/cytoscape/themes/ops.py
sand/cytoscape/themes/ops.py
from . import colors as c from . import label_positions as p settings = { # node style 'NODE_TRANSPARENCY': 255, 'NODE_SIZE': 25, 'NODE_BORDER_WIDTH': 4, 'NODE_BORDER_PAINT': c.BRIGHT_GREEN, 'NODE_FILL_COLOR': c.DARK_GREEN, 'NODE_SELECTED_PAINT': c.BRIGHT_YELLOW, # node label style ...
import sand.cytoscape.themes.colors as c import sand.cytoscape.themes.label_positions as p settings = { # node style 'NODE_TRANSPARENCY': 255, 'NODE_SIZE': 25, 'NODE_BORDER_WIDTH': 4, 'NODE_BORDER_PAINT': c.BRIGHT_GREEN, 'NODE_FILL_COLOR': c.DARK_GREEN, 'NODE_SELECTED_PAINT': c.BRIGHT_YELL...
Python
0.000173
75635315598ccbcad887bf77f7cdc99772157033
Add construct_data function to construct data for the API
gist.py
gist.py
import os import sys from parser import parser args = parser.parse_args() def process_files(args): """ :param args: The arguments parsed by argparse :returns: A dict containing file_names as keys and a dict containing a key `content` as the value Example return: { ...
import os import sys from parser import parser args = parser.parse_args() def process_files(args): """ :param args: The arguments parsed by argparse :returns: A dict containing file_names as keys and a dict containing a key `content` as the value Example return: { ...
Python
0
8db806d30d7591828528ac937e8f3b334e957ed3
remove shim should by symmetric to add_shim
_distutils_hack/__init__.py
_distutils_hack/__init__.py
import sys import os import re import importlib import warnings is_pypy = '__pypy__' in sys.builtin_module_names def enabled(): """ Allow selection of distutils by environment variable. """ which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') return which == 'local' def warn_distutils_...
import sys import os import re import importlib import warnings is_pypy = '__pypy__' in sys.builtin_module_names def enabled(): """ Allow selection of distutils by environment variable. """ which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') return which == 'local' def warn_distutils_...
Python
0.000001
37ab58016e69993b5ab1d63c99d9afcf54bd95af
Implement more TGT Neutral Epics
fireplace/cards/tgt/neutral_epic.py
fireplace/cards/tgt/neutral_epic.py
from ..utils import * ## # Minions # Twilight Guardian class AT_017: play = HOLDING_DRAGON & Buff(SELF, "AT_017e") # Sideshow Spelleater class AT_098: play = Summon(CONTROLLER, Copy(ENEMY_HERO_POWER)) # Kodorider class AT_099: inspire = Summon(CONTROLLER, "AT_099t") # Master of Ceremonies class AT_117: pla...
from ..utils import * ## # Minions # Kodorider class AT_099: inspire = Summon(CONTROLLER, "AT_099t")
Python
0.000006
dfe1213ba9de5e5e5aaf9690a2cf5e3b295869fa
Remove Python 3 incompatible print statement
examples/graph/degree_sequence.py
examples/graph/degree_sequence.py
#!/usr/bin/env python """ Random graph from given degree sequence. """ __author__ = """Aric Hagberg (hagberg@lanl.gov)""" __date__ = "$Date: 2004-11-03 08:11:09 -0700 (Wed, 03 Nov 2004) $" __credits__ = """""" __revision__ = "$Revision: 503 $" # Copyright (C) 2004 by # Aric Hagberg <hagberg@lanl.gov> # Dan Sc...
#!/usr/bin/env python """ Random graph from given degree sequence. """ __author__ = """Aric Hagberg (hagberg@lanl.gov)""" __date__ = "$Date: 2004-11-03 08:11:09 -0700 (Wed, 03 Nov 2004) $" __credits__ = """""" __revision__ = "$Revision: 503 $" # Copyright (C) 2004 by # Aric Hagberg <hagberg@lanl.gov> # Dan Sc...
Python
0.998568
fcb3d026faf4648bbacc73f84e0e6dd6a25eeb6d
delete plotting function
code/lamost/li_giants/residuals.py
code/lamost/li_giants/residuals.py
""" Calculate residuals """ import numpy as np import matplotlib.pyplot as plt from math import log10, floor from matplotlib import rc import matplotlib.gridspec as gridspec from matplotlib.colors import LogNorm plt.rc('text', usetex=True) from matplotlib.ticker import MaxNLocator import sys sys.path.insert(0, '/home/...
""" Calculate residuals """ import numpy as np import matplotlib.pyplot as plt from math import log10, floor from matplotlib import rc import matplotlib.gridspec as gridspec from matplotlib.colors import LogNorm plt.rc('text', usetex=True) from matplotlib.ticker import MaxNLocator import sys sys.path.insert(0, '/home/...
Python
0.000001
72e30b3b881418d40dd0446842176fc5c4468802
Add name url converter
flask_roots/routing.py
flask_roots/routing.py
from werkzeug.routing import BaseConverter class RegexConverter(BaseConverter): def __init__(self, url_map, *items): super(RegexConverter, self).__init__(url_map) self.regex = items[0] def strip_accents(s): s = unicode(s) return ''.join((c for c in unicodedata.normalize('NFD', s) if unic...
from werkzeug.routing import BaseConverter class RegexConverter(BaseConverter): def __init__(self, url_map, *items): super(RegexConverter, self).__init__(url_map) self.regex = items[0] def setup_routing(app): app.url_map.converters['re'] = RegexConverter
Python
0.000001
42463351a598d45f2738c894e00d0eceec308f9c
Add docstring
aegea/billing.py
aegea/billing.py
""" View detailed billing reports. Detailed billing reports can be configured at https://console.aws.amazon.com/billing/home#/preferences. """ from __future__ import absolute_import, division, print_function, unicode_literals import os, sys, json, zipfile, csv, io from io import BytesIO, TextIOWrapper from datetime ...
""" View detailed billing reports. Detailed billing reports can be configured at https://console.aws.amazon.com/billing/home#/preferences. """ from __future__ import absolute_import, division, print_function, unicode_literals import os, sys, json, zipfile, csv, io from io import BytesIO, TextIOWrapper from datetime ...
Python
0.000005
19025b97d38706eda4f425667b69f7803a39ca35
add tinyint as a bool type
flask_admin/contrib/sqla/filters.py
flask_admin/contrib/sqla/filters.py
import warnings from flask.ext.admin.babel import lazy_gettext from flask.ext.admin.model import filters from flask.ext.admin.contrib.sqla import tools class BaseSQLAFilter(filters.BaseFilter): """ Base SQLAlchemy filter. """ def __init__(self, column, name, options=None, data_type=None): ...
import warnings from flask.ext.admin.babel import lazy_gettext from flask.ext.admin.model import filters from flask.ext.admin.contrib.sqla import tools class BaseSQLAFilter(filters.BaseFilter): """ Base SQLAlchemy filter. """ def __init__(self, column, name, options=None, data_type=None): ...
Python
0.000001
803fead9cbfa9d2a950e9fa16f42e905f6a942d7
add module imports
flocker/ca/__init__.py
flocker/ca/__init__.py
# Copyright ClusterHQ Inc. See LICENSE file for details. """ A minimal certificate authority. """ __all__ = [ "RootCredential", "ControlCredential", "NodeCredential", "UserCredential", "ComparableKeyPair", "PathError", "CertificateAlreadyExistsError", "KeyAlreadyExistsError", "EXPIRY_20_YEARS", "AUTH...
# Copyright ClusterHQ Inc. See LICENSE file for details. """ A minimal certificate authority. """ __all__ = [ "RootCredential", "ControlCredential", "NodeCredential", "ComparableKeyPair", "PathError", "CertificateAlreadyExistsError", "KeyAlreadyExistsError", "EXPIRY_20_YEARS", "AUTHORITY_CERTIFICATE_...
Python
0.000001
b45db0476212891dd23934d775bc3082cbcaabdf
Fix KLD
ws/CSUIBotClass2014/MCL/kldmcl.py
ws/CSUIBotClass2014/MCL/kldmcl.py
# @obj: implement the standard MCL alg.; table 8.2 on the book Prob. Robotics by S. Thrun # @author: vektor dewanto import numpy as np import CSUIBotClass2014.action_model.model_uas as act_model import CSUIBotClass2014.perception_model.beam_range_finder_model as obs_model from scipy import stats import math def norma...
# @obj: implement the standard MCL alg.; table 8.2 on the book Prob. Robotics by S. Thrun # @author: vektor dewanto import numpy as np import CSUIBotClass2014.action_model.model_uas as act_model import CSUIBotClass2014.perception_model.beam_range_finder_model as obs_model def normalize_weight(X): # Normalize all ...
Python
0.000003
bf476a199492c7966b6a3886da284867622a8b04
Update populate_vm_metrics.py
perfmetrics/scripts/populate_vm_metrics.py
perfmetrics/scripts/populate_vm_metrics.py
"""Executes vm_metrics.py by passing appropriate arguments. To run the script: >> python3 populate_vm_metrics.py <start_time> <end_time> """ import socket import sys import time import os from vm_metrics import vm_metrics INSTANCE = socket.gethostname() metric_data_name = ['start_time_sec', 'cpu_utilization_peak','c...
"""Executes vm_metrics.py by passing appropriate arguments. To run the script: >> python3 populate_vm_metrics.py <start_time> <end_time> """ import socket import sys import time import os from vm_metrics import vm_metrics INSTANCE = socket.gethostname() metric_data_name = ['start_time_sec', 'cpu_utilization_peak','c...
Python
0.000004
853c6ec8d1c4f518e28f9f14547e2d8999c17ad9
Update models.py
flask_appbuilder/security/models.py
flask_appbuilder/security/models.py
from sqlalchemy import Table, Column, Integer, String, Boolean, ForeignKey from sqlalchemy.orm import relationship, column_property from flask.ext.appbuilder import Base class Permission(Base): __tablename__ = 'ab_permission' id = Column(Integer, primary_key=True) name = Column(String(100), unique = True...
from sqlalchemy import Table, Column, Integer, String, Boolean, ForeignKey from sqlalchemy.orm import relationship, column_property from flask.ext.appbuilder import Base class Permission(Base): __tablename__ = 'ab_permission' id = Column(Integer, primary_key=True) name = Column(String(100), unique = True...
Python
0
c18972be7609b3de061ec41977ad73efccd5213c
Fix HTTP Basic authentication decorator
agir/lib/http.py
agir/lib/http.py
import base64 from functools import wraps from hashlib import sha1 from django.http import HttpResponse from django.utils.crypto import constant_time_compare EMPTY_HASH = sha1().digest() class HttpResponseUnauthorized(HttpResponse): status_code = 401 def __init__(self, content=b'', realm="api", *args, **k...
import base64 from functools import wraps from hashlib import sha1 from django.http import HttpResponse from django.utils.crypto import constant_time_compare EMPTY_HASH = sha1().digest() class HttpResponseUnauthorized(HttpResponse): status_code = 401 def __init__(self, content=b'', realm="api", *args, **k...
Python
0.000091
70de505674e5675d969a84339b6bb59431333ed3
Revise comments and add space lines, & revise main()
lc0234_palindrome_linked_list.py
lc0234_palindrome_linked_list.py
"""Leetcode 234. Palindrome Linked List Easy URL: https://leetcode.com/problems/palindrome-linked-list/ Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up: Could you do it in O(n) time and O(1) space? """ # Definiti...
"""Leetcode 234. Palindrome Linked List Easy URL: https://leetcode.com/problems/palindrome-linked-list/ Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up: Could you do it in O(n) time and O(1) space? """ # Definiti...
Python
0
3e8d113a6fa32c7c9163d3334e484993c29080ba
remove split test
vlermv/test/test_s3.py
vlermv/test/test_s3.py
import json import pytest from .._s3 import S3Vlermv class FakeBucket: def __init__(self, name, **db): self.db = db self.name = name def list(self): for key in self.db: yield self.new_key(key) def new_key(self, key): return FakeKey(self.db, key) def get_key...
import json import pytest from .._s3 import S3Vlermv, split class FakeBucket: def __init__(self, name, **db): self.db = db self.name = name def list(self): for key in self.db: yield self.new_key(key) def new_key(self, key): return FakeKey(self.db, key) def ...
Python
0.000006
d4ffe068638aa1394c1a34eaa43859edb47c0473
Update hodograph_inset example for plot the colormap by height.
examples/plots/Hodograph_Inset.py
examples/plots/Hodograph_Inset.py
# Copyright (c) 2016 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Hodograph Inset =============== Layout a Skew-T plot with a hodograph inset into the plot. """ import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import...
# Copyright (c) 2016 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Hodograph Inset =============== Layout a Skew-T plot with a hodograph inset into the plot. """ import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import...
Python
0
130234f0f62c04b3cc0a4b20f0de789959abf4c9
Change default zoom to 16 and make it overridable
molly/maps/__init__.py
molly/maps/__init__.py
from molly.maps.osm.utils import fit_to_map class Map: """ An object which represents a Map. This should be added to a context and then passed to @C{render_map} in your template to get the appropriate HTML """ def __init__(self, centre_point, points, min_points, zoom, width, height): "...
from molly.maps.osm.utils import fit_to_map class Map: """ An object which represents a Map. This should be added to a context and then passed to @C{render_map} in your template to get the appropriate HTML """ def __init__(self, centre_point, points, min_points, zoom, width, height): "...
Python
0
3b0865bbfcee18afb842cc9f50f8c83c0d70f221
Add the other v ;-).
sphinx/fabfile.py
sphinx/fabfile.py
from fabric.api import run, env, roles from fabric.contrib.files import exists from fabric.contrib.project import rsync_project import sys sys.path.append("source") import conf env.roledefs = { 'web': ['bokeh.pydata.org'] } env.user = "bokeh" @roles('web') def deploy(v=None): if v is None: v = conf....
from fabric.api import run, env, roles from fabric.contrib.files import exists from fabric.contrib.project import rsync_project import sys sys.path.append("source") import conf env.roledefs = { 'web': ['bokeh.pydata.org'] } env.user = "bokeh" @roles('web') def deploy(v=None): if v is None: v = conf....
Python
0.000005
b3ddba27c92f36ee9534903b43ff632daa148585
Fix public body search index by indexing jurisdiction name
froide/publicbody/search_indexes.py
froide/publicbody/search_indexes.py
from django.conf import settings from haystack import indexes from haystack import site from publicbody.models import PublicBody from helper.searchindex import QueuedRealTimeSearchIndex PUBLIC_BODY_BOOSTS = getattr(settings, "FROIDE_PUBLIC_BODY_BOOSTS", {}) class PublicBodyIndex(QueuedRealTimeSearchIndex): te...
from django.conf import settings from haystack import indexes from haystack import site from publicbody.models import PublicBody from helper.searchindex import QueuedRealTimeSearchIndex PUBLIC_BODY_BOOSTS = getattr(settings, "FROIDE_PUBLIC_BODY_BOOSTS", {}) class PublicBodyIndex(QueuedRealTimeSearchIndex): te...
Python
0.000723
8191d25e732b16a0121bd64320348108b9259892
Add SecurityQuestionModelAdmin
molo/profiles/admin.py
molo/profiles/admin.py
import csv from daterange_filter.filter import DateRangeFilter from django.contrib import admin from django.http import HttpResponse from django.contrib.auth.models import User from django.contrib.auth.admin import UserAdmin from django.contrib.admin.sites import NotRegistered from molo.profiles.admin_views import Fro...
import csv from daterange_filter.filter import DateRangeFilter from django.contrib import admin from django.http import HttpResponse from django.contrib.auth.models import User from django.contrib.auth.admin import UserAdmin from django.contrib.admin.sites import NotRegistered from molo.profiles.admin_views import Fro...
Python
0
6499aecb18104114d47707ba4c1080bb817f7ccc
Update loadlogs.py
logger/loadlogs.py
logger/loadlogs.py
#!/usr/bin/env python from tools import * from ratchet import * from logaccess_config import * # Retrieving from CouchDB a Title dictionary as: dict['bjmbr']=XXXX-XXXX acrondict = getTitles() proc_coll = get_proc_collection() allowed_issns = [] for key, issn in acrondict.items(): allowed_issns.append(issn) if a...
#!/usr/bin/env python from tools import * from ratchet import * from logaccess_config import * # Retrieving from CouchDB a Title dictionary as: dict['bjmbr']=XXXX-XXXX acrondict = getTitles() proc_coll = get_proc_collection() allowed_issns = [] for key, issn in acrondict.items(): allowed_issns.append(issn) if a...
Python
0.000001
3da17a2f61daecc34772ead7e6caffa9da49bf48
Add default values and shebang
06-setPositionFromArgs.py
06-setPositionFromArgs.py
#!/usr/bin/env python # We have to import the minecraft api module to do anything in the minecraft world from mcpi.minecraft import * import sys # this means that the file can be imported without executing anything in this code block if __name__ == "__main__": """ First thing you do is create a connection t...
# We have to import the minecraft api module to do anything in the minecraft world from mcpi.minecraft import * import sys # this means that the file can be imported without executing anything in this code block if __name__ == "__main__": """ First thing you do is create a connection to minecraft This is...
Python
0
de381a56e87a21da1e82146da01bb546c5094ec4
Print the traceback as well for debugging purposes.
scripts/asgard-deploy.py
scripts/asgard-deploy.py
#!/usr/bin/env python import sys import logging import traceback import click from os import path # Add top-level module path to sys.path before importing tubular code. sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) ) from tubular import asgard logging.basicConfig(stream=sys.stdout, level=l...
#!/usr/bin/env python import sys import logging import click from os import path # Add top-level module path to sys.path before importing tubular code. sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) ) from tubular import asgard logging.basicConfig(stream=sys.stdout, level=logging.INFO) @cl...
Python
0
0a81356e0f8011f0764a8c28719d1371e5860656
Make sure create_privatekml mgmt command produces unique names less than 100 chars; fail gracefully if not
lingcod/layers/management/commands/create_privatekml.py
lingcod/layers/management/commands/create_privatekml.py
from django.core.management.base import BaseCommand, AppCommand from django.conf import settings from optparse import make_option import os import glob from lingcod.layers.models import PrivateKml from django.contrib.auth.models import User, Group class Command(BaseCommand): help = "Populates the PrivateKml table ...
from django.core.management.base import BaseCommand, AppCommand from django.conf import settings from optparse import make_option import os import glob from lingcod.layers.models import PrivateKml from django.contrib.auth.models import User, Group class Command(BaseCommand): help = "Populates the PrivateKml table ...
Python
0
9a1921fb27b7073d9c79f6727766eb516478f403
Bump version 0.6.0 (git sync solution)
cmscloud_client/__init__.py
cmscloud_client/__init__.py
# -*- coding: utf-8 -*- __version__ = '0.6.0'
# -*- coding: utf-8 -*- __version__ = '0.5.4'
Python
0
9926cbb1919b96999d479f5a8d67e17ce71a1091
Improve the get_nick a tiny amount
motobot/irc_message.py
motobot/irc_message.py
class IRCMessage: """ Class to store and parse an IRC Message. """ def __init__(self, msg): """ Parse a raw IRC message to IRCMessage. """ self.sender = None self.nick = None self.command = None self.params = [] self.__parse_msg(msg) def __parse_msg(self, ...
class IRCMessage: """ Class to store and parse an IRC Message. """ def __init__(self, msg): """ Parse a raw IRC message to IRCMessage. """ self.sender = None self.nick = None self.command = None self.params = [] self.__parse_msg(msg) def __parse_msg(self, ...
Python
0.000021
119ce47d9e876c345c2bc44751ccf04f0b226259
Remove lie_system package dependency
components/lie_structures/setup.py
components/lie_structures/setup.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # package: lie_docking # file: setup.py # # Part of ‘lie_docking’, a package providing molecular docking functionality # for the LIEStudio package. # # Copyright © 2016 Marc van Dijk, VU University Amsterdam, the Netherlands # # Licensed under the Apache License, Version ...
#! /usr/bin/env python # -*- coding: utf-8 -*- # package: lie_docking # file: setup.py # # Part of ‘lie_docking’, a package providing molecular docking functionality # for the LIEStudio package. # # Copyright © 2016 Marc van Dijk, VU University Amsterdam, the Netherlands # # Licensed under the Apache License, Version ...
Python
0
eb48fba5b3334437a752681df200c2bbefb0bc18
change font to be purple
NEMbox/osdlyrics.py
NEMbox/osdlyrics.py
from PyQt4 import QtGui, QtCore, QtDBus import sys import os from multiprocessing import Process class Lyrics(QtGui.QWidget): def __init__(self): super(Lyrics, self).__init__() self.initUI() def initUI(self): self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.resize(900...
from PyQt4 import QtGui, QtCore, QtDBus import sys import os from multiprocessing import Process class Lyrics(QtGui.QWidget): def __init__(self): super(Lyrics, self).__init__() self.initUI() def initUI(self): self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.resize(900...
Python
0.999989
c61d4c6df77fe505074c81eebaec938c6716d9ab
Create columns before querying them.
sqlaload/query.py
sqlaload/query.py
import logging from itertools import count from sqlalchemy.sql import expression, and_ from sqlaload.schema import _ensure_columns log = logging.getLogger(__name__) def resultiter(rp): """ SQLAlchemy ResultProxies are not iterable to get a list of dictionaries. This is to wrap them. """ keys = rp.keys()...
import logging from itertools import count from sqlalchemy.sql import expression, and_ log = logging.getLogger(__name__) def resultiter(rp): """ SQLAlchemy ResultProxies are not iterable to get a list of dictionaries. This is to wrap them. """ keys = rp.keys() while True: row = rp.fetchone()...
Python
0
0c4e6ff26d716bf20a1a7c36a4e3e363a1101c2a
add forced/default to plexpy.library.stream
Contents/Libraries/Shared/plex/objects/library/stream.py
Contents/Libraries/Shared/plex/objects/library/stream.py
from plex.objects.core.base import Descriptor, Property class Stream(Descriptor): id = Property(type=int) index = Property(type=int) stream_type = Property('streamType', type=int) selected = Property(type=bool) forced = Property(type=bool) default = Property(type=bool) title = Property ...
from plex.objects.core.base import Descriptor, Property class Stream(Descriptor): id = Property(type=int) index = Property(type=int) stream_type = Property('streamType', type=int) selected = Property(type=bool) title = Property duration = Property(type=int) codec = Property codec_id...
Python
0
e92a612ba231eebb8dbe7ac42d24ac002a89fbe1
add docstring
frappe/utils/logger.py
frappe/utils/logger.py
# imports - compatibility imports from __future__ import unicode_literals # imports - standard imports import logging import os from logging.handlers import RotatingFileHandler # imports - third party imports from six import text_type # imports - module imports import frappe default_log_level = logging.DEBUG site ...
# imports - compatibility imports from __future__ import unicode_literals # imports - standard imports import logging import os from logging.handlers import RotatingFileHandler # imports - third party imports from six import text_type # imports - module imports import frappe default_log_level = logging.DEBUG site ...
Python
0.000005
24fbe55a3517e50f4d158bbb7b8857f8f10dc148
Use argparse to parse julia-py arguments
src/julia/julia_py.py
src/julia/julia_py.py
""" Launch Julia through PyJulia. """ from __future__ import print_function, absolute_import import argparse import os import sys from .api import LibJulia from .core import enable_debug from .tools import julia_py_executable def julia_py(julia, pyjulia_debug, jl_args): if pyjulia_debug: enable_debug()...
from __future__ import print_function, absolute_import from argparse import Namespace import os import sys from .api import LibJulia from .tools import julia_py_executable def parse_args(args): ns = Namespace(julia="julia") jl_args = list(args) if len(jl_args) >= 2 and jl_args[0] == "--julia": ...
Python
0.000004
59e7fc5c924ebf8af66e0aeef990da55e84d3f9e
update to 3.30.1
packages/dependencies/sqlite3.py
packages/dependencies/sqlite3.py
{ 'repo_type' : 'archive', 'custom_cflag' : '-O2', # make sure we build it without -ffast-math 'download_locations' : [ { 'url' : 'https://www.sqlite.org/2019/sqlite-autoconf-3300100.tar.gz', 'hashes' : [ { 'type' : 'sha256', 'sum' : '8c5a50db089bd2a1b08dbc5b00d2027602ca7ff238ba7658fabca454d4298e60' }, ], }, { '...
{ 'repo_type' : 'archive', 'custom_cflag' : '-O2', # make sure we build it without -ffast-math 'download_locations' : [ { 'url' : 'https://www.sqlite.org/2019/sqlite-autoconf-3300000.tar.gz', 'hashes' : [ { 'type' : 'sha256', 'sum' : 'e0a8cf4c7a87455e55e10413d16f358ca121ccec687fe1301eac95e2d340fc58' }, ], }, { '...
Python
0.000001
6ad4796030aab2f6dbf8389b4030007d0fcf8761
Update to test for mount setup
panoptes/test/mount/test_ioptron.py
panoptes/test/mount/test_ioptron.py
from nose.tools import raises import panoptes from panoptes.mount.ioptron import Mount class TestIOptron(): @raises(AssertionError) def test_no_config_no_commands(self): """ Mount needs a config """ mount = Mount() @raises(AssertionError) def test_config_bad_commands(self): """ Passes in a default config ...
from nose.tools import raises import panoptes from panoptes.mount.ioptron import Mount class TestIOptron(): @raises(AssertionError) def test_no_config_no_commands(self): """ Mount needs a config """ mount = Mount() @raises(AssertionError) def test_config_no_commands(self): """ """ mount = Mount(config={...
Python
0
6b3e44b5e3ba66b870a584544a15a17036cf043a
fix syntax error
fruitScope/plotjson.py
fruitScope/plotjson.py
import json import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils import argparse import time, os, sys import tempfile import math def check_dir(directory): if not os.path.exists(directory): print "Directory {} does not exist...creating...".format(directory) os.makedirs(directory) def main(): p...
import json import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils import argparse import time, os, sys import tempfile import math def check_dir(directory): if not os.path.exists(directory): print "Directory {} does not exist...creating...".format(directory) os.makedirs(directory) def main(): p...
Python
0.000003
c884eae90e41577670b8bd194cc55b31e49f3f61
fix data provider ref
src/py/crankshaft/crankshaft/clustering/kmeans.py
src/py/crankshaft/crankshaft/clustering/kmeans.py
from sklearn.cluster import KMeans import numpy as np from crankshaft.analysis_data_provider import AnalysisDataProvider class Kmeans: def __init__(self, data_provider=None): if data_provider is None: self.data_provider = AnalysisDataProvider() else: self.data_provider = d...
from sklearn.cluster import KMeans import numpy as np from crankshaft.analysis_data_provider import AnalysisDataProvider class Kmeans: def __init__(self, data_provider=None): if data_provider is None: self.data_provider = AnalysisDataProvider() else: self.data_provider = d...
Python
0
4f0e0d4d92301dea408925d99001913e76a15ee1
Update filterscan.py
lib/filterscan.py
lib/filterscan.py
try: import os import subprocess from lib.core.core import Core from lib.filter.filter import Filter except ImportError, err: from lib.core.core import Core Core.print_error(err) class FilterScan(Filter): def __init__(self, args): self.__args = args Filter.__init__(self, [self.__args.pcap], self.__args,...
try: import subprocess from lib.core.core import Core from lib.filter.filter import Filter except ImportError, err: from lib.core.core import Core Core.print_error(err) class FilterScan(Filter): def __init__(self, args): Filter.__init__(self, [args.pcap], args, "filter") print self._output_dir def _...
Python
0
bf9c799d1fb13098bd4bce65d44f86bb352b834a
Comment out an extensive validation
main.py
main.py
#!/usr/bin/python3 # # The MIT License (MIT) # # Copyright (c) 2013 Andrian Nord # # 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...
#!/usr/bin/python3 # # The MIT License (MIT) # # Copyright (c) 2013 Andrian Nord # # 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...
Python
0
3b6cc83cfea47550619d8a1d966131a1cc90f1c9
clean up processes/threads
lib/ipf/engine.py
lib/ipf/engine.py
############################################################################### # Copyright 2012 The University of Texas at Austin # # # # Licensed under the Apache License, Version 2.0 (the "License"); #...
############################################################################### # Copyright 2012 The University of Texas at Austin # # # # Licensed under the Apache License, Version 2.0 (the "License"); #...
Python
0.000001
c52d056091acf49624450cc2d1e01cbf0900a08f
Add a profiling option
main.py
main.py
#!/usr/bin/env python import sys from PyQt4.QtGui import QApplication as QApp from gui.EditorWindow import MainWindow def main(): import grammar.grammars grammar.grammars.compileGrammars() app = QApp(sys.argv) ex = MainWindow() sys.exit(app.exec_()) if __name__ == '__main__': profile = ...
#!/usr/bin/env python import sys from PyQt4.QtGui import QApplication as QApp from gui.EditorWindow import MainWindow def main(): import grammar.grammars grammar.grammars.compileGrammars() app = QApp(sys.argv) ex = MainWindow() sys.exit(app.exec_()) if __name__ == '__main__': main()
Python
0.00003
d951b11e9991c021e631299f0e22da8eb4c7d850
comment out post-checkout undo demonstration
main.py
main.py
# this is the main file that get called import os import sys import gitTA as git import colorama from colorama import Fore, Back # add color output to terminal: we want anything printed to be VERY visible to user colorama.init() # called so that windows colors work ''' modify this file! When git runs certain commands...
# this is the main file that get called import os import sys import gitTA as git import colorama from colorama import Fore, Back # add color output to terminal: we want anything printed to be VERY visible to user colorama.init() # called so that windows colors work ''' modify this file! When git runs certain commands...
Python
0
ea2b1dfd5d27f1b4a537b85e823bb7ba047887f1
Wrap everything in a main function
main.py
main.py
import argparse from os import exit from encrypt import encrypt from decrypt import decrypt def main(): parser = argparse.ArgumentParser(prog='vic') subparsers = parser.add_subparsers(help='sub-command help') # Encryption subparser parser_encrypt = subparsers.add_parser('encrypt', description='VIC ...
import argparse from encrypt import encrypt from decrypt import decrypt parser = argparse.ArgumentParser(prog='vic') subparsers = parser.add_subparsers(help='sub-command help') # Encryption subparser parser_encrypt = subparsers.add_parser('encrypt', description='VIC cipher encrypter') parser_encrypt.set_defaults(...
Python
0.9996
1624504bd966eaf47698938e387a58dd14738a76
add warnings about deprecation of compiler specific template tags
static_precompiler/templatetags/compile_static.py
static_precompiler/templatetags/compile_static.py
import six import warnings from django.template import Library from django.templatetags.static import static from static_precompiler.settings import PREPEND_STATIC_URL, USE_CACHE, CACHE_TIMEOUT from static_precompiler.utils import compile_static, get_compiler_by_name, get_cache_key, get_hexdigest, get_cache from stati...
import six from django.template import Library from django.templatetags.static import static from static_precompiler.settings import PREPEND_STATIC_URL, USE_CACHE, CACHE_TIMEOUT from static_precompiler.utils import compile_static, get_compiler_by_name, get_cache_key, get_hexdigest, get_cache from static_precompiler.te...
Python
0
437643d0f0680470b52ce893555df5dac17bdca1
use selenium for loading js content
main.py
main.py
import time from bs4 import BeautifulSoup from selenium import webdriver browser = webdriver.Firefox() ffResults = browser.get("https://www.expedia.com/Flights-Search?trip=roundtrip&leg1=from:Hamburg,%20Germany%20(HAM-All%20Airports),to:Amman,%20Jordan%20(AMM-Queen%20Alia%20Intl.),departure:03/08/2017TANYT&leg2=fr...
import urllib.request result=urllib.request.urlopen("https://www.expedia.de/Flights-Search?trip=roundtrip&leg1=from:Hamburg,%20Deutschland%20(HAM-Alle%20Flugh%C3%A4fen),to:Amman,%20Jordanien%20(AMM-Queen%20Alia%20Intl.),departure:08.03.2017TANYT&leg2=from:Amman,%20Jordanien%20(AMM-Queen%20Alia%20Intl.),to:Hamburg,%20D...
Python
0
1550660e39ded9cbcaf0ad429f01f2803f3c5256
Add a register function prior to enacting reporting
main.py
main.py
#!/usr/bin/python from hashlib import md5 import os import sys import json import time import sched import socket import psutil from lib import cpu, memory, disks, network, system, transport _cache = [] _cache_timer = 0 _cache_keeper = 0 _version = 1.0 def main(scheduler, config, sock, hostname,...
#!/usr/bin/python import os import sys import json import time import sched import socket import psutil from lib import cpu, memory, disks, network, system, transport _cache = [] _cache_timer = 0 _cache_keeper = 0 def main(scheduler, config, sock, hostname, callers): global _cache glob...
Python
0
1cab65aba369263904607738cd69b2ad7d6a8e63
change web framework from wsgi to cgi
main.py
main.py
#!/usr/bin/env python # coding=utf-8 from datetime import date import time from webapp.web import Application, BaseHandler URLS = ( ("/", "Index"), ("/hello/(.*)", "Hello"), ) class Index(BaseHandler): def get(self): header = "Content-type:text/html\r\n\r\n" # self.write(header+"Welco...
#!/usr/bin/env python # coding=utf-8 from datetime import date import time from webapp.web import Application, BaseHandler URLS = ( ("/", "Index"), ("/hello/(.*)", "Hello"), ) class Index(BaseHandler): def get(self): header = "Content-type:text/html\r\n\r\n" # self.write(header+"Welco...
Python
0.000016
24d4fee92c1c2ff4bac1fe09d9b436748234a48c
Add argument for execution of defective server.
main.py
main.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 """ Main script. Executes the XML Server implementation with an HTTP connection and default parameters. """ import sys import argparse from server import xml_server, defective_servers from connection import http_connection parser = argparse.Argument...
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 """ Main script. Executes the XML Server implementation with an HTTP connection and default parameters. """ import sys import argparse from server import xml_server from connection import http_connection parser = argparse.ArgumentParser() parser.add...
Python
0
52c2205804d8dc38447bca1ccbf5599e00cd1d7b
Rename user_id config key to admin_user_id
main.py
main.py
#!/usr/bin/env python3 import requests CONFIG_DIR = "config" class Bot: def __init__(self): self.config = Config(CONFIG_DIR) self.api = TelegramBotApi(self.config.get_auth_token()) def run(self): self.api.send_message(self.config.get_admin_user_id(), "test") class TelegramBotApi: ...
#!/usr/bin/env python3 import requests CONFIG_DIR = "config" class Bot: def __init__(self): self.config = Config(CONFIG_DIR) self.api = TelegramBotApi(self.config.get_auth_token()) def run(self): self.api.send_message(self.config.get_user_id(), "test") class TelegramBotApi: de...
Python
0.005562
8cbe375b478764f05e67b3d5600ca51bbd5b5c48
enable 'inline_defnode_calls' optimisation for benchmarks (even though they don't benefit currently)
Demos/benchmarks/setup.py
Demos/benchmarks/setup.py
from distutils.core import setup from Cython.Build import cythonize directives = { 'optimize.inline_defnode_calls': True } setup( name = 'benchmarks', ext_modules = cythonize("*.py", language_level=3, annotate=True, compiler_directives=directives), )
from distutils.core import setup from Cython.Build import cythonize setup( name = 'benchmarks', ext_modules = cythonize("*.py", language_level=3, annotate=True), )
Python
0
0389759b9b300c5a0cc807e9d6d154e757abecad
make sentry optional
main.py
main.py
import logging from time import mktime import feedparser import sys import yaml from raven import Client from wallabag_api.wallabag import Wallabag import github_stars import golem_top logger = logging.getLogger() logger.handlers = [] formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') ch = l...
import logging from time import mktime import feedparser import sys import yaml from raven import Client from wallabag_api.wallabag import Wallabag import github_stars import golem_top logger = logging.getLogger() logger.handlers = [] formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') ch = l...
Python
0.000001
25d67637fafb04bae67033a4deef4bc71fd91ef2
Fix elision of needed path joins.
main.py
main.py
from markdown import Markdown import sys import codecs import os import errno def ensure_output_exists(dir): if not os.path.isdir(dir): try: print("mkdir", dir) os.makedirs(dir) except OSError as e: raise SnabbptException("Unable to create output directory") from...
from markdown import Markdown import sys import codecs import os import errno def ensure_output_exists(dir): if not os.path.isdir(dir): try: print("mkdir", dir) os.makedirs(dir) except OSError as e: raise SnabbptException("Unable to create output directory") from...
Python
0
18d59a1d23cc9021fa388028ab723822e031dc07
Add health check
main.py
main.py
# Copyright 2015, Google, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use # this file except in compliance with the License. You may obtain a copy of the # License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable # law or agreed to in writing, software d...
# Copyright 2015, Google, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use # this file except in compliance with the License. You may obtain a copy of the # License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable # law or agreed to in writing, software d...
Python
0.000001
788f11632ce085d82be6d90665b9b277f7a60148
Refactor Task function to properly switch if it is a TaskTemplate, and if there is a CloudHarenssTask use CloudHarnessWorkflow.
gbdxtools/interface.py
gbdxtools/interface.py
""" Main Interface to GBDX API. Contact: kostas.stamatiou@digitalglobe.com """ from __future__ import absolute_import from builtins import object from future import standard_library import json import os import logging from gbdx_auth import gbdx_auth from gbdxtools.s3 import S3 from gbdxtools.ordering import Orderi...
""" Main Interface to GBDX API. Contact: kostas.stamatiou@digitalglobe.com """ from __future__ import absolute_import from builtins import object from future import standard_library import json import os import logging from gbdx_auth import gbdx_auth from gbdxtools.s3 import S3 from gbdxtools.ordering import Orderi...
Python
0
6ddc63dcb1005ccf6d09f2577faf99566bafced7
fix Log.add_group() use in live_plot.py example
examples/miscellaneous/live_plot.py
examples/miscellaneous/live_plot.py
from __future__ import print_function from __future__ import absolute_import import os import sys sys.path.append( '.' ) import numpy as nm from sfepy.base.base import output, pause from sfepy.base.log import Log def main(): cwd = os.path.split(os.path.join(os.getcwd(), __file__))[0] log = Log((['sin(x)', '...
from __future__ import print_function from __future__ import absolute_import import os import sys sys.path.append( '.' ) import numpy as nm from sfepy.base.base import output, pause from sfepy.base.log import Log def main(): cwd = os.path.split(os.path.join(os.getcwd(), __file__))[0] log = Log((['sin(x)', '...
Python
0.000001
43a087c69eedd26d3bab699fca08b5a01a06a6a4
Add test to check if InvalidFrequencyException is thrown
skrf/tests/test_frequency.py
skrf/tests/test_frequency.py
from skrf.frequency import InvalidFrequencyException import unittest import os import numpy as npy import skrf as rf class FrequencyTestCase(unittest.TestCase): ''' ''' def setUp(self): ''' ''' self.test_dir = os.path.dirname(os.path.abspath(__file__))+'/' def test_create_li...
import unittest import os import numpy as npy import skrf as rf class FrequencyTestCase(unittest.TestCase): ''' ''' def setUp(self): ''' ''' self.test_dir = os.path.dirname(os.path.abspath(__file__))+'/' def test_create_linear_sweep(self): freq = rf.Frequency(1,10,10...
Python
0
e7a01079e57acfa4486fc6cf786a1012da436d0f
Revise snapshot parsing to not expect multiple samples for contrast
solar_snapshot_name_parse.py
solar_snapshot_name_parse.py
#!/usr/bin/env python3 ################################################################################ # Description: # * Parses names of files in directory containing snapshots of solar # suitcase displays, and formats them for pasting into timestamp column of # solar energy log spreadsheet # * Requi...
#!/usr/bin/env python3 ################################################################################ # Description: # * Parses names of files in directory containing snapshots of solar # suitcase displays, and formats them for pasting into timestamp column of # solar energy log spreadsheet # * Requi...
Python
0
653376cf10edb42e6d5c429e61bc9ef23eb51234
fix test for GenomicFilter
solvebio/test/test_filter.py
solvebio/test/test_filter.py
import unittest import solvebio from solvebio import Filter, GenomicFilter class FilterTest(unittest.TestCase): def test_filter_basic(self): f = Filter() self.assertEqual(repr(f), '<Filter []>', 'empty filter') self.assertEqual(repr(~f), '<Filter []>', '"not" of empty filter') #...
import unittest import solvebio from solvebio import Filter, GenomicFilter class FilterTest(unittest.TestCase): def test_filter_basic(self): f = Filter() self.assertEqual(repr(f), '<Filter []>', 'empty filter') self.assertEqual(repr(~f), '<Filter []>', '"not" of empty filter') #...
Python
0
a4ea5f9a6b6de93188a590b918aa122e4fbe437b
Fix jsbox formset usage.
go/apps/jsbox/forms.py
go/apps/jsbox/forms.py
from django import forms from django.forms.formsets import BaseFormSet, formset_factory from go.base.widgets import CodeField, SourceUrlField SOURCE_URL_HELP_TEXT = ( 'HTTP Basic Authentication is supported. If using GitHub ' 'please use ' '<a href="http://developer.github.com/v3/#authentication">' '...
from django import forms from django.forms.formsets import BaseFormSet, DEFAULT_MAX_NUM from go.base.widgets import CodeField, SourceUrlField SOURCE_URL_HELP_TEXT = ( 'HTTP Basic Authentication is supported. If using GitHub ' 'please use ' '<a href="http://developer.github.com/v3/#authentication">' '...
Python
0
884e17eb92e35ab5a9f4d6bc94f11f49977711a3
Use render() so that we can pass in the request context and thus link to static files correctly (reviewed by @smn).
go/apps/jsbox/views.py
go/apps/jsbox/views.py
import requests from urlparse import urlparse, urlunparse from django.http import HttpResponse from django.contrib.auth.decorators import login_required from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from go.conversation.base import ConversationViews from go.apps.jsbox.forms ...
import requests from urlparse import urlparse, urlunparse from django.http import HttpResponse from django.contrib.auth.decorators import login_required from django.shortcuts import render_to_response from django.views.decorators.csrf import csrf_exempt from go.conversation.base import ConversationViews from go.apps....
Python
0
f10e01a180cca2185862c1f6cf926c2a197536ed
lower the name to be stripped
gozerlib/utils/name.py
gozerlib/utils/name.py
# gozerlib/utils/name.py # # """ name related helper functions. """ ## basic imports import string import os ## defines allowednamechars = string.ascii_letters + string.digits + '!.@-+#' ## stripname function def stripname(name, allowed=""): """ strip all not allowed chars from name. """ name = name.lowe...
# gozerlib/utils/name.py # # """ name related helper functions. """ ## basic imports import string import os ## defines allowednamechars = string.ascii_letters + string.digits + '!.@-+#' ## stripname function def stripname(name, allowed=""): """ strip all not allowed chars from name. """ res = "" for...
Python
0.999995
debeefabeb64766b380af42458433a05c2a2f04a
Add F1 score to metrics.
non_semantic_speech_benchmark/eval_embedding/metrics.py
non_semantic_speech_benchmark/eval_embedding/metrics.py
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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 applicab...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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 applicab...
Python
0.999995
8d2167bc3bc37f68e225ddcd86bc4114d90be87e
Update version number
local_packages.py
local_packages.py
import sublime from .event_handler import EventHandler from .settings import Settings package_control_installed = False LOCAL_PACKAGES_VERSION = "0.1.2" evaluating = False retry_times = 3 def plugin_loaded(): Settings.reset() Settings.startup() EventHandler().register_handler( evaluate_install, ...
import sublime from .event_handler import EventHandler from .settings import Settings package_control_installed = False LOCAL_PACKAGES_VERSION = "0.1.1" evaluating = False retry_times = 3 def plugin_loaded(): Settings.reset() Settings.startup() EventHandler().register_handler( evaluate_install, ...
Python
0.000002
b67642ce07631ffe621dc94207524c8049141987
calculate vcirc
galpy/potential_src/plotRotcurve.py
galpy/potential_src/plotRotcurve.py
import numpy as nu import galpy.util.bovy_plot as plot def plotRotcurve(Pot,*args,**kwargs): """ NAME: plotRotcurve PURPOSE: plot the rotation curve for this potential (in the z=0 plane for non-spherical potentials) INPUT: Pot - Potential or list of Potential instances ...
import numpy as nu import galpy.util.bovy_plot as plot def plotRotcurve(Pot,*args,**kwargs): """ NAME: plotRotcurve PURPOSE: plot the rotation curve for this potential (in the z=0 plane for non-spherical potentials) INPUT: Pot - Potential or list of Potential instances ...
Python
0.998805
4ca8889396595f9da99becbb88fb7e38ab0ed560
Raise exception if connection not succeed and customize error message
hunter/reviewsapi.py
hunter/reviewsapi.py
import requests import os from .endpoints import * class UnauthorizedToken(Exception): pass class ReviewsAPI: def __init__(self): token = os.environ.get('UDACITY_AUTH_TOKEN') self.headers = {'Authorization': token, 'Content-Length': '0'} def certifications(self): try: ...
import requests import os from .endpoints import * class UnauthorizedToken(Exception): pass class ReviewsAPI: def __init__(self): token = os.environ.get('UDACITY_AUTH_TOKEN') self.headers = {'Authorization': token, 'Content-Length': '0'} def certifications(self): try: ...
Python
0
2ba350d71e8a24471ea80fafa75803eb439c4ea6
add require(internet)
i3pystatus/parcel.py
i3pystatus/parcel.py
from urllib.request import urlopen import webbrowser import lxml.html from lxml.cssselect import CSSSelector from i3pystatus import IntervalModule from i3pystatus.core.util import internet, require class TrackerAPI: def __init__(self, idcode): pass def status(self): return {} class DHL(...
from urllib.request import urlopen import webbrowser import lxml.html from lxml.cssselect import CSSSelector from i3pystatus import IntervalModule class TrackerAPI: def __init__(self, idcode): pass def status(self): return {} class DHL(TrackerAPI): URL = "http://nolp.dhl.de/nextt-on...
Python
0.000005
792e46bcd01d2718215a3cb324b8deca5e4e1a7e
bump 1.3.10 release (#160)
icontrol/__init__.py
icontrol/__init__.py
__version__ = "1.3.10"
__version__ = "1.3.9"
Python
0
9d20717b39154252109153a6c5936922d28c6511
mark unicode context values as safe
mailviews/utils.py
mailviews/utils.py
import textwrap from collections import namedtuple from django.utils.safestring import mark_safe Docstring = namedtuple('Docstring', ('summary', 'body')) def split_docstring(value): """ Splits the docstring of the given value into it's summary and body. :returns: a 2-tuple of the format ``(summary, bo...
import textwrap from collections import namedtuple from django.utils.safestring import mark_safe Docstring = namedtuple('Docstring', ('summary', 'body')) def split_docstring(value): """ Splits the docstring of the given value into it's summary and body. :returns: a 2-tuple of the format ``(summary, bo...
Python
0.999996
bdca4889442e7d84f8c4e68ecdbee676d46ff264
Fix data provider example file.
examples/test_with_data_provider.py
examples/test_with_data_provider.py
from pytf.dataprovider import DataProvider, call @DataProvider(max_5=call(max=5), max_10=call(max=10), max_15=call(max=15)) class TestCase(object): def __init__(self, max): self.max = max @DataProvider(n_3=call(n=3), n_7=call(n=7), n_12=call(n=12), n_20=call(n=20)) def test_test(self, n): ...
from pytf.dataprovider import DataProvider try: from unittest.mock import call except ImportError: from mock import call @DataProvider([call(max=5), call(max=10), call(max=15)]) class TestCase(object): def __init__(self, max): self.max = max @DataProvider([call(n=3), call(n=7), call(n=12), c...
Python
0
97e2e80b43ba3639e5af9deb6485c28da1a5e7af
change path
make_submission.py
make_submission.py
""" Ensemble by columnwise weighted sum. The weights are determined by scipy.optimize.minimize using validation set predictions. LB Private: 0.40076 LB Public: 0.39773 """ import numpy as np import pandas as pd import sklearn.preprocessing as pp path = './' # Neural Networks pred = [np.load(path + 'pred_TRI_kmax_' ...
""" Ensemble by columnwise weighted sum. The weights are determined by scipy.optimize.minimize using validation set predictions. LB Private: 0.40076 LB Public: 0.39773 """ import numpy as np import pandas as pd import sklearn.preprocessing as pp path = '~/' # Neural Networks pred = [np.load(path + 'pred_TRI_kmax_' ...
Python
0.000001
542ddc0d0bd96c8ff8635f649344f468d7d497d0
bump version to 0.2.3
mallory/version.py
mallory/version.py
Version = "0.2.3"
Version = "0.2.2"
Python
0.000001
ff9444ea838bb7ed3efae125d343cee2cec994a9
Improve the level of comments in mysite/base/depends.py
mysite/base/depends.py
mysite/base/depends.py
# -*- coding: utf-8 -*- # This file is part of OpenHatch. # Copyright (C) 2011 Asheesh Laroia # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at ...
import os try: import lxml import lxml.etree import lxml.html except: class nothing(object): pass lxml = nothing() lxml.etree = None lxml.html = None import logging if lxml.html is None: logging.warning("Some parts of the OpenHatch site may fail because the lxml" ...
Python
0.000015
bf8b29e7d05a7b476198109f1dccfd42da38f73b
Update pack.py: copy directory to destination instead of compressing
pack.py
pack.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ' Generate static webpage files ' import os import sys import shutil usage_prompt = 'Usage: python3 pack.py <destination_path> [-H <hostname>]' protocal = "http" hostname = '' host_path = os.path.join('scripts', 'host.js') site_dir = 'site' if (len(sys.argv) < 2): ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ' Generate static webpage files ' import os import sys usage_prompt = '''Usage: python3 pack.py python3 pack.py -H <hostname> python3 pack.py { ? | -h | --help }''' protocal = "http" hostname = 'localhost' filename_host = os.path.join('scripts', 'host.js') dir_site = ...
Python
0
0db54aacbb1607e2d1d505bc57864dd421d90529
fix indentation
adhocracy/model/userbadges.py
adhocracy/model/userbadges.py
from datetime import datetime import logging from sqlalchemy import Table, Column, Integer, ForeignKey, DateTime, Unicode from adhocracy.model import meta log = logging.getLogger(__name__) badge_table = Table( 'badge', meta.data, Column('id', Integer, primary_key=True), Column('create_time', DateTime, ...
from datetime import datetime import logging from sqlalchemy import Table, Column, Integer, ForeignKey, DateTime, Unicode from adhocracy.model import meta log = logging.getLogger(__name__) badge_table = Table( 'badge', meta.data, Column('id', Integer, primary_key=True), Column('create_time', DateTime, ...
Python
0.000358
3027c1ece280bc665f03781203d6b37b1c1bd82c
fix parsing of HTML entities with HTMLParser
weboob/tools/parser.py
weboob/tools/parser.py
# -*- coding: utf-8 -*- """ Copyright(C) 2010 Romain Bignon 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, version 3 of the License. This program is distributed in the hope that it will be useful...
# -*- coding: utf-8 -*- """ Copyright(C) 2010 Romain Bignon 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, version 3 of the License. This program is distributed in the hope that it will be useful...
Python
0.000001
bc2e7d77eb4aaa6d0063951a98de78c462f261ae
Use timezone-aware datetime object
confirmation/models.py
confirmation/models.py
# -*- coding: utf-8 -*- # Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com> __revision__ = '$Id: models.py 28 2009-10-22 15:03:02Z jarek.zgoda $' import os import re from hashlib import sha1 from django.db import models from django.core.urlresolvers import reverse from django.core.mail import send_mail from ...
# -*- coding: utf-8 -*- # Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com> __revision__ = '$Id: models.py 28 2009-10-22 15:03:02Z jarek.zgoda $' import os import re import datetime from hashlib import sha1 from django.db import models from django.core.urlresolvers import reverse from django.core.mail import...
Python
0.000001
c159a61396cd0b2e9a26c5210212e2dd93849fd5
Add functions
ImageEvolution.py
ImageEvolution.py
import os, sys from PIL import Image, ImageDraw from random import randint inputPath= 'picture.jpg' outputPath = 'altered.png' def evolveImage(): """Given an image, returns an altered version of the image""" def readImage(path): """Returns a PIL image object given a path.""" return Image.open(pat...
import os, sys from PIL import Image inputPath= 'picture.jpg' outputPath = 'altered.png' def evolveImage(): """Given an image, returns an altered version of the image""" def readImage(path): """Returns a PIL image object given a path.""" return Image.open(path) def saveImage(img): """Given a ...
Python
0.007992
9fd89a23e55d9b0b393c3975758b9e2c16a3cda1
Set MOOSE_DIR if the user doesn't have it
python/MooseDocs/common/moose_docs_file_tree.py
python/MooseDocs/common/moose_docs_file_tree.py
#pylint: disable=missing-docstring #################################################################################################### # DO NOT MODIFY THIS HEADER # # MOOSE - Multiphysics Object Oriented Simulation Environment ...
#pylint: disable=missing-docstring #################################################################################################### # DO NOT MODIFY THIS HEADER # # MOOSE - Multiphysics Object Oriented Simulation Environment ...
Python
0
346e296872e1ca011eb5e469505de1c15c86732f
Clarify the comment about setting the PYTHON variable for the Doc Makefile.
Doc/tools/sphinx-build.py
Doc/tools/sphinx-build.py
# -*- coding: utf-8 -*- """ Sphinx - Python documentation toolchain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Georg Brandl. :license: Python license. """ import sys if __name__ == '__main__': if sys.version_info[:3] < (2, 5, 0): print >>sys.stderr, """\ Error: Sphinx ne...
# -*- coding: utf-8 -*- """ Sphinx - Python documentation toolchain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Georg Brandl. :license: Python license. """ import sys if __name__ == '__main__': if sys.version_info[:3] < (2, 5, 0): print >>sys.stderr, """\ Error: Sphinx ne...
Python
0
8070b119c11ad18e2c1979afef21503a255dd8d8
Check the number of matches for each query
rockuefort.py
rockuefort.py
#!/usr/bin/python3 """ Usage: rockuefort copy <file> <destination> rockuefort symlink <file> <destination> rockuefort list <file> """ from collections import OrderedDict import subprocess import sys from docopt import docopt def log(*args, **kwargs): print("rockuefort:", *args, file=sys.stderr, **kw...
#!/usr/bin/python3 """ Usage: rockuefort copy <file> <destination> rockuefort symlink <file> <destination> rockuefort list <file> """ from collections import OrderedDict import subprocess import sys from docopt import docopt def log(*args, **kwargs): print("rockuefort:", *args, file=sys.stderr, **kw...
Python
0.00149
0b39cfbdbfa397be5e428425aedc9ebced62c6ec
Fix reversed lat/lon
projects/tpoafptarbmit/scrape.py
projects/tpoafptarbmit/scrape.py
#!/usr/bin/env python3 from urllib.parse import parse_qsl import json import os import sys import requests from bs4 import BeautifulSoup ROUTE_BASE_URL = 'http://www.thepassageride.com/Routes/' def fetch_text(url): r = requests.get(url) if r.status_code != 200: r.raise_for_status() return r.te...
#!/usr/bin/env python3 from urllib.parse import parse_qsl import json import os import sys import requests from bs4 import BeautifulSoup ROUTE_BASE_URL = 'http://www.thepassageride.com/Routes/' def fetch_text(url): r = requests.get(url) if r.status_code != 200: r.raise_for_status() return r.te...
Python
0.999871
02f59b60062004fc23dbfbfc6201b326b08513a8
Add 404 exception
src/client/exceptions.py
src/client/exceptions.py
class HTTP4xx(Exception): pass class HTTP400(HTTP4xx): pass class HTTP404(HTTP4xx): pass class HTTP409(HTTP4xx): pass
class HTTP4xx(Exception): pass class HTTP400(HTTP4xx): pass class HTTP409(HTTP4xx): pass
Python
0.000019
8d06ccd7aeefe5945bab44b01764bd62685a2e17
Add missing member to API.
mindbender/api.py
mindbender/api.py
"""Public API Anything that is not defined here is **internal** and unreliable for external use. Motivation for api.py: Storing the API in a module, as opposed to in __init__.py, enables use of it internally. For example, from `pipeline.py`: >> from . import api >> api.do_this() The ...
"""Public API Anything that is not defined here is **internal** and unreliable for external use. Motivation for api.py: Storing the API in a module, as opposed to in __init__.py, enables use of it internally. For example, from `pipeline.py`: >> from . import api >> api.do_this() The ...
Python
0
f68e8612f1e8198a4b300b67536d654e13809eb4
Allow SHA256 hashes in URLs
plinth/modules/monkeysphere/urls.py
plinth/modules/monkeysphere/urls.py
# # This file is part of Plinth. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
# # This file is part of Plinth. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
Python
0.000004
547c9e36255870bcee8a800a3fa95c3806a95c2c
Update links when it starts getting redirected
newsApp/linkManager.py
newsApp/linkManager.py
import os import time from constants import * from dbhelper import * from dbItemManagerV2 import DbItemManagerV2 from link import Link LINK_EXPIRY_TIME_IN_DAYS = 80 class LinkManager(DbItemManagerV2): """ Manage links stored on AWS dynamo db database. Contains functions for CRUD operations on the links ...
import os import time from constants import * from dbhelper import * from dbItemManagerV2 import DbItemManagerV2 from link import Link LINK_EXPIRY_TIME_IN_DAYS = 80 class LinkManager(DbItemManagerV2): """ Manage links stored on AWS dynamo db database. Contains functions for CRUD operations on the links ...
Python
0
366ecdd77520004c307cbbf127bb374ab546ce7e
Use windows API to change the AppID and use our icon.
run-quince.py
run-quince.py
#!/usr/bin/env python3 # coding: utf-8 # Raytheon BBN Technologies 2016 # Contributiors: Graham Rowlands # # This file runs the main loop # Use PyQt5 by default import os os.environ["QT_API"] = 'pyqt5' from qtpy.QtWidgets import QApplication import sys import argparse import ctypes from quince.view import * if __na...
#!/usr/bin/env python3 # coding: utf-8 # Raytheon BBN Technologies 2016 # Contributiors: Graham Rowlands # # This file runs the main loop # Use PyQt5 by default import os os.environ["QT_API"] = 'pyqt5' from qtpy.QtWidgets import QApplication import sys import argparse from quince.view import * if __name__ == "__mai...
Python
0
976e9b622b66bee30d304a801cc39733cc3e8d58
refactor to reduce size of __init__
wikichatter/section.py
wikichatter/section.py
import mwparserfromhell as mwp class Error(Exception): pass class TooManyHeadingsError(Error): pass EPI_LEVEL = 0 class Section(object): def __init__(self, wikitext): self._subsections = [] self.comments = [] wikicode = self._get_wikicode_from_input(wikitext) self._l...
import mwparserfromhell as mwp class Error(Exception): pass class TooManyHeadingsError(Error): pass EPI_LEVEL = 0 class Section(object): def __init__(self, wikitext): self._subsections = [] self.comments = [] # wikitext can be either a wikicode object or a string if...
Python
0.000005
9e6b596aa856e1d50a9c2c2882289cf1a5d8c0c0
Fix up plotting script
plot.py
plot.py
#!/usr/bin/env python """Processing routines for the waveFlapper case.""" import foampy import numpy as np import matplotlib.pyplot as plt width_2d = 0.1 width_3d = 3.66 m_paddle = 1270.0 # Paddle mass in kg, from OMB manual h_piston = 3.3147 I_paddle = 1/3*m_paddle*h_piston**2 def plot_force(): """Plots the s...
#!/usr/bin/env python """Processing routines for the waveFlapper case.""" import foampy import numpy as np import matplotlib.pyplot as plt width_2d = 0.1 width_3d = 3.66 m_paddle = 1270.0 # Paddle mass in kg, from OMB manual h_piston = 3.3147 I_paddle = 1/3*m_paddle*h_piston**2 def plot_force(): """Plots the ...
Python
0.000095
8d6fcc6d318423e87e9942c2551c0d9b3c282e25
Allow TELEGRAM_TEMPLATE to be a string (#208)
plugins/telegram/alerta_telegram.py
plugins/telegram/alerta_telegram.py
import logging import os try: from alerta.plugins import app # alerta >= 5.0 except ImportError: from alerta.app import app # alerta < 5.0 from alerta.plugins import PluginBase import telepot from jinja2 import Template, UndefinedError DEFAULT_TMPL = """ {% if customer %}Customer: `{{customer}}` {% endif %...
import logging import os try: from alerta.plugins import app # alerta >= 5.0 except ImportError: from alerta.app import app # alerta < 5.0 from alerta.plugins import PluginBase import telepot from jinja2 import Template, UndefinedError DEFAULT_TMPL = """ {% if customer %}Customer: `{{customer}}` {% endif %...
Python
0.000002
5a6cdb9dc08924dc90a24271dc45f4412250b06a
bump version
src/experimentator/__version__.py
src/experimentator/__version__.py
__version__ = '0.2.1'
__version__ = '0.2.0'
Python
0
101f8c44ec0b55111f93e7c2a0d8f1710405452f
FIX get_name funtion
addons/nautical_search_by_ni/res_partner.py
addons/nautical_search_by_ni/res_partner.py
# -*- coding: utf-8 -*- import datetime from lxml import etree import math import pytz import re import openerp from openerp import SUPERUSER_ID from openerp import pooler, tools from openerp.osv import osv, fields from openerp.tools.translate import _ from openerp.tools.yaml_import import is_comment class res_partn...
# -*- coding: utf-8 -*- import datetime from lxml import etree import math import pytz import re import openerp from openerp import SUPERUSER_ID from openerp import pooler, tools from openerp.osv import osv, fields from openerp.tools.translate import _ from openerp.tools.yaml_import import is_comment class res_partn...
Python
0.000002
7b3f447e7fa83eed97b9d54fe79db01ea325f1d2
Drop cargo-culted pin
application/setup.py
application/setup.py
from setuptools import setup name = 'senic.nuimo_hub' setup( name=name, version_format='{tag}.{commitcount}+{gitsha}', url='https://github.com/getsenic/nuimo-hub-app', author='Senic GmbH', author_email='tom@senic.com', description='...', classifiers=[ "Programming Language :: Pyt...
from setuptools import setup name = 'senic.nuimo_hub' setup( name=name, version_format='{tag}.{commitcount}+{gitsha}', url='https://github.com/getsenic/nuimo-hub-app', author='Senic GmbH', author_email='tom@senic.com', description='...', classifiers=[ "Programming Language :: Pyt...
Python
0
c880b8d7388cb700eee8184bda9f117d0a86887d
Update WinRMWebService. Implement __init__ and open_shell methods
winrm/winrm_service.py
winrm/winrm_service.py
from datetime import timedelta import uuid from http.transport import HttpPlaintext from isodate.isoduration import duration_isoformat import xmlwitch import requests import xml.etree.ElementTree as ET class WinRMWebService(object): """ This is the main class that does the SOAP request/response logic. There ar...
from datetime import timedelta from http.transport import HttpPlaintext from isodate.isoduration import duration_isoformat class WinRMWebService(object): """ This is the main class that does the SOAP request/response logic. There are a few helper classes, but pretty much everything comes through here first...
Python
0.000034
52dd018d08e00356218cb2789cee10976eff4359
Disable automatic geocoding for addresses in Django admin
firecares/firecares_core/admin.py
firecares/firecares_core/admin.py
import autocomplete_light from .models import Address, ContactRequest, AccountRequest, RegistrationWhitelist from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.gis import admin from import_export.admin impo...
import autocomplete_light from .models import Address, ContactRequest, AccountRequest, RegistrationWhitelist from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.gis import admin from import_export.admin impo...
Python
0
7b3f239964c6663a9b655553202567fccead85c8
Add 'me' to profile IdentifierError
mollie/api/resources/profiles.py
mollie/api/resources/profiles.py
from ..error import IdentifierError from ..objects.profile import Profile from .base import Base class Profiles(Base): RESOURCE_ID_PREFIX = 'pfl_' def get_resource_object(self, result): return Profile(result, self.client) def get(self, profile_id, **params): if not profile_id or \ ...
from ..error import IdentifierError from ..objects.profile import Profile from .base import Base class Profiles(Base): RESOURCE_ID_PREFIX = 'pfl_' def get_resource_object(self, result): return Profile(result, self.client) def get(self, profile_id, **params): if not profile_id or \ ...
Python
0.000003
b000bef2ec323dc9b7862a828ab1fd2e9574f3b0
allow networks to be read from Document objects as well as filenames
nineml/user/network.py
nineml/user/network.py
from itertools import chain from .population import Population from .projection import Projection from .selection import Selection from ..document import Document from . import BaseULObject from .component import write_reference, resolve_reference from nineml.annotations import annotate_xml, read_annotations from ninem...
from itertools import chain from .population import Population from .projection import Projection from .selection import Selection from ..document import Document from . import BaseULObject from .component import write_reference, resolve_reference from nineml.annotations import annotate_xml, read_annotations from ninem...
Python
0
5efdd29804249b40c9b9e589cb00cf10c56decb0
Add the standard imports
conveyor/tasks/bulk.py
conveyor/tasks/bulk.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import datetime import logging import time from requests.exceptions import ConnectionError, HTTPError from ..core import Conveyor logger = logging.getLogger(__name__) # We ignore the last component as w...
import datetime import logging import time from requests.exceptions import ConnectionError, HTTPError from ..core import Conveyor logger = logging.getLogger(__name__) # We ignore the last component as we cannot properly handle it def get_jobs(last=0): current = time.mktime(datetime.datetime.utcnow().timetuple...
Python
0.000378