text string | size int64 | token_count int64 |
|---|---|---|
""" Test the different methods of transforming the longitude coordinates after rolling"""
import numpy as np
# calculate the offset in the same way as in dataset_utils
def calculate_offset(a, bounds):
low, high = bounds
# get resolution of data
res = a[1] - a[0]
# calculate how many degrees to move ... | 12,708 | 5,011 |
from .coco import CocoDataset
from .registry import DATASETS
@DATASETS.register_module
class MyDataset(CocoDataset):
CLASSES = ('car', 'pedestrian', 'trafficLight-Red', 'trafficLight-Green', 'truck',
'trafficLight', 'biker', 'trafficLight-RedLeft', 'trafficLight-GreenLeft'
, 'traf... | 365 | 123 |
from word2vec.models.skip_gram import SkipGramModel
| 52 | 18 |
import os
import time
from queue import Queue
from PIL import Image, ImageDraw, ImageFont
from button_enum import ButtonType
from event import *
from config import Config
ROW_HEIGHT = 16
class App():
def __init__(self):
self._input_devices = []
self._subsystems = []
self._layers = []
... | 7,659 | 2,229 |
from django.test import RequestFactory
from test_plus.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from test_bank.users.tests.factories import UserFactory
from .factories import BorrowerProfileFactory, BusinessFactory, LoanFactory
from decimal import Decimal
... | 15,895 | 4,764 |
#
# Copyright The Helm 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 applicable law or agreed to in writin... | 1,295 | 385 |
# -*- coding: utf-8 -*-
"""Top-level package for String Fox."""
__author__ = """Tom Lynch"""
__email__ = 'tom@machinelearningdeveloper.com'
__version__ = '0.1.0'
| 164 | 65 |
def metade(x=0):
x = x / 2
return x
def dobro(x=0):
x = x * 2
return x
def aumentar(x=0, i=0):
x = x * (1+(i/100))
return x
def diminuir(x=0, i=0):
x = x * (1-(i/100))
return x
def moeda(x=0, moeda='R$ '):
x = f'{x:,.2f}'
x = x.replace('.', '-')
x = x.repl... | 398 | 193 |
from canvasapi.course import Course
from canvasapi.requester import Requester
from canvasapi.util import combine_kwargs, get_institution_url
def get_course_stream(course_id: int, base_url: str, access_token: str, **kwargs: dict) -> dict:
"""
Parameters
----------
course_id : `int`
Course id
... | 1,634 | 527 |
import mido
import pickle
from tqdm import tqdm
from music_generator.score_util import score_to_events
def save_events(track, events):
current_time = 0
for this_time in tqdm(sorted(events), "Writing midi events"):
sleep_time = this_time - current_time
current_time = this_time
for msg i... | 778 | 280 |
#-*- coding: utf-8 -*-
"""
routes.auth
~~~~~~~~~~~
Routes for handling authentication (login, register, logout)
:copyright: (c) Authentication Dance by Waltz.
:license: GPLv3, see LICENSE for more details.
"""
import waltz
from waltz import User, web, session, render
class Login:
def GET(se... | 1,791 | 537 |
from django.db import models
from django.contrib.auth.models import User
from datasets.models import Dataset, PublishedMixin, SCALE_CHOICES
SCHEME_CHOICES = (
(1, 'Sequential'),
(2, 'Diverging'),
(3, 'Qualitative'),
)
class AbstractModel(models.Model):
status = models.BooleanField(default=False)
... | 2,186 | 677 |
from common.app_config import CommonConfig
class MeasuresConfig(CommonConfig):
name = "measures"
| 103 | 30 |
# Code from Chapter 6 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by Stephen Marsland (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code comes with no... | 2,083 | 1,031 |
__name__ = 'pymiddy'
__version__ = '0.1.0'
from .middy import Middy
| 69 | 35 |
"""Functional tests for pytest_localstack.session."""
import pytest
from pytest_localstack import constants, exceptions, service_checks, session
@pytest.mark.parametrize("test_service", sorted(constants.SERVICE_PORTS))
def test_RunningSession_individual_services(test_service, docker_client):
localstack_imagename... | 1,904 | 526 |
list_markets = [
'japan', 'portugal', 'russia', 'switzerland', 'romania', 'italy',
'ukraine', 'germany', 'monaco', 'denmark', 'netherlands', 'greece',
'spain', 'uk', 'israel', 'new-zealand', 'kazakhstan', 'canada',
'south-africa', 'lithuania', 'colombia', 'poland', 'turkish-cyprus',
'france', 'czech... | 1,410 | 614 |
from .debug import getattr_debug, type_debug
from .getattr import raw_getattr
| 78 | 24 |
import click
import json
import csv
import sys
from seed_services_client.identity_store import IdentityStoreApiClient
from demands import HTTPServiceError
if sys.version_info.major == 2:
file_open_mode = 'rb'
else:
file_open_mode = 'r'
def get_api_client(url, token):
return IdentityStoreApiClient(
... | 4,530 | 1,317 |
import os, shutil
BUILD_DIR = "../dist"
FILES_TO_BUILD = [
{ "file": "ca", "module": "ca_module.py", "library": "ca.py", "import": "from ca import CA" },
{ "file": "certificate", "module": "certificate_module.py", "library": "certificate.py", "import": "from certificate import Certificate" },
{ "file": "k... | 1,278 | 419 |
#!/usr/bin/env python
'''
Plot candidate verification plots including periodograms, average pulse profiles and phase-time diagrams.
Run using the following syntax.
python plot_cands.py -i <Configuration script of inputs> | tee <Log file>
'''
from __future__ import print_function
from __future__ import absolute_import
... | 7,899 | 2,515 |
def should_ignore(word: str) -> bool:
with open('ignorelist.txt') as file:
words_to_ignore = file.readlines()
conditions = [
#if all chars are not letters from alphabet
not word.isalpha(),
word.lower() in words_to_ignore,
word.isnumeric(),
#if first letter is c... | 401 | 123 |
"""
Copyright 2019 Akvelon 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 i... | 918 | 270 |
# Written by Rachel Morrison on July 1, 2016
# Updated October 2017
# ## Input Data and Parameters
from Fit_XRD_Input import *
# ## Outline
# - Import data
# - Specify 2theta range
# - Identify phases
# - Set starting parameter values for a (and c)
# - Identify peaks present in 2theta range for given a (and c)
# -... | 18,681 | 6,905 |
# ----------------------------------------------------------------------
# MetricsNode
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Python modules
f... | 1,362 | 412 |
from tkinter import *
import datetime
from view_people import Mypeople
date = datetime.datetime.now().date()
date = str(date)
class Application(object): # inheritance from object is by default in python 3
def __init__(self, master):
self.master = master # this allow to use master in other def function a... | 2,071 | 708 |
class Metric:
def __init__(self, name: str):
"""
Generates the Metric
Parameters
---------
name : str
the name of the metric
"""
pass
def __call__(self) -> float:
"""
Gets the evaluation score of the y_tru... | 810 | 240 |
'''For each of the 6 coffee cups I buy, I get a 7th cup free. In total, I get 7 cups. Implement a program that takes n cups bought and print as an integer the total number of cups I would get.
Input Format
n number of cups from user
Constraints
n>0
Output Format
number of cups present have
Sample Input 0
13
Sam... | 478 | 176 |
from .base import BaseAssigner
from .max_iou_assigner import MaxIoUAssigner
| 76 | 26 |
"""To create a flask app
The method definition to create a flask app by call ing the create_app function
Example:
create_app(test_config)
"""
import os
import connexion
import sys
import textwrap
from cloudmesh.common.util import writefile
from cloudmesh.common.util import path_expand
from cloudmesh.common... | 3,695 | 1,046 |
"""Create Specialization Schema
Create a table 'specialization' which represents doctors specializations and have a many-to-many relationship with the
doctor table.
-- SQL
CREATE TABLE specialization (
id SERIAL,
specialization_name TEXT NOT NULL,
CONSTRAINT pk_specialization PRIMARY KEY (id)
);
CREATE ... | 1,610 | 484 |
import database
import tiles
import json
from os import path
"""
Despite Lattice assigning them the same tile type; "odd" and "even" top/left/right IO
locations have slightly different routing - swapped output tristate and data
This script fixes this by patching tile names
"""
for f, d in [("LIFCL", "LIFCL-40"), ("L... | 2,515 | 886 |
from unittest import TestCase
from jsonConverter import jsonConverter
from jsonConverter.errors import EmptyJson
from bs4 import BeautifulSoup
import os
import json
class TestHtmlTable(TestCase):
def __init__(self, *args, **kwargs):
current_directory = os.path.dirname(os.path.realpath(__file__))
... | 1,425 | 449 |
fp = open('cafe.txt', 'w', encoding='utf-8')
print(fp)
# <_io.TextIOWrapper name='cafe.txt' mode='w' encoding='utf-8'>
# 默认情况下,open函数采用文本模式,返回一个TextIOWrapper对象
print(fp.write('café'))
# 在TextIOWrapper对象上调用write方法返回写入的Unicode字符数:4
fp.close()
import os
print(os.stat('cafe.txt').st_size)
fp2 = open('cafe.txt')
print(fp2)
... | 620 | 327 |
#!/usr/bin/env python3
import os
import os.path
import re
import signal
import sys
import time
from datetime import datetime as dt
from datetime import timedelta as td
from pathlib import Path
import git
import pywikibot as pwb
import yaml
class SignalHandler:
def __init__(self):
self._is_sleeping = F... | 15,915 | 4,395 |
#
# Copyright 2021 Lars Pastewka
#
# ### MIT license
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | 3,377 | 970 |
#!/usr/bin/python3
# Date: Mon 24 Jun 2019 17:36:52 CEST
# Author: Nicolas Flandrois
# Description: Running Stardate
from sdview import View
from sdcompute import Compute
def main():
"""main docstring"""
View.menu(Compute.sdconvert, Compute.sdtranslate)
if __name__ == '__main__':
main()
| 304 | 112 |
# -*- coding: utf-8 -*-
"""
eve.flaskapp
~~~~~~~~~~~~
This module implements the central WSGI application object as a Flask
subclass.
:copyright: (c) 2013 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
import eve
from flask import Blueprint
from werkzeug.routing import B... | 2,230 | 690 |
################################
# @file htn.py #
# @brief HTN Planner core #
# @author Joshua Supratman #
# @date 2017/09/07 #
################################
import copy
class WorldState(object):
def __init__(self, *args):
self.define_status = args
self.curr... | 4,746 | 1,290 |
#!/usr/bin/env python3
# Copyright (C) 2020 Arm Limited or its affiliates. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# www.a... | 2,606 | 955 |
class searching:
def lin_search(self, arr, num):
for i in range(len(arr)):
if arr[i] == num:
return i
return -1
| 168 | 56 |
#map reduce
def add(x):
return x+10+x*11
x =map(add,list(range(10)))
print(list(x))
from functools import reduce
def add(x,y=0):
return x+10+x*11
y =reduce(add,map(add,list(range(10))))
print(y)
def char2num(s):
return {"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9}[s]
def getResult(x,... | 2,463 | 1,235 |
import termcolor
termcolor.cprint('Green.', 'green') | 53 | 18 |
"""
Author: 陈天翼(Apollo Chen)
Date: 2019-02-18
Description: 学习重点:beginShape, vertex, endShape, save, saveFrame
"""
x = 0
def setup():
size(800, 600)
triangle(400, 150, 400, 250, 500, 200)
triangle(250, 250, 300, 300, 300, 250)
rect(300, 250, 200, 50)
triangle(550, 250, 500, 300, 500, 250)
save(... | 842 | 459 |
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('ggplot')
import GPflow
import math
N = 16
X = np.random.rand(N,1)
Y = np.sin(12*X) + 0.66*np.cos(25*X) + np.random.randn(N,1)*0.1 + 3
k = GPflow.kernels.Matern52(1, lengthscales=0.3)
m = GPflow.gpr.GPR(X, Y, kern=k)
m.likelihood.variance = 0.01
m.... | 646 | 349 |
from core.main import main
import sys
sys.path.append(".")
# TODO CHANGE TO CORRECT IMPORT
main()
| 102 | 38 |
# coding=utf-8
#
# @lc app=leetcode id=1089 lang=python
#
# [1089] Duplicate Zeros
#
# https://leetcode.com/problems/duplicate-zeros/description/
#
# algorithms
# Easy (58.99%)
# Likes: 118
# Dislikes: 94
# Total Accepted: 15.1K
# Total Submissions: 25.6K
# Testcase Example: '[1,0,2,3,0,4,5,0]'
#
# Given a fixed... | 2,092 | 759 |
""" Preprocess
This script loads the videos, removes the audio track, cuts the videos from
the start point to endpoint for given dataset fragments, and saves them in a
new directory. A new `tsv` file is being generated with corresponding
filenames and ground truth labels.
Parameters
----------
data_dir : str, optiona... | 2,841 | 886 |
import cv2
import utils
def main():
input_img = cv2.imread(str(utils.EXAMPLES_DIR/'retina.png'))
result = cv2.pyrMeanShiftFiltering(input_img, 2, 30, 0)
cv2.imshow('Original', input_img)
cv2.waitKey(0)
cv2.imshow('Mean Shift result', result)
cv2.waitKey(0)
cv2.imwrite(str(utils.EXAMPLES... | 391 | 168 |
import scipy.signal as sps
import numpy as np
def resample_audio(audio, fs_from, fs_to):
number_of_samples = round(len(audio) * float(fs_to) / fs_from)
audio = sps.resample(audio, number_of_samples)
# Ensure re-sampling did not create samples outside of [-1,1]:
max_amplitude = np.abs(audio).max()
... | 400 | 144 |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.sitemaps.views import index, sitemap
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
from rest_... | 3,849 | 1,295 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | 8,144 | 2,421 |
'''Define Abstract Factory'''
from abc import ABCMeta, abstractmethod
class Snack:
pass
class Beer:
pass
class Beer(metaclass=ABCMeta):
@abstractmethod
def interact(self, snack: Snack):
pass
class Snack(metaclass=ABCMeta):
@abstractmethod
def interact(self, beer: Beer):
pass
class Tuborg(Beer):
def inte... | 1,632 | 672 |
import matplotlib.pyplot as plt
import iris
from irise import plot
from irise.plot.util import multilabel, legend
from systematic_forecasts import second_analysis
from myscripts.projects.thesis import plotdir
def main():
# Parameters same for all plots
mappings = ['pv_full', 'pv_main', 'pv_phys']
domains ... | 4,972 | 1,747 |
from sys import stdin
#file = stdin
file = open( r".\data\sherlockbeast.txt" ) #stdin
data = list(map(int, file.read().strip().split()))[1:]
file.close()
# Maximize x in k = 3x + 5y
for k in data:
for x in range(k//3, -1, -1):
if (k-3 * x) % 5 == 0:
y = (k-3 * x) // 5
print('5'*3*x + '3'*5*y)
... | 359 | 168 |
def main() -> None:
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
ans += i * (A <= sum(map(int, str(i))) <= B)
print(ans)
if __name__ == '__main__':
main()
| 208 | 88 |
from quadruped_spring.env.env_randomizers.env_randomizer import (
EnvRandomizerDisturbance,
EnvRandomizerInitialConfiguration,
EnvRandomizerMasses,
EnvRandomizerSprings,
)
from quadruped_spring.utils.base_collection import CollectionBase
# Implemented observation spaces for deep reinforcement learning:... | 1,601 | 520 |
from typing import Any, Callable, Dict, Optional, Sequence, Tuple
import abc
import dataclasses
from google_cloud_pipeline_components import aiplatform as gcc_aip
import kfp
from kfp.v2.dsl import component, importer, Condition, Dataset, Model
import training.common.managed_dataset_pipeline as managed_dataset_pipeline... | 17,144 | 4,402 |
from .GiteaOrg import GiteaOrg
class GiteaOrgForMember(GiteaOrg):
def save(self, commit=True):
is_valid, err = self._validate(create=True)
if not commit or not is_valid:
self._log_debug(err)
return is_valid
try:
resp = self.user.client.api.admin.adminCr... | 1,465 | 439 |
"""
https://leetcode.com/problems/binary-tree-level-order-traversal-ii/description
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree [3,9,20,null,null,15,7],
3
/ \
9 20
/ \
... | 1,293 | 405 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^search/$', views.email_search, name='crits-emails-views-email_search'),
url(r'^delete/(?P<email_id>\w+)/$', views.email_del, name='crits-emails-views-email_del'),
url(r'^upload/attach/(?P<email_id>\w+)/$', views.upload_attach, nam... | 1,486 | 595 |
'''Summed multiples of 3 and 5 up to n'''
# sum35 :: Int -> Int
def sum35(n):
'''Sum of all positive multiples
of 3 or 5 below n.
'''
f = sumMults(n)
return f(3) + f(5) - f(15)
# sumMults :: Int -> Int -> Int
def sumMults(n):
'''Area under a straight line between
the first multiple... | 1,769 | 652 |
# -*- coding: utf-8 -*-
# uses the opencv api as the default frame source. must ensure that the ffmpeg
# compiled that it is linked against is the same as the ffmpeg being used to
# render video files
import cv2
class OpenCvFrameSource(object):
def __init__(self, src):
self.src = src
self.capture... | 1,515 | 477 |
import fitz
import os
from classes.Table_Of_Contents import get_my_toc
from classes.Brief import get_my_brief
def toc_pdf():
BRIEF = get_my_brief()
doc = BRIEF.data['document']
TABLE_OF_CONTENTS = get_my_toc()
page_number_start = TABLE_OF_CONTENTS.data['pageNumberStartForMe']
page_number_end = TA... | 834 | 303 |
# Copyright 2019 Extreme Networks, 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 i... | 3,172 | 1,037 |
from django.conf import settings
from django import template
# Depending on your django version, `reverse` and `NoReverseMatch` has been moved.
# From django 2.0 they've been moved to `django.urls`
try:
from django.urls import reverse, NoReverseMatch
except ImportError:
from django.core.urlresolvers import rev... | 559 | 159 |
# import the necessary packages
import numpy as np
import cv2
def centroid_histogram(clt):
# grab the number of different clusters and create a histogram
# based on the number of pixels assigned to each cluster
print(clt)
numLabels = np.arange(0, len(np.unique(clt.labels_)) + 1)
(hist, _) = np.histogram... | 1,555 | 644 |
import os
import sys
import argparse
from html2txt import parsers
#from importlib import reload # reload
#reload(parsers)
#!/usr/bin/env python3
# Copyright (c) 2020 Rene Sugar.
# License: MIT (http://www.opensource.org/licenses/mit-license.php)
class Html2Markdown(object):
def __init(self):
self.root_ = N... | 3,031 | 1,053 |
import torch
import torch.nn.utils.spectral_norm as spectral_norm
class Activation(torch.nn.Module):
def __init__(self, arch):
super().__init__()
self.act = torch.nn.LeakyReLU(0.1 if arch == 1 else .02, inplace=True)
def forward(self, x):
return self.act(x)
def weights_init(m):
c... | 6,311 | 2,348 |
import _pickle
from time import perf_counter
import numpy as np, rpxdock as rp, rpxdock.homog as hm
from rpxdock.body import Body
def test_body(C2_3hm4, C3_1nza, sym1=2, sym2=3):
body1 = Body(C2_3hm4, sym1)
body2 = Body(C3_1nza, sym2)
assert body1.bvh_bb.max_id() == body1.nres - 1
assert body1.bvh_cen.max_... | 4,038 | 1,892 |
# Generated from D:/AnacondaProjects/iust_compilers_teaching/grammars\Expr2.g4 by ANTLR 4.8
from antlr4 import *
if __name__ is not None and "." in __name__:
from .Expr2Parser import Expr2Parser
else:
from Expr2Parser import Expr2Parser
# This class defines a complete generic visitor for a parse tree produced ... | 1,922 | 628 |
from .utils import get_state_dict
| 34 | 11 |
from q2_api_client.clients.base_q2_client import BaseQ2Client
from q2_api_client.endpoints.refresh_cache_endpoints import RefreshCacheEndpoint
class RefreshCacheClient(BaseQ2Client):
def refresh_cache(self):
"""POST /refreshCache
:return: Response object
:rtype: requests.Response
... | 442 | 133 |
import nacl
from Jumpscale import j
import binascii
JSConfigBase = j.baseclasses.object_config
from nacl.signing import VerifyKey
from nacl.public import PrivateKey, PublicKey, SealedBox
from Jumpscale.clients.gedis.GedisClient import GedisClientActors
class ThreebotClient(JSConfigBase):
_SCHEMATEXT = """
@... | 5,153 | 1,577 |
# Copyright 2018 F5 Networks 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 writi... | 3,669 | 1,183 |
import numpy as np
from sklearn.cluster import KMeans
import argparse, os, sys, errno
parser = argparse.ArgumentParser(description='K-means clustering')
parser.add_argument('-f', '--file', type=str, required=True,
help='SCS matrix')
parser.add_argument('-k', type=int, required=True,
... | 2,822 | 944 |
# Copyright 2017 The UAI-SDK 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... | 9,725 | 3,286 |
# custom libraries
from lib.extraction.common import PyNexus as PN
from lib.extraction.common import Check_dead_pixels
from lib.extraction import PilatusSum as PilatusSum
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.colors as color... | 22,731 | 8,256 |
from datetime import datetime
from pydantic import BaseModel
from typing import Optional, List
from aiof.data.asset import Asset
from aiof.data.liability import Liability
# Financial Goals
# - Mandatory short-term goals
class Goal(BaseModel):
name: str
type: str
amount: Optional[float]
currentAmou... | 888 | 269 |
from flask import Blueprint
from app import current_config
jekyll = Blueprint('jekyll',
__name__,
static_folder=current_config.STATICDIR,
template_folder=current_config.TEMPLATEDIR)
status = Blueprint('status',
__name__,
s... | 499 | 136 |
#!/usr/bin/env/ python
################################################################################
# Copyright (c) 2016 Daniel Matuschek
# This file is part of knxpy.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation fil... | 1,808 | 610 |
from __future__ import absolute_import
from .drawing import *
try:
from . import path
except ImportError:
pass
| 122 | 38 |
import logging
import threading
import time
import random
LOG_FORMAT = '%(asctime)s %(threadName)-17s %(levelname)-8s %(message)s'
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
semaphore = threading.Semaphore(0)
item = 0
def pelanggan():
logging.info('Pelanggan meminta antrian')
semaphore.acqu... | 815 | 304 |
import tkinter
import sys
from .customtkinter_tk import CTk
from .customtkinter_frame import CTkFrame
from .appearance_mode_tracker import AppearanceModeTracker
from .customtkinter_theme_manager import CTkThemeManager
from .customtkinter_canvas import CTkCanvas
from .customtkinter_settings import CTkSettings
from .cus... | 10,094 | 2,845 |
from entityfx.benchmark_base import BenchmarkBase
from entityfx.dhrystone2 import Dhrystone2
from entityfx.writer import Writer
class DhrystoneBenchmark(BenchmarkBase):
def __init__(self, writer: Writer, print_to_console : bool=True, is_enabled : bool=True) -> None:
super().__init__(writer, print_to... | 883 | 293 |
from django.urls import path
from . import views
urlpatterns = [
path("", views.IndexView.as_view(), name="index"),
path('loginTranskribus/', views.loginTranskribus, name='loginTranskribus'),
path('getCollectionList/', views.getCollectionList, name='getCollectionList'),
path('getDocume... | 694 | 201 |
from client import XTBClient
from settings import XTB_USER, XTB_PASS
import pytest
@pytest.fixture(scope="session")
def xtb_client():
client = XTBClient()
logged_in_msg = client.login(XTB_USER, XTB_PASS)
assert logged_in_msg.get('status') is True, 'Error code {}'.format(logged_in_msg.get('errorCode'))
... | 458 | 150 |
class Vehicle:
def __init__(self):
self.lst = [0,0]
def moveUp(self):
self.lst[1] += 1
def moveDown(self):
self.lst[1] -= 1
def moveRight(self):
self.lst[0] += 1
def moveLeft(self):
self.lst[0] -= 1
def print_position(self):
print(tuple(self.lst))
... | 480 | 181 |
import numpy as np
reveal_type(np.zeros(1) - np.zeros(1))
| 59 | 29 |
import os
import csv
import smtplib
import datetime
import openpyxl
import threading
from tkinter import *
from email import encoders
from tkinter import messagebox
import paho.mqtt.client as mqtt
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
... | 15,233 | 4,511 |
# Copyright (c) 2017 Richard Sanger
#
# Licensed under MIT
#
# A simple debugging script to record and decode mode2 messages LIRC
# and decodes them
import os
import struct
import select
from heatpump import HeatPump
PULSE_BIT = 0x01000000
PULSE_MASK = 0x00FFFFFF
f = os.open("/dev/lirc0", os.O_RDONLY)
assert f > 0
g... | 1,626 | 516 |
# Config parameters for dash app
BASE_URL = "http://127.0.0.1:5000/dashboard/"
DASH_CACHING = True
COMMON_CACHE = True
| 119 | 54 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import gzip
import json
import logging
import urllib.request
from pathlib import Path
from typing import Dict, List, Tuple, Generator
import h5py
import numpy as np
import torch
from allennlp.commands.elmo import ElmoEmbedder
from tqdm import tqdm
logger... | 15,139 | 4,522 |
import numpy as np
import json
import os
def innerprod(A, B):
# This function computes the standard inner product between two matrices via vectorization
if isinstance(A, np.ndarray) and isinstance(B, np.ndarray):
return np.dot(A.flatten(), B.flatten())
elif isinstance(A, tuple) and isinstance(B, t... | 3,261 | 1,406 |
# hint: test_argparse is provided by libpythonX.Y-testsuite on ubuntu
from test.test_argparse import ArgumentParserError, stderr_to_parser_error
import pytest
from flattentool import cli
def test_create_parser():
"""
Command line arguments that should be acceptable
"""
parser = cli.create_parser()
... | 780 | 229 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'path_item.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, Qt... | 1,758 | 614 |
"""Transform a geospatial file to a GeoCSV (WKT)."""
import operator
import geopandas as gpd
import mobilib.argparser
parser = mobilib.argparser.default(__doc__)
parser.add_argument('in_file', help='GDAL-compatible file')
parser.add_argument('out_file', help='path to output CSV')
if __name__ == '__main__':
ar... | 681 | 263 |
import json
import sys
def load_dataset(split):
data = {}
if split == 'synthetic':
with open('tasks/R2R-pano/data/R2R_literal_speaker_data_augmentation_paths.json') as f:
data = json.load(f)
else:
with open('tasks/R2R-pano/data/R2R_%s.json' % split) as f:
data = json... | 1,751 | 590 |
import os, csv
import numpy as np
import urllib.request, json
from flask import Flask, escape, request, render_template, jsonify
from leaderboard.leaderboard import Leaderboard
import requests
import lxml.html as lh
import pandas as pd
from algosdk.v2client import algod
from algosdk import account, mnemonic
from co... | 7,969 | 2,514 |
from fibonacci_heap_mod import Fibonacci_heap as fh
from IPA.IPAData import *
def is_valid_sound(tup):
features = set(tup)
return (len(features & places) < 2 or (len(features & {'AL', 'PA'}) == 2 and len(features & places) == 2)) and len(features & manners) < 2
def neighbours(vertex, whole_set, distances):
... | 2,827 | 942 |