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 |
|---|---|---|---|---|---|---|---|
e3f53b37a276680bd12806ed14d09065d35d583e | Debug logs | dataactcore/scripts/agency_move_s3_files.py | dataactcore/scripts/agency_move_s3_files.py | import boto3
import logging
import argparse
from dataactcore.config import CONFIG_BROKER
from dataactcore.logging import configure_logging
from dataactvalidator.health_check import create_app
logger = logging.getLogger(__name__)
def move_published_agency_files(old_code, new_code):
""" Given the provided old an... | import boto3
import logging
import argparse
from dataactcore.config import CONFIG_BROKER
from dataactcore.logging import configure_logging
from dataactvalidator.health_check import create_app
logger = logging.getLogger(__name__)
def move_published_agency_files(old_code, new_code):
""" Given the provided old an... | Python | 0.000001 |
ac3697fbb5202437d8285cacaba89dbaba30de69 | fix refactoring error | util.py | util.py | import logging
A_THRU_H = 'ABCDEFGH'
# pre-compute an array mapping to algebraic notation
NUMERICAL_TO_ALGEBRAIC = ["{}{}".format(l, n) for n in range(8, 0, -1) for l in A_THRU_H]
# pre-compute a dict mapping to the index
ALGEBRAIC_TO_NUMERICAL = {a:n for n, a in enumerate(NUMERICAL_TO_ALGEBRAIC)}
TOP_LEFT_SQUARE =... | import logging
A_THRU_H = 'ABCDEFGH'
# pre-compute an array mapping to algebraic notation
NUMERICAL_TO_ALGEBRAIC = ["{}{}".format(l, n) for n in range(8, 0, -1) for l in A_THRU_H]
# pre-compute a dict mapping to the index
ALGEBRAIC_TO_NUMERICAL = {a:n for n, a in enumerate(NUMERICAL_TO_ALGEBRAIC)}
TOP_LEFT_SQUARE =... | Python | 0.000005 |
ae6bb29262421bcdb9f28bed8fce99517fa4ecc1 | Update tests. | st2common/tests/unit/test_content_utils.py | st2common/tests/unit/test_content_utils.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Python | 0 |
65524f41729d1ddcda9ecb66947b85119c80cd18 | format util.py | util.py | util.py | #!/usr/bin/env python
import couchdb, sys
from oaipmh.client import Client
from oaipmh.common import Identify, Metadata, Header
from oaipmh.metadata import MetadataRegistry, oai_dc_reader , MetadataReader
def get_database(url,name):
try:
couch = couchdb.Server(url)
db = couch[name]
return d... | #!/usr/bin/env python
import couchdb, sys
from oaipmh.client import Client
from oaipmh.common import Identify, Metadata, Header
from oaipmh.metadata import MetadataRegistry, oai_dc_reader , MetadataReader
def get_database(url,name):
try:
couch = couchdb.Server(url)
db = couch[name]
return d... | Python | 0.000009 |
58412bf4ac5adb78c82060c259803c745c52f861 | Bump version | stock_request_picking_type/__manifest__.py | stock_request_picking_type/__manifest__.py | # Copyright 2019 Open Source Integrators
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
'name': 'Stock Request Picking Type',
'summary': 'Add Stock Requests to the Inventory App',
'version': '12.0.1.1.0',
'license': 'LGPL-3',
'website': 'https://github.com/stock-logistics-w... | # Copyright 2019 Open Source Integrators
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
'name': 'Stock Request Picking Type',
'summary': 'Add Stock Requests to the Inventory App',
'version': '12.0.1.0.0',
'license': 'LGPL-3',
'website': 'https://github.com/stock-logistics-w... | Python | 0 |
bc6512080bd67413a3136e171be2cc1479254caf | Change startup experiment. | enactiveagents/EnactiveAgents.py | enactiveagents/EnactiveAgents.py | """
Entry module of the application.
"""
import sys
import pygame
from appstate import AppState
import settings
import events
from view import view
from view import agentevents
from controller import controller
import experiment.basic
import webserver
class HeartBeat(events.EventListener):
"""
Class implement... | """
Entry module of the application.
"""
import sys
import pygame
from appstate import AppState
import settings
import events
from view import view
from view import agentevents
from controller import controller
import experiment.basic
import webserver
class HeartBeat(events.EventListener):
"""
Class implement... | Python | 0 |
9d2f25c2a262a992c79ea5a224c5abc616dd4cb8 | remove space. | lib/acli/__init__.py | lib/acli/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
usage: acli [--version] [--help]
<command> [<args>...]
options:
-h, --help help
The most common commands are:
account Get account info
ec2 Manage ec2 instances
elb Manage elb instances
ami Manage amis
as... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
usage: acli [--version] [--help]
<command> [<args>...]
options:
-h, --help help
The most common commands are:
account Get account info
ec2 Manage ec2 instances
elb Manage elb instances
ami Manage amis
a... | Python | 0.000413 |
f887c7c5fc0be7e86ebddb28b6d785878ae88121 | Add projects to locals in projects_archive | projects/views.py | projects/views.py | from django.contrib.auth.decorators import login_required, permission_required
from django.shortcuts import render, get_object_or_404, redirect
from .models import Project
from .forms import ProjectForm, RestrictedProjectForm
@login_required
def add_project(request):
data = request.POST if request.POST else Non... | from django.contrib.auth.decorators import login_required, permission_required
from django.shortcuts import render, get_object_or_404, redirect
from .models import Project
from .forms import ProjectForm, RestrictedProjectForm
@login_required
def add_project(request):
data = request.POST if request.POST else Non... | Python | 0 |
608f667f8d3a9faa8fc41777b2006c325afff61c | Fix var names. | vote.py | vote.py | import enki
import json
e = enki.Enki('key', 'http://localhost:5001', 'translations')
e.get_all()
tasks = []
for t in e.tasks:
options = []
i = 0
for k in e.task_runs_df[t.id]['msgstr'].keys():
option = dict(task_run_id=None, msgstr=None)
option['task_run_id'] = k
option['msgstr... | import enki
import json
e = enki.Enki('key', 'http://localhost:5001', 'translations')
e.get_all()
tasks = []
for t in e.tasks:
options = []
i = 0
for k in e.task_runs_df[t.id]['msgid'].keys():
option = dict(task_run_id=None, msgid=None)
option['task_run_id'] = k
option['msgid'] ... | Python | 0.000002 |
a8681015902101192caeaff6c755069d406f3d0e | Support NonNode << Node, limit scope in conf_load. | conf.py | conf.py | """
Pyconf DSL for generating JSON or Protobuf configuration.
"""
class Node(object):
def __init__(self, value):
self._value = value
def execute(self):
def _unwrap(item):
if isinstance(item, Node):
return item.execute()
else:
return item
if isinstance(self._value, dict):
... | """
Pyconf DSL for generating JSON or Protobuf configuration.
"""
class Node(object):
def __init__(self, value):
self._value = value
def execute(self):
def _unwrap(item):
if isinstance(item, Node):
return item.execute()
else:
return item
if isinstance(self._value, dict):
... | Python | 0 |
5347040b86f02a0abec4da5c3060b094908bb9b5 | Simplify argument handling logic. | wpcr.py | wpcr.py | #!/usr/bin/python
import numpy
import scipy.signal
tau = numpy.pi * 2
max_samples = 1000000
debug = False
# determine the clock frequency
# input: magnitude spectrum of clock signal (numpy array)
# output: FFT bin number of clock frequency
def find_clock_frequency(spectrum):
maxima = scipy.signal.argrelextrema(s... | #!/usr/bin/python
import numpy
import scipy.signal
tau = numpy.pi * 2
max_samples = 1000000
debug = False
# determine the clock frequency
# input: magnitude spectrum of clock signal (numpy array)
# output: FFT bin number of clock frequency
def find_clock_frequency(spectrum):
maxima = scipy.signal.argrelextrema(s... | Python | 0.000013 |
3478bf108ce6992239c638e6e662a6e53204ae46 | Update wsgi.py for port | wsgi.py | wsgi.py | from app import create_app
application = create_app()
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
application.run(host='0.0.0.0', port=port) | from app import create_app
application = create_app()
if __name__ == '__main__':
application.run() | Python | 0 |
6d643c1f4fca74e66513d0461fc358bb1dd21349 | add method to parse out [xml-handlers] section in process.cfg | lib/config_parser.py | lib/config_parser.py | from ConfigParser import ConfigParser
defaults = {'parse': 'defaultparse',
'clean': 'True',
'consolidate': 'True',
'datadir': '/data/patentdata/patents/2013',
'dataregex': 'ipg\d{6}.xml',
'years': None,
'downloaddir' : None}
def extract_process_o... | from ConfigParser import ConfigParser
defaults = {'parse': 'defaultparse',
'clean': 'True',
'consolidate': 'True',
'datadir': '/data/patentdata/patents/2013',
'dataregex': 'ipg\d{6}.xml',
'years': None,
'downloaddir' : None}
def extract_process_o... | Python | 0 |
cf0f7f129bb54c70f60e19e2ec9d82a67f430aaf | replace urllib2 to requests lib | coti.py | coti.py | #!/usr/bin/python
import json
import urllib2
import requests
from bs4 import BeautifulSoup
from datetime import datetime
def chaco():
try:
soup = BeautifulSoup(
requests.get('http://www.cambioschaco.com.py/php/imprimir_.php', timeout=8).text, "html.parser")
compra = soup.find_all('tr'... | #!/usr/bin/python
import json
import urllib2
from bs4 import BeautifulSoup
from datetime import datetime
def chaco():
try:
soup = BeautifulSoup(
urllib2.urlopen('http://www.cambioschaco.com.py/php/imprimir_.php').read(), "html.parser")
compra = soup.find_all('tr')[3].contents[5].strin... | Python | 0.000205 |
4d5cc0dfc6f9f460cfc54dfebf2061428ae2ee97 | implement a removing of gitlab's objects | crud.py | crud.py | '''
generic CRUD oparations for the gitlab's objects
'''
import http
class Crud():
def __init__(self, path):
self.path = path
'''
get an object by system's name and id
'''
def byId(self, sysNam, id):
return http.get(sysNam, '%s/%d' % (self.path, id))
'''
add a new instance of an object
'''
def add(self... | '''
generic CRUD oparations for the gitlab's objects
'''
import http
class Crud():
def __init__(self, path):
self.path = path
'''
get an object by system's name and id
'''
def byId(self, sysNam, id):
return http.get(sysNam, '%s/%d' % (self.path, id))
'''
add a new instance of an object
'''
def add(self... | Python | 0.999861 |
baa81fb776af4b6811bf434a75f808f0aeae056b | fix load watering-topic from config | main.py | main.py | import argparse
import json
import logging
import logging.config
import os
import paho.mqtt.client as mqtt
import yaml
from services.data_service import DataService
from services.watering_service import WateringService
from services.config_service import ConfigService
def load_args():
# setup commandline argume... | import argparse
import json
import logging
import logging.config
import os
import paho.mqtt.client as mqtt
import yaml
from services.data_service import DataService
from services.watering_service import WateringService
from services.config_service import ConfigService
def load_args():
# setup commandline argume... | Python | 0.000001 |
b694436d4d8b6ee0b4b4a8078e0b34f779b17751 | Set a nice app-icon | main.py | main.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Andreas Pakulat <apaku@gmx.de>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Andreas Pakulat <apaku@gmx.de>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | Python | 0 |
c5b7cf7cdd8a91162441a17f9d0b70db197249c0 | make main runnable | main.py | main.py | #!/usr/bin/env python3
from collaborator.http_server.http_server import entryPoint
if __name__ == '__main__':
entryPoint()
|
from collaborator.http_server.http_server import entryPoint
if __name__ == '__main__':
entryPoint()
| Python | 0.000063 |
0dce5a6524ebc5020991ab301cd0b080ad27ddf6 | Fix self prefix | main.py | main.py | #!/usr/bin/env python3
import asyncio
from datetime import datetime
import logging
import lzma
from pathlib import Path
import os
import sys
import tarfile
from discord.ext.commands import when_mentioned_or
import yaml
from bot import BeattieBot
try:
import uvloop
except ImportError:
pass
else:
asyncio.s... | #!/usr/bin/env python3
import asyncio
from datetime import datetime
import logging
import lzma
from pathlib import Path
import os
import sys
import tarfile
from discord.ext.commands import when_mentioned_or
import yaml
from bot import BeattieBot
try:
import uvloop
except ImportError:
pass
else:
asyncio.s... | Python | 0.999974 |
08650ad083e9ca4790ea627e8ab0ae670f7ef60b | Add merge function to rd_models (#3464) | angr/knowledge_plugins/key_definitions/rd_model.py | angr/knowledge_plugins/key_definitions/rd_model.py | from typing import Dict, Tuple, Set, Optional, TYPE_CHECKING
from .uses import Uses
from .live_definitions import LiveDefinitions
if TYPE_CHECKING:
from angr.knowledge_plugins.key_definitions.definition import Definition
# TODO: Make ReachingDefinitionsModel serializable
class ReachingDefinitionsModel:
"""
... | from typing import Dict, Tuple, Set, Optional, TYPE_CHECKING
from .uses import Uses
from .live_definitions import LiveDefinitions
if TYPE_CHECKING:
from angr.knowledge_plugins.key_definitions.definition import Definition
# TODO: Make ReachingDefinitionsModel serializable
class ReachingDefinitionsModel:
def ... | Python | 0 |
9eeae893b8e777fa5f50733e6580b731a00a5170 | kill useless plugin registration logic | tenderloin/listeners/message.py | tenderloin/listeners/message.py | import json
import logging
import time
import zmq
from collections import defaultdict
from zmq.eventloop import zmqstream
from tenderloin.listeners import plugin_data
PLUGIN_TIMEOUT = 300
class PluginData(object):
def __init__(self, name, uuid, fqdn, tags, data):
self.name = name
self.uuid = uu... | import json
import logging
import time
import zmq
from collections import defaultdict
from zmq.eventloop import zmqstream
from tenderloin.listeners import plugin_data
PLUGIN_TIMEOUT = 300
class PluginData(object):
def __init__(self, name, uuid, fqdn, tags, data):
self.name = name
self.uuid = uu... | Python | 0 |
44537a6496b1b67511ea7008418b6d1a7a30fdf4 | move the resolve cache into TLS | claripy/result.py | claripy/result.py | import copy
import collections
import weakref
import threading
class Result(object):
def __init__(self, satness, model=None, approximation=False, backend_model=None):
self.sat = satness
self.model = model if model is not None else { }
self._tls = threading.local()
self._tls.backend... | import copy
import collections
import weakref
import threading
class Result(object):
def __init__(self, satness, model=None, approximation=False, backend_model=None):
self.sat = satness
self.model = model if model is not None else { }
self._tls = threading.local()
self._tls.backend... | Python | 0.000001 |
ecdf23c53c34a3773e2ca10be2c445c01381a7b0 | on 64 bits python array.array("L").itemsize is 8 | classification.py | classification.py | from feature_extraction import FEATURE_DATATYPE
import numpy
import cv2
CLASS_DATATYPE= numpy.uint16
CLASS_SIZE= 1
CLASSES_DIRECTION= 0 #vertical - a classes COLUMN
BLANK_CLASS= chr(35) #marks unclassified elements
def classes_to_numpy( classes ):
'''given a list of unicode chars, transforms ... | from feature_extraction import FEATURE_DATATYPE
import numpy
import cv2
CLASS_DATATYPE= numpy.uint16
CLASS_SIZE= 1
CLASSES_DIRECTION= 0 #vertical - a classes COLUMN
BLANK_CLASS= chr(35) #marks unclassified elements
def classes_to_numpy( classes ):
'''given a list of unicode chars, transforms ... | Python | 0.999988 |
76648057b18055afc3724769aa9240eb477e4533 | Handle HJSON decode exception | main.py | main.py | """Usage: chronicler [-c CHRONICLE]
The Chronicler remembers…
Options:
-c, --chronicle CHRONICLE chronicle file to use [default: chronicle.txt]
"""
import docopt
import hjson
if __name__ == '__main__':
options = docopt.docopt(__doc__)
try:
chronicle = open(options['--chronicle'])
except F... | """Usage: chronicler [-c CHRONICLE]
The Chronicler remembers…
Options:
-c, --chronicle CHRONICLE chronicle file to use [default: chronicle.txt]
"""
from docopt import docopt
import hjson
if __name__ == '__main__':
options = docopt(__doc__)
try:
chronicle = open(options['--chronicle'])
exc... | Python | 0.000003 |
e80dce758a17c304fd938dda62f0a5e2e7d7bcec | change 1 | main.py | main.py |
import webapp2
import jinja2
import requests
import os
import sys
import time
import logging
import urllib2
import json
import re
from operator import itemgetter
from datetime import datetime
from google.appengine.ext import db
from webapp2_extras import sessions
from google.appengine.api import mail
#demo change1
t... |
import webapp2
import jinja2
import requests
import os
import sys
import time
import logging
import urllib2
import json
import re
from operator import itemgetter
from datetime import datetime
from google.appengine.ext import db
from webapp2_extras import sessions
from google.appengine.api import mail
template_dir =... | Python | 0.000005 |
db6203757d145923813c06b62ddf3739bac79991 | Update __init__.py | tendrl/commons/objects/cluster/__init__.py | tendrl/commons/objects/cluster/__init__.py | from tendrl.commons import objects
class Cluster(objects.BaseObject):
def __init__(self, integration_id=None, public_network=None,
cluster_network=None, node_configuration=None,
conf_overrides=None, node_identifier=None, sync_status=None,
last_sync=None, is_manag... | from tendrl.commons import objects
class Cluster(objects.BaseObject):
def __init__(self, integration_id=None, public_network=None,
cluster_network=None, node_configuration=None,
conf_overrides=None, node_identifier=None, sync_status=None,
last_sync=None, *args, *... | Python | 0.000002 |
81943166d5b8c2606c1506bb1b6567fd0ce82282 | update check_dimension and webm supports | main.py | main.py | import os
import logging
from glob import glob
import youtube_dl
from telegram.ext import Updater, MessageHandler, Filters
from vid_utils import check_dimension
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
updater = Update... | import os
import logging
from glob import glob
import youtube_dl
from telegram.ext import Updater, MessageHandler, Filters
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
updater = Updater(token='TOKEN') # put here the b... | Python | 0 |
d25f860c56e4e51203574ee8da4297c7aaa6195a | Bump version to 0.1.3 | td_biblio/__init__.py | td_biblio/__init__.py | """TailorDev Biblio
Scientific bibliography management with Django.
"""
__version__ = '0.1.3'
| """TailorDev Biblio
Scientific bibliography management with Django.
"""
__version__ = '0.1.2'
| Python | 0.000001 |
c749e5e4c47a9a63dc0e44bbc8df3b103dc1db7c | update to screen manager | main.py | main.py | '''
# Author: Aaron Gruneklee, Michael Asquith
# Created: 2014.12.08
# Last Modified: 2014.12.19
this is the main controler class it is responsible for displaying the 3 views and
controls the 5 input buttons.
'''
from kivy import require
from kivy.app import App
from kivy.uix.widget import Widget
from k... | '''
# Author: Aaron Gruneklee, Michael Asquith
# Created: 2014.12.08
# Last Modified: 2014.12.19
this is the main controler class it is responsible for displaying the 3 views and
controls the 5 input buttons.
'''
from kivy import require
from kivy.app import App
from kivy.uix.widget import Widget
from k... | Python | 0 |
f06f81251d7c8d1a12e88d54c1856756979edb7d | Fix tests for Django 1.5 | django_socketio/example_project/settings.py | django_socketio/example_project/settings.py |
import os, sys
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
full_path = lambda *parts: os.path.join(PROJECT_ROOT, *parts)
example_path = full_path("..", "..")
if example_path not in sys.path:
sys.path.append(example_path)
DEBUG = T... |
import os, sys
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
full_path = lambda *parts: os.path.join(PROJECT_ROOT, *parts)
example_path = full_path("..", "..")
if example_path not in sys.path:
sys.path.append(example_path)
DEBUG = T... | Python | 0.00001 |
3fbbba8dae5c97cedf414eea8a39482c01a269e6 | Add `debug=True` to avoid restarting the server after each change | main.py | main.py |
import io
import json
import logging
import os
import pdb
import traceback
from logging import config
from functools import wraps
from flask import (
Flask,
render_template,
request,
send_file,
send_from_directory,
)
app = Flask(__name__)
config.fileConfig('logger.conf')
logger = logging.getLo... |
import io
import json
import logging
import os
import pdb
import traceback
from logging import config
from functools import wraps
from flask import (
Flask,
render_template,
request,
send_file,
send_from_directory,
)
app = Flask(__name__)
config.fileConfig('logger.conf')
logger = logging.getLo... | Python | 0.000003 |
466eabcb57c590dce1342710c8ae331899046417 | Simplify postwork | main.py | main.py | import csv
import importlib
import logging
import operator
import os
import time
import sys
from functools import reduce
from datetime import datetime
from dev.logger import logger_setup
from helpers.config import Config
from helpers.data_saver import DataSaver
from helpers.module_loader import ModuleLoader
def ini... | import csv
import importlib
import logging
import operator
import os
import time
import sys
from functools import reduce
from datetime import datetime
from dev.logger import logger_setup
from helpers.config import Config
from helpers.data_saver import DataSaver
from helpers.module_loader import ModuleLoader
def ini... | Python | 0.000006 |
ce9f5f4072c38f8b31f0d8c01228caede4ff5897 | disable int export | main.py | main.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from modules.utils import export_obj
from modules.utils import load_obj
from modules.utils import random_unit_vec
from modules.utils import get_surface_edges
PROCS = 4
NMAX = int(10e6)
ITT = int(10e9)
OPT_ITT = 1
NEARL = 0.003
H = NEAR... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from modules.utils import export_obj
from modules.utils import load_obj
from modules.utils import random_unit_vec
from modules.utils import get_surface_edges
PROCS = 4
NMAX = int(10e6)
ITT = int(10e9)
OPT_ITT = 1
NEARL = 0.003
H = NEAR... | Python | 0 |
40b102b00f86bd375bbdab86bdec62f85496f601 | Add proper logging | main.py | main.py | #!/usr/bin/env python
import RPi.GPIO as GPIO
import datetime
import logging
import requests
import settings
import time
import threading
class Pin(object):
URL = settings.API_URL + settings.NAME + '/'
def post(self, data):
logging.debug('Ready to send a POST request for {url} with data {data}'.f... | #!/usr/bin/env python
import RPi.GPIO as GPIO
import datetime
import requests
import settings
import time
import threading
class Pin(object):
URL = settings.API_URL + settings.NAME + '/'
def post(self, data):
data['api_key'] = settings.API_KEY
r = requests.post(self.URL + self.relativ... | Python | 0.000013 |
a658b1268f8a2a31d3a5cb56ab0b12f8290d474c | Add functions to calculate cluster statistics averages over many realizations | percolation/analysis/clusters.py | percolation/analysis/clusters.py | import numpy as np
# % Single value % #
def cluster_densities(count, L):
return count/(L*L)
def percolating_cluster_mass(size, percolated):
idx_percolated = np.where(percolated > 0)[0]
if idx_percolated.size == 0:
return 0
return np.average(size[idx_percolated], weights=percolated[idx_percola... | import numpy as np
# % Single value % #
def cluster_densities(count, L):
return count/(L*L)
def percolating_cluster_mass(size, percolated):
idx_percolated = np.where(percolated > 0)[0]
if idx_percolated.size == 0:
return 0
return np.average(size[idx_percolated], weights=percolated[idx_percola... | Python | 0 |
7119c07b422f823f40939691fa84f0c2581ae70d | Fix the REST module name. | test/unit/helpers/test_qiprofile_helper.py | test/unit/helpers/test_qiprofile_helper.py | import datetime
import pytz
from nose.tools import (assert_is_none)
from qipipe.helpers.qiprofile_helper import QIProfile
from qiprofile_rest.models import Project
from test import project
from test.helpers.logging_helper import logger
SUBJECT = 'Breast099'
"""The test subject."""
SESSION = 'Session01'
"""The test s... | import datetime
import pytz
from nose.tools import (assert_is_none)
from qipipe.helpers.qiprofile_helper import QIProfile
from qiprofile.models import Project
from test import project
from test.helpers.logging_helper import logger
SUBJECT = 'Breast099'
"""The test subject."""
SESSION = 'Session01'
"""The test sessio... | Python | 0.000003 |
700e0889d3e38e74d2c96fc653657ca16fbb5009 | lower its max value to 40 | aot/cards/trumps/gauge.py | aot/cards/trumps/gauge.py | ################################################################################
# Copyright (C) 2016 by Arena of Titans Contributors.
#
# This file is part of Arena of Titans.
#
# Arena of Titans is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as pu... | ################################################################################
# Copyright (C) 2016 by Arena of Titans Contributors.
#
# This file is part of Arena of Titans.
#
# Arena of Titans is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as pu... | Python | 0.999835 |
6a8f7b3ddf6c43565efeda5d21de714808e98785 | Add sample yaml data | hubblestack_nova/modules/netstat.py | hubblestack_nova/modules/netstat.py | # -*- encoding: utf-8 -*-
'''
Hubble Nova plugin for FreeBSD pkgng audit
:maintainer: HubbleStack
:maturity: 20160623
:platform: Unix
:requires: SaltStack
Sample data for the netstat whitelist:
.. code-block:: yaml
netstat:
ssh:
address: 0.0.0.0:22
another_identifier:
add... | # -*- encoding: utf-8 -*-
'''
Hubble Nova plugin for FreeBSD pkgng audit
:maintainer: HubbleStack
:maturity: 20160623
:platform: Unix
:requires: SaltStack
'''
from __future__ import absolute_import
import copy
import logging
import salt.utils
log = logging.getLogger(__name__)
def __virtual__():
if 'network.ne... | Python | 0 |
1f72d0fc0fb8222ca8ffb69c164e4d118e1a9d1d | update version | meta.py | meta.py | #!/usr/bin/env python3
# @Time : 17-9-10 01:08
# @Author : Wavky Huang
# @Contact : master@wavky.com
# @File : meta.py
"""
"""
PROJECT_NAME = 'ManHourCalendar'
VERSION = '0.9.1b2'
AUTHOR = 'Wavky Huang'
AUTHOR_EMAIL = 'master@wavky.com'
| #!/usr/bin/env python3
# @Time : 17-9-10 01:08
# @Author : Wavky Huang
# @Contact : master@wavky.com
# @File : meta.py
"""
"""
PROJECT_NAME = 'ManHourCalendar'
VERSION = '0.9.1a2'
AUTHOR = 'Wavky Huang'
AUTHOR_EMAIL = 'master@wavky.com'
| Python | 0 |
f98a2f11768db262dcf5113375edc8fdcf7d5304 | Fix Build Time | meta.py | meta.py | # TODO: Use Celery to properly manage updates, and provide dyanmic updates as everything progresses.
# TODO: Integrate with GitLab Webhooks
# TODO: Integrate with GitLab <-> Heroku
import datetime
import hashlib
import hmac
import json
import logging
import os
import threading
from flask import abort, Blueprint, json... | # TODO: Use Celery to properly manage updates, and provide dyanmic updates as everything progresses.
# TODO: Integrate with GitLab Webhooks
# TODO: Integrate with GitLab <-> Heroku
import datetime
import hashlib
import hmac
import json
import logging
import os
import threading
from flask import abort, Blueprint, json... | Python | 0 |
52e004e9a14f4cbcd56503ea0f1652cf5e4ed853 | test untested ipcore interfaces | hwtLib/tests/ipCorePackager_test.py | hwtLib/tests/ipCorePackager_test.py | import shutil
import tempfile
import unittest
from hwt.hdlObjects.types.array import Array
from hwt.hdlObjects.types.struct import HStruct
from hwt.interfaces.std import BramPort, Handshaked
from hwt.serializer.ip_packager.interfaces.std import IP_Handshake
from hwt.serializer.ip_packager.packager import Packager
from... | import shutil
import tempfile
import unittest
from hwt.hdlObjects.types.array import Array
from hwt.hdlObjects.types.struct import HStruct
from hwt.serializer.ip_packager.packager import Packager
from hwtLib.amba.axi4_streamToMem import Axi4streamToMem
from hwtLib.amba.axiLite_comp.endpoint import AxiLiteEndpoint
from... | Python | 0 |
a1d9247e0d72a468e0fa70793501cd2e7dfec854 | Update wsgi.py. | clintools/wsgi.py | clintools/wsgi.py | import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('/home/washu/.virtualenvs/osler/local/lib/python2.7/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/home/washu/clintools')
sys.path.append('/home/washu/clintools/clintools')
os... | """
WSGI config for clintools project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | Python | 0 |
937aa61393f46167806c1f4913c42e873ea1c435 | fix misc.lastfile() | misc.py | misc.py | """miscellaneous definitions"""
from math import ceil
import os.path
def file_name(args, par_type):
"""returns file name format for any time step"""
return args.name + '_' + par_type + '{:05d}'
def path_fmt(args, par_type):
"""returns full path format for any time step"""
return os.path.join(args... | """miscellaneous definitions"""
from math import ceil
import os.path
def file_name(args, par_type):
"""returns file name format for any time step"""
return args.name + '_' + par_type + '{:05d}'
def path_fmt(args, par_type):
"""returns full path format for any time step"""
return os.path.join(args.... | Python | 0.000001 |
6fdba909f03090649bee2255770a570114ed117f | Fix lint errors | manage.py | manage.py | #!/usr/bin/env python
import os.path as p
from subprocess import call
from flask.ext.script import Manager
from app import create_app
manager = Manager(create_app)
manager.add_option('-m', '--cfgmode', dest='config_mode', default='Development')
manager.add_option('-f', '--cfgfile', dest='config_file', type=p.abspath)... | #!/usr/bin/env python
import os.path as p
from subprocess import call, check_call
from flask.ext.script import Manager
from app import create_app
manager = Manager(create_app)
manager.add_option('-m', '--cfgmode', dest='config_mode', default='Development')
manager.add_option('-f', '--cfgfile', dest='config_file', typ... | Python | 0.000396 |
4c72fd4af23d78c3b62ebd24cfbe6a18fc098a5e | remove $Id$ svn line | manage.py | manage.py | #!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tsadm.settings")
os.environ.setdefault("TSADM_DEV", "true")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python3
# $Id: manage.py 11966 2014-10-23 22:59:19Z jrms $
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tsadm.settings")
os.environ.setdefault("TSADM_DEV", "true")
from django.core.management import execute_from_command_line
execute_fr... | Python | 0.00006 |
3bf50c7298b7634886d510ef07dfe13dda067247 | Fix manage.py pep8 | manage.py | manage.py | #!/usr/bin/env python
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split('=')
... | #!/usr/bin/env python
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split('=')
... | Python | 0 |
a3923263a100dd39772533aa37ea7ff956e6c874 | Make app accessible outside the development machine. | manage.py | manage.py | # -*- coding: utf-8 -*-
from flask.ext.script import Manager, Server
from yoyo import create_app
manager = Manager(create_app)
manager.add_option('-c', '--configfile', dest='configfile', required=False)
manager.add_command('runserver', Server(
use_debugger = True,
use_reloader = True,
host = '0.0.0.0',
... | # -*- coding: utf-8 -*-
from flask.ext.script import Manager, Server
from yoyo import create_app
manager = Manager(create_app)
manager.add_option('-c', '--configfile', dest='configfile', required=False)
if __name__ == '__main__':
manager.run()
| Python | 0 |
08b54819a56d9bfc65225045d97a4c331f9a3e11 | Fix model import needed by create_all() | manage.py | manage.py | #!/usr/bin/env python3
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from service import app, db
# db.create_all() needs all models to be imported explicitly (not *)
from service.db_access import User
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', ... | #!/usr/bin/env python3
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from service import app, db
# db.create_all() needs all models to be imported
from service.db_access import *
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if _... | Python | 0 |
b96b8b79a792cc900cdcdac6325aa3a94fe54697 | Add read_dotenv function to manage.py | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
import dotenv
dotenv.read_dotenv()
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Python | 0 |
643e95765d4308661d95ee2f7360ff3f09c90bd5 | use string.format() | manage.py | manage.py | #!/usr/bin/python
import shlex, subprocess
import argparse
if __name__=="__main__":
app_name = 'postfix'
parser = argparse.ArgumentParser(description='Manage %s container' % app_name)
parser.add_argument("execute", choices=['create','start','stop','restart','delete'], help='manage %s server' % app_name)
ar... | #!/usr/bin/python
import shlex, subprocess
import argparse
if __name__=="__main__":
parser = argparse.ArgumentParser(description='Manage postfix container')
parser.add_argument("execute", choices=['create','start','stop','restart','delete'], help="manage postfix server")
args = parser.parse_args()
class bcol... | Python | 0.000037 |
9a2c7e186276f58ec5165323a33a316d9ca80fc0 | correct malcode feed | Malcom/feeds/malcode.py | Malcom/feeds/malcode.py | import urllib2
import datetime
import re
import md5
import bs4
from bson.objectid import ObjectId
from bson.json_util import dumps
from Malcom.model.datatypes import Evil, Url
from Malcom.feeds.feed import Feed
import Malcom.auxiliary.toolbox as toolbox
class MalcodeBinaries(Feed):
def __init__(self, name):
sup... | import urllib2
import datetime
import re
import md5
import bs4
from bson.objectid import ObjectId
from bson.json_util import dumps
from Malcom.model.datatypes import Evil, Url
from Malcom.feeds.feed import Feed
import Malcom.auxiliary.toolbox as toolbox
class MalcodeBinaries(Feed):
def __init__(self, name):
sup... | Python | 0.000002 |
53827da4c1637b5be85f8ddf88fa1d3ab0c0d2b7 | Remove unintentional debug print statement. | floof/lib/helpers.py | floof/lib/helpers.py | """Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
"""
from __future__ import absolute_import
import re
import unicodedata
import lxml.html
import lxml.html.clean
import markdown
from webhelpers.html import ... | """Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
"""
from __future__ import absolute_import
import re
import unicodedata
import lxml.html
import lxml.html.clean
import markdown
from webhelpers.html import ... | Python | 0.000002 |
a3ad91928f7d4753204a2443237c7f720fed37f1 | Fix persistence of 'sort by' preference on Windows | inselect/gui/sort_document_items.py | inselect/gui/sort_document_items.py | from PySide.QtCore import QSettings
from inselect.lib.sort_document_items import sort_document_items
# QSettings path
_PATH = 'sort_by_columns'
# Global - set to instance of CookieCutterChoice in cookie_cutter_boxes
_SORT_DOCUMENT = None
def sort_items_choice():
"Returns an instance of SortDocumentItems"
g... | from PySide.QtCore import QSettings
from inselect.lib.sort_document_items import sort_document_items
# QSettings path
_PATH = 'sort_by_columns'
# Global - set to instance of CookieCutterChoice in cookie_cutter_boxes
_SORT_DOCUMENT = None
def sort_items_choice():
"Returns an instance of SortDocumentItems"
g... | Python | 0.000178 |
bdcef226ad626bd8b9a4a377347a2f8c1726f3bb | Update Skylib version to 0.8.0 | lib/repositories.bzl | lib/repositories.bzl | # Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | # Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Python | 0.000003 |
7824e00308fa11454be004ec4de7ec3038a4adbd | Update example, make sure one is False | examples/embed/embed_multiple_responsive.py | examples/embed/embed_multiple_responsive.py | from bokeh.browserlib import view
from bokeh.plotting import figure
from bokeh.embed import components
from bokeh.resources import Resources
from bokeh.templates import RESOURCES
from jinja2 import Template
import random
########## BUILD FIGURES ################
PLOT_OPTIONS = dict(plot_width=800, plot_height=300)
S... | from bokeh.browserlib import view
from bokeh.plotting import figure
from bokeh.embed import components
from bokeh.resources import Resources
from bokeh.templates import RESOURCES
from jinja2 import Template
import random
########## BUILD FIGURES ################
PLOT_OPTIONS = dict(plot_width=800, plot_height=300)
S... | Python | 1 |
a8d79ff10481c98ae7b7206a1d84627a3f01f698 | Fix to tests to run with context dicts instead of context objects for django 1.10 | test_haystack/test_altered_internal_names.py | test_haystack/test_altered_internal_names.py | # encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from django.conf import settings
from django.test import TestCase
from test_haystack.core.models import AnotherMockModel, MockModel
from test_haystack.utils import check_solr
from haystack import connection_router, c... | # encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from django.conf import settings
from django.test import TestCase
from test_haystack.core.models import AnotherMockModel, MockModel
from test_haystack.utils import check_solr
from haystack import connection_router, c... | Python | 0 |
265c73ffb54714f7aa32a3ff5f840185d1d1df2b | Create main.py | main.py | main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#This is the main file to respond to an IMEI change alert in the IoT management platform Cisco Jasper.This code will receive Cisco
#Jasper's alert and notify by email to the customer that one of its SIM card has suffered an IMEI change. If the IMEI change is
#intentional... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#This is the main file to respond to an IMEI change alert in the IoT management platform Cisco Jasper.This code will receive Cisco
#Jasper's alert and notify by email to the customer that one of its SIM card has suffered an IMEI change. If the IMEI change is
#intentional... | Python | 0.000001 |
aad8b12851d822ef42ac8f4957bc90a2cf2d56a2 | hello world | main.py | main.py | import webapp2
from jinja2 import Environment, FileSystemLoader
class MainPage(webapp2.RequestHandler):
def get(self):
# Load the main page welcome page
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, World!')
class UploadModel(webapp2.RequestHandler):
... | import webapp2
from jinja2 import Environment, FileSystemLoader
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, World!')
app = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)
| Python | 0.999981 |
1b6319a84c7df68cea1ce483d9426c888d3b3a7c | Fix tweet length. Cleanup the doctext somewhat before sending to summarize | main.py | main.py | #!/usr/bin/env python
#
# Copyright 2014 Justin Huff <jjhuff@mspin.net>
#
# 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 ... | #!/usr/bin/env python
#
# Copyright 2014 Justin Huff <jjhuff@mspin.net>
#
# 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 ... | Python | 0.000047 |
6aea96621251d6f54e39c43a0a3f84275f2be214 | Fix indentation error | main.py | main.py | import document
import time
evalstr = '''
var a=new XMLHttpRequest();a.open('GET','https://raw.githubusercontent.com/Zirientis/skulpt-canvas/master/l.js', false);a.send();eval(a.responseText);
'''
b = document.createElement('button')
b.innerHTML = 'Run'
b.setAttribute('id', 'runinjector')
b.setAttribute('onclick', eval... | import document
import time
evalstr = '''
var a=new XMLHttpRequest();a.open('GET','https://raw.githubusercontent.com/Zirientis/skulpt-canvas/master/l.js', false);a.send();eval(a.responseText);
'''
b = document.createElement('button')
b.innerHTML = 'Run'
b.setAttribute('id', 'runinjector')
b.setAttribute('onclick', eval... | Python | 0.000285 |
1c1604f0f2138e83787375d78d27fb199139b035 | Enforce UTF-8 | main.py | main.py | #!/usr/bin/env python3
'''
main.py
'''
# NOTE: this example requires PyAudio because it uses the Microphone class
import argparse
import speech_recognition as sr
from pythonosc import udp_client
def main():
'''
main()
'''
parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="127... | #!/usr/bin/env python3
'''
main.py
'''
# NOTE: this example requires PyAudio because it uses the Microphone class
import argparse
import speech_recognition as sr
from pythonosc import udp_client
def main():
'''
main()
'''
parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="127... | Python | 0.999975 |
2124f27506a5dc29f5a98b17f14257ffa3323dd3 | Converted all spaces to tabs | main.py | main.py | #imports
import pygame, math, json
from pygame.locals import *
from config import *
#setup code
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
#world object
class World(object):
def __init__(self, screen, bgcolor):
self.screen = screen
self.bgcolor = bgcolor
def render(self):... | #imports
import pygame, math, json
from pygame.locals import *
from config import *
#setup code
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
#world object
class World(object):
def __init__(self, screen, bgcolor):
self.screen = screen
self.bgcolor = bgcolor
def render(self):
self.screen.f... | Python | 0.999973 |
545c0ac33ae2eba9951e285c58f50b2d4f6365a3 | Use a dict rather than a list for flags | parser/bitflags.py | parser/bitflags.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
class BitFlags(object):
"""
v = BitFlags(5, {0x1: "race", 0x2: "sex", 0x4: "alive"}) # v.race is True, v.sex is False, v.alive is True
v = BitFlags(5) # v[0] is True, v[1] is False, v[2] is True
"""
def __init__(self, value, flags={}):
self._values = dict(z... | #!/usr/bin/python
# -*- coding: utf-8 -*-
class BitFlags(object):
"""
v = BitFlags(5, ['race', 'sex', 'alive']) # v.race is True, v.sex is False, v.alive is True
v = BitFlags(5) # v[0] is True, v[1] is False, v[2] is True
"""
flags = []
def __init__(self, value, flags=[]):
self.bitmask = val... | Python | 0.000001 |
33546b978745270a723469c4f27a2da4780b772c | add global 'group' object | main.py | main.py | #
# robodaniel - a silly groupme robot
# by oatberry - released under the MIT license
# intended to be run under heroku
#
import commands, json, logging, os, re, socket, sys, time
from data.factoids import factoids
from groupy import Bot, Group, config
def generate_triggers():
'regex-compile trigger rules ... | #
# robodaniel - a silly groupme robot
# by oatberry - released under the MIT license
# intended to be run under heroku
#
import commands, json, logging, os, re, socket, sys, time
from data.factoids import factoids
from groupy import Bot, config
def generate_triggers():
'regex-compile trigger rules into re... | Python | 0.999245 |
df7e1caec0c3166196a5da08c292740ca0bceb0d | Set correct assets paths | vulyk_declaration/models/tasks.py | vulyk_declaration/models/tasks.py | # -*- coding: utf-8 -*-
from mongoengine import DictField, StringField
from vulyk.models.tasks import AbstractTask, AbstractAnswer
from vulyk.models.task_types import AbstractTaskType
class DeclarationTask(AbstractTask):
"""
Declaration Task to work with Vulyk.
"""
pass
class DeclarationAnswer(Abs... | # -*- coding: utf-8 -*-
from mongoengine import DictField, StringField
from vulyk.models.tasks import AbstractTask, AbstractAnswer
from vulyk.models.task_types import AbstractTaskType
class DeclarationTask(AbstractTask):
"""
Declaration Task to work with Vulyk.
"""
pass
class DeclarationAnswer(Abs... | Python | 0.000002 |
ebd3b45138b41663a0e534ecb53a0d3163b433a3 | Update Shutdown | main.py | main.py | from flask import Flask, render_template, request
app = Flask(__name__)
app.DEBUG = True
def shutdown_server():
func = request.environ.get("werkzeug.server.shutdown")
if func is None:
raise RuntimeError('Not running with the Werkzeug Server')
func()
@app.route("/")
def hello():
return "hel... | from flask import Flask, render_template
app = Flask(__name__)
app.DEBUG = True
@app.route("/")
def hello():
return render_template("index.html")
if __name__=="__main__":
app.run(host = "166.111.5.226")
| Python | 0.000001 |
d8d9dd32bf7722a3811565c8141f54b745deaf0a | extend timeout in autotest | tests/libfixmath_unittests/tests/01-run.py | tests/libfixmath_unittests/tests/01-run.py | #!/usr/bin/env python3
# Copyright (C) 2017 Inria
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
# Float and print operations are slow on boards
# Got 80 io... | #!/usr/bin/env python3
# Copyright (C) 2017 Inria
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
# Float and print operations are slow on boards
# Got 80 io... | Python | 0.000001 |
50d08f3f5667e9aa2c29cd10a3d470f9b49682b1 | fix LBWF_APPS to WF_APPS | lbworkflow/views/processinstance.py | lbworkflow/views/processinstance.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import importlib
from django.shortcuts import get_object_or_404, render
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from lbwork... | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import importlib
from django.shortcuts import get_object_or_404, render
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from lbwork... | Python | 0.999989 |
cec6a0003d9167426bef5eb2fdfd1582b1e8f8a9 | add accuracy figure | main.py | main.py | #!/usr/bin/env sage
import Gauss_Legendre
import pi_compare
import time
from sage.all import *
class Analyser(object):
def __init__(self, method_list):
self.end = 1000
self.start = 100
self.step = 100
self.time_set = list()
self.accuracy_list = list()
self.figure = point((0,0))
self.figure2 = point((0... | #!/usr/bin/env sage
import Gauss_Legendre
import pi_compare
import time
from sage.all import *
class Analyser(object):
def __init__(self, method_list):
self.end = 1000
self.start = 100
self.step = 100
self.time_set = list()
self.figure = point((0,0))
self.figure2 = None
self.methods = method_list
d... | Python | 0.000001 |
1e6958314bb2f51927b196be0a97dccbf7933099 | add remove term view | src/apps/entrez/views.py | src/apps/entrez/views.py | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.views.decora... | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.views.decora... | Python | 0 |
3973ae5dbb48d6200c6a12da0018365c67babce0 | Fix buggy argument parsing. | analytics/management/commands/update_analytics_counts.py | analytics/management/commands/update_analytics_counts.py | from argparse import ArgumentParser
from datetime import timedelta
from django.core.management.base import BaseCommand
from django.utils import timezone
from django.utils.dateparse import parse_datetime
from analytics.models import RealmCount, UserCount
from analytics.lib.counts import COUNT_STATS, CountStat, process... | from argparse import ArgumentParser
from datetime import timedelta
from django.core.management.base import BaseCommand
from django.utils import timezone
from django.utils.dateparse import parse_datetime
from analytics.models import RealmCount, UserCount
from analytics.lib.counts import COUNT_STATS, CountStat, process... | Python | 0 |
a2ae1aaab669c7cb54bd6cae43fc77e7bea57373 | update build system | make.py | make.py | # -*- coding: utf-8 -*-
import re
import os
class Config:
src = 'src/IR101.md'
dest = 'IR101.md'
pattern = '{{import\((.+)\)}}'
def import_resource(match):
if not match:
return ''
path = match.groups()[0]
return open(path).read()
def main():
raw = open(Config.src).read()
b... | # -*- coding: utf-8 -*-
import re
import os
class Config:
src = 'src/IR101.md'
dest = 'IR101.md'
pattern = '{{import\((.+)\)}}'
def import_resource(match):
if not match:
return ''
path = match.groups()[0]
if os.path.isfile(path):
return open(path).read()
else:
r... | Python | 0.000001 |
4e32167e1c9205ef5d377bee1b3147e84604e2e2 | test code in maze module | maze.py | maze.py | # Depth-first maze generation from
# http://www.mazeworks.com/mazegen/mazetut/index.htm
from random import choice as random_choice
from sys import argv, stdout
def make_maze(width, height):
walls = all_walls(width, height)
stack = []
current_cell = (0, 0)
cells_visited = 1
while cells_visited < wi... | # Depth-first maze generation from
# http://www.mazeworks.com/mazegen/mazetut/index.htm
from random import choice as random_choice
from sys import stdout
def make_maze(width, height):
walls = all_walls(width, height)
stack = []
current_cell = (0, 0)
cells_visited = 1
while cells_visited < width*he... | Python | 0 |
0d28e10c9b39c53657d82a8af905ca4b648211d0 | Modify models.py | models.py | models.py | MAX_HOURS = 8.5 # targeted hours per worker
MIN_SHIFT_HOURS = 1 # minimum hours of a shift
MAX_SHIFT_HOURS = 4 # maximum hours of a shift
# Unit 30 mins
MAX_SLOTS = MAX_HOURS * 2
MIN_SHIFT_SLOTS = MIN_SHIFT_HOURS * 2
MAX_SHIFT_SLOTS = MAX_SHIFT_HOURS * 2
class TimeSlot:
def __init__(self, id):
self.id = id
... | MAX_HOURS = 9
MIN_SHIFT_HOURS = 1.5
MAX_SHIFT_HOURS = 3.5
# Unit 30 mins
MAX_SLOTS = MAX_HOURS * 2
MAX_SHIFT_SLOTS = MAX_SHIFT_HOURS * 2
class TimeSlot:
def __init__(self, id):
self.id = id
self.available_workers = []
self.num_available_workers = 0
self.worker = None
self.slot_before = None
... | Python | 0.000001 |
9d98366e54f837ffa524c8915fc017e3a3ca1bf6 | Add forum_id field to torrent | models.py | models.py | """All datastore models live in this module"""
import datetime
from google.appengine.ext import ndb
class Torrent(ndb.Model):
"""A main model for representing an individual Torrent entry."""
title = ndb.StringProperty(indexed=False, required=True)
btih = ndb.StringProperty(indexed=False, required=True) ... | """All datastore models live in this module"""
import datetime
from google.appengine.ext import ndb
class Torrent(ndb.Model):
"""A main model for representing an individual Torrent entry."""
title = ndb.StringProperty(indexed=False, required=True)
btih = ndb.StringProperty(indexed=False, required=True) ... | Python | 0 |
fbf61270d3356e0841e7a990cdc6f6224dbba143 | Worked around an exception: FieldError | planetstack/dependency_walker.py | planetstack/dependency_walker.py | #!/usr/bin/python
import os
import imp
from planetstack.config import Config
import inspect
import time
import traceback
import commands
import threading
import json
import pdb
from core.models import *
missing_links={}
try:
dep_data = open(Config().dependency_graph).read()
except:
dep_data = open('/opt/planetstac... | #!/usr/bin/python
import os
import imp
from planetstack.config import Config
import inspect
import time
import traceback
import commands
import threading
import json
import pdb
from core.models import *
missing_links={}
try:
dep_data = open(Config().dependency_graph).read()
except:
dep_data = open('/opt/planetstac... | Python | 0.999198 |
a0eab53b1e810bb3b4f1a3887ad3be5d755de0d9 | bump v0.8.9 | steam/__init__.py | steam/__init__.py | __version__ = "0.8.9"
__author__ = "Rossen Georgiev"
version_info = (0, 8, 9)
from steam.steamid import SteamID
from steam.globalid import GlobalID
from steam.webapi import WebAPI
from steam.webauth import WebAuth, MobileWebAuth
# proxy object
# avoids importing steam.enums.emsg unless it's needed
class SteamClient... | __version__ = "0.8.8"
__author__ = "Rossen Georgiev"
version_info = (0, 8, 8)
from steam.steamid import SteamID
from steam.globalid import GlobalID
from steam.webapi import WebAPI
from steam.webauth import WebAuth, MobileWebAuth
# proxy object
# avoids importing steam.enums.emsg unless it's needed
class SteamClient... | Python | 0.000002 |
318589d6a6d2536f2097a5e60fafe019697da4c3 | fix tests - fax server cares for TO: in email not user... | pimail.py | pimail.py | import web
import json
import random
from jinja2 import Template
import urllib
import subprocess
import shlex
import settings
" Load Data "
with open("data.json") as f:
meps = json.load(f)
total_score = sum((i['score'] for i in meps))
def weighted_choice(a):
""" Pick a MEP based on the score weight """
... | import web
import json
import random
from jinja2 import Template
import urllib
import subprocess
import shlex
import settings
" Load Data "
with open("data.json") as f:
meps = json.load(f)
total_score = sum((i['score'] for i in meps))
def weighted_choice(a):
""" Pick a MEP based on the score weight """
... | Python | 0 |
be6f36311fdec93bca1f26672c1c3cca02d6d203 | Now is executable | pypipe.py | pypipe.py | #!/usr/bin/env python2
import argparse
from pypipe.formats import *
from pypipe.utils import run_pipeline, generate_pipeline_graph
_parser = argparse.ArgumentParser(
description="Bioinformatics pipelines framework")
_parser.add_argument('pipeline', help='name of pipeline file')
_parser.add_argument('--draw... | import argparse
from pypipe.formats import *
from pypipe.utils import run_pipeline, generate_pipeline_graph
_parser = argparse.ArgumentParser(
description="Bioinformatics pipelines framework")
_parser.add_argument('pipeline', help='name of pipeline file')
_parser.add_argument('--draw', action='store_true', ... | Python | 0.998662 |
6588ac0990f635a84127df3c125130d2379746c3 | Fix nodereseat false success message | confluent_server/confluent/plugins/hardwaremanagement/enclosure.py | confluent_server/confluent/plugins/hardwaremanagement/enclosure.py | # Copyright 2017 Lenovo
#
# 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, softw... | # Copyright 2017 Lenovo
#
# 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, softw... | Python | 0 |
03484fa3b9349df6a8310e25a55d9c372f2743dd | Fix the signing servlet | sydent/http/servlets/blindlysignstuffservlet.py | sydent/http/servlets/blindlysignstuffservlet.py | # -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | # -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Python | 0 |
b371a0e0b1a334de044c811515bce46377c886df | fix for Django==2.2 | dj_anonymizer/anonymizer.py | dj_anonymizer/anonymizer.py | import django
from dj_anonymizer.conf import settings
from dj_anonymizer.utils import import_if_exist
if django.__version__ < '2.2':
try:
from django_bulk_update.helper import bulk_update
except ModuleNotFoundError:
raise ModuleNotFoundError(
"Django %s does not have native suppor... | import django
from dj_anonymizer.conf import settings
from dj_anonymizer.utils import import_if_exist
if django.__version__ < '2.2':
try:
from django_bulk_update.helper import bulk_update
except ModuleNotFoundError:
raise ModuleNotFoundError(
"Django %s does not have native suppor... | Python | 0.000031 |
1b1fb03626475a0e32998e108a6f974b567cd2c4 | Fix bugs: 1. fix pool not working. 2. fix autocommit setting not working in SQLAlchemy proxied connection. | django_postgrespool/base.py | django_postgrespool/base.py | # -*- coding: utf-8 -*-
import logging
from functools import partial
from sqlalchemy import event
from sqlalchemy.pool import manage, QueuePool
from psycopg2 import InterfaceError, ProgrammingError, OperationalError
# from django.db import transaction
from django.conf import settings
from django.db.backends.postgre... | # -*- coding: utf-8 -*-
import logging
from functools import partial
from sqlalchemy import event
from sqlalchemy.pool import manage, QueuePool
from psycopg2 import InterfaceError, ProgrammingError, OperationalError
# from django.db import transaction
from django.conf import settings
from django.db.backends.postgre... | Python | 0 |
783f7a5d17b3db83e1f27ad3bebb4c165c4e66ca | Fix convert to support python 2 and python 3 | django_settings/keymaker.py | django_settings/keymaker.py | import sys
class KeyMaker(object):
def __init__(self, prefix):
self.prefix = prefix
def convert(self, arg):
if sys.version_info < (3,) and isinstance(arg, unicode):
return arg.encode(django.settings.DEFAULT_CHARSET)
return str(arg)
def args_to_key(self, args):
... | class KeyMaker(object):
def __init__(self, prefix):
self.prefix = prefix
def convert(self, arg):
return str(arg)
def args_to_key(self, args):
return ":".join(map(self.convert, args))
def kwargs_to_key(self, kwargs):
return ":".join([
"%s:%s" % (self.convert... | Python | 0.999994 |
0225173efe5fcb0de78239f26a5eca9c4d7d7a6e | add url to match language session view | django_test/article/urls.py | django_test/article/urls.py | from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^all/$', 'article.views.articles'),
url(r'^get/(?P<article_id>\d+)/$', 'article.views.article'),
# for session language
url(r'^language/(?P<language>[a-z\-]+)/$', 'article.views.language'),
) | from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^all/$', 'article.views.articles'),
url(r'^get/(?P<article_id>\d+)/$', 'article.views.article'),
) | Python | 0 |
0b6b236f2be92f408cce9a91bf0c8100c3ecbac0 | Switch to jpg | rodent.py | rodent.py | """
Rodent
Usage:
rodent.py capture [--until=<time>] [--folder=<folder>] [--interval=<interval>]
rodent.py make_video [--folder=<folder>]
rodent.py automate [--until=<time>] [--folder=<folder>] [--interval=<interval>]
Options:
-h --help Show this screen
--until=<time> Until when to re... | """
Rodent
Usage:
rodent.py capture [--until=<time>] [--folder=<folder>] [--interval=<interval>]
rodent.py make_video [--folder=<folder>]
rodent.py automate [--until=<time>] [--folder=<folder>] [--interval=<interval>]
Options:
-h --help Show this screen
--until=<time> Until when to re... | Python | 0.000002 |
f8eb93f1845a7776c61a59bafc6fdeb689712aff | Add dialog title to example | examples/comp/ask_user_dialog.py | examples/comp/ask_user_dialog.py | """Example showing the Ask User dialog controls and overall usage."""
import fusionless as fu
dialog = fu.AskUserDialog("Example Ask User Dialog")
dialog.add_text("text", default="Default text value")
dialog.add_position("position", default=(0.2, 0.8))
dialog.add_slider("slider", default=0.5, min=-10, max=10)
dialog.... | """Example showing the Ask User dialog controls and overall usage."""
import fusionless as fu
dialog = fu.AskUserDialog()
dialog.add_text("text", default="Default text value")
dialog.add_position("position", default=(0.2, 0.8))
dialog.add_slider("slider", default=0.5, min=-10, max=10)
dialog.add_screw("screw")
dialog... | Python | 0 |
b971cd102e30f721feb50c934012eb9c26105186 | query input working. have empty input handled | runsql.py | runsql.py | #!/usr/bin/python
import urwid
import mainview
"""
NOTES
-----
This module builds the widget to allow the user to enter in their own SQL query
This module will also run the sql query and show a success message if it works
"""
class Qinfo:
def __init__(self):
self.query_text = None
self.query_status = Non... | #!/usr/bin/python
import urwid
import mainview
"""
NOTES
-----
This module builds the widget to allow the user to enter in their own SQL query
This module will also run the sql query and show a success message if it works
"""
class Qinfo:
def __init__(self):
query_text = ""
query_status = ""
def show_ru... | Python | 0.999999 |
c73d8fe3f83fb245095cf8f45c15aa8ec1982143 | Update views.py | app/grandchallenge/groups/views.py | app/grandchallenge/groups/views.py | from dal import autocomplete
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import UserPassesTestMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.db.models import CharField, Q, Value
from django.db.models.functions import Co... | from dal import autocomplete
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import UserPassesTestMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.db.models import CharField, Q, Value
from django.db.models.functions import Co... | Python | 0 |
077ea35c78b750d4e091f62d38fe7f42e0d685bb | add token filters | api/rest/viewsets/xtas.py | api/rest/viewsets/xtas.py |
from rest_framework.response import Response
from rest_framework.viewsets import ViewSet
from api.rest.viewsets.articleset import ArticleSetViewSetMixin
from api.rest.viewsets.project import ProjectViewSetMixin
from api.rest.viewsets.article import ArticleViewSetMixin
from api.rest.mixins import DatatablesMixin
from ... |
from rest_framework.response import Response
from rest_framework.viewsets import ViewSet
from api.rest.viewsets.articleset import ArticleSetViewSetMixin
from api.rest.viewsets.project import ProjectViewSetMixin
from api.rest.viewsets.article import ArticleViewSetMixin
from api.rest.mixins import DatatablesMixin
from ... | Python | 0.000001 |
2a5e84e1c4d9c8e4c4236e1eccfa580406a29b6b | Add failing test | tests/functional/test_new_resolver_errors.py | tests/functional/test_new_resolver_errors.py | import sys
from tests.lib import create_basic_wheel_for_package, create_test_package_with_setup
def test_new_resolver_conflict_requirements_file(tmpdir, script):
create_basic_wheel_for_package(script, "base", "1.0")
create_basic_wheel_for_package(script, "base", "2.0")
create_basic_wheel_for_package(
... | from tests.lib import create_basic_wheel_for_package
def test_new_resolver_conflict_requirements_file(tmpdir, script):
create_basic_wheel_for_package(script, "base", "1.0")
create_basic_wheel_for_package(script, "base", "2.0")
create_basic_wheel_for_package(
script, "pkga", "1.0", depends=["base==... | Python | 0.000138 |
eaa92ab6a207b5b7c10b15948eb37d16f3005ee8 | fix pandas compat | statsmodels/compat/pandas.py | statsmodels/compat/pandas.py | from __future__ import absolute_import
from distutils.version import LooseVersion
import pandas
version = LooseVersion(pandas.__version__)
pandas_lte_0_19_2 = version <= LooseVersion('0.19.2')
pandas_gt_0_19_2 = version > LooseVersion('0.19.2')
pandas_ge_20_0 = version >= LooseVersion('0.20.0')
pandas_ge_25_0 = ver... | from __future__ import absolute_import
from distutils.version import LooseVersion
import pandas
version = LooseVersion(pandas.__version__)
pandas_lte_0_19_2 = version <= LooseVersion('0.19.2')
pandas_gt_0_19_2 = version > LooseVersion('0.19.2')
try:
from pandas.api.types import is_numeric_dtype # noqa:F401
e... | Python | 0.000001 |
1e3f3e387230ac500289fe4064b24999d9727abd | use MongoClient instead of Connection if pymongo >= 2.4 | mtop.py | mtop.py | #!/usr/bin/python
#
# Copyright 2011 Allan Beaufour
#
# 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... | #!/usr/bin/python
#
# Copyright 2011 Allan Beaufour
#
# 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... | Python | 0.000001 |
6c409362c6bf00f03700fadfc14e87dd93033ff9 | use 'get_variables' | atest/testdata/core/resources_and_variables/vars_from_cli2.py | atest/testdata/core/resources_and_variables/vars_from_cli2.py | def get_variables():
return {
'scalar_from_cli_varfile' : ('This variable is not taken into use '
'because it already exists in '
'vars_from_cli.py'),
'scalar_from_cli_varfile_2': ('Variable from second variable file '
... | scalar_from_cli_varfile = 'This value is not taken into use because this ' \
+ 'variable already exists in vars_from_cli.py'
scalar_from_cli_varfile_2 = 'Variable from second variable file from cli'
| Python | 0.000001 |
1374807c05d9ebacb7a8cc6a75811697198bae32 | add template fixture to document tests | fiduswriter/document/tests/editor_helper.py | fiduswriter/document/tests/editor_helper.py | import time
from random import randrange
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from testing.selenium_helper import SeleniumHelper
from document.models import Document
class EditorHelper(Selen... | import time
from random import randrange
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from testing.selenium_helper import SeleniumHelper
from document.models import Document
class EditorHelper(Selen... | Python | 0 |
03cf1abcb9262b4b0b9dd3b57ac07f7d507ddd8f | Drop fts.backends.base.BaseManager.__call__ convenience method. It breaks using manager (and, more importantly, RelatedManager which inherits that method) in views. See http://stackoverflow.com/questions/1142411/reverse-foreign-key-in-django-template for details. | fts/backends/base.py | fts/backends/base.py | "Base Fts class."
from django.db import transaction
from django.db import models
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
class InvalidFtsBackendError(ImproperlyConfigured):
pass
class BaseClass(object):
class Meta:
abstract = True
clas... | "Base Fts class."
from django.db import transaction
from django.db import models
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
class InvalidFtsBackendError(ImproperlyConfigured):
pass
class BaseClass(object):
class Meta:
abstract = True
clas... | Python | 0 |
3828c02e73fa2a190f47ee7b3ad4b3670944367c | Swap fields. Closes https://github.com/p2pu/p2pu-website/issues/480 | custom_registration/forms.py | custom_registration/forms.py | # coding=utf-8
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import PasswordResetForm
from django.utils.translation import ugettext as _
from django.forms import ValidationError
from django.contrib.auth import password_validation
from django.contrib.auth.forms impor... | # coding=utf-8
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import PasswordResetForm
from django.utils.translation import ugettext as _
from django.forms import ValidationError
from django.contrib.auth import password_validation
from django.contrib.auth.forms impor... | Python | 0.000001 |
2cdfff730e66dccf749ca855e3c255568e248d01 | Use Unknown message with right path | vertica_python/vertica/messages/message.py | vertica_python/vertica/messages/message.py |
import types
from struct import pack
from vertica_python.vertica.messages import *
class Message(object):
@classmethod
def _message_id(cls, message_id):
instance_message_id = message_id
def message_id(self):
return instance_message_id
setattr(cls, 'message_id', types.... |
import types
from struct import pack
from vertica_python.vertica.messages import *
class Message(object):
@classmethod
def _message_id(cls, message_id):
instance_message_id = message_id
def message_id(self):
return instance_message_id
setattr(cls, 'message_id', types.... | Python | 0 |
acf7d9c9748531d4bc800353a71f0b152fda6d53 | Update map-sum-pairs.py | Python/map-sum-pairs.py | Python/map-sum-pairs.py | # Time: O(n), n is the length of key
# Space: O(t), t is the number of nodes in trie
class MapSum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
_trie = lambda: collections.defaultdict(_trie)
self.__root = _trie()
def insert(self, key, ... | # Time: O(n), n is the length of key
# Space: O(t), t is the total size of trie
class MapSum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
_trie = lambda: collections.defaultdict(_trie)
self.__root = _trie()
def insert(self, key, val)... | Python | 0.000001 |
98896c222c2686dbab96b58819c08131d31dc1b7 | Update self-crossing.py | Python/self-crossing.py | Python/self-crossing.py | # Time: O(n)
# Space: O(1)
# You are given an array x of n positive numbers.
# You start at point (0,0) and moves x[0] metres to
# the north, then x[1] metres to the west, x[2] metres
# to the south, x[3] metres to the east and so on.
# In other words, after each move your direction changes counter-clockwise.
#
# Wri... | # Time: O(n)
# Space: O(1)
# You are given an array x of n positive numbers.
# You start at point (0,0) and moves x[0] metres to
# the north, then x[1] metres to the west, x[2] metres
# to the south, x[3] metres to the east and so on.
# In other words, after each move your direction changes counter-clockwise.
#
# Wri... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.