text
string
size
int64
token_count
int64
# # author: Jungtaek Kim (jtkim@postech.ac.kr) # last updated: February 8, 2021 # import numpy as np import pytest from bayeso_benchmarks.inf_dim_rosenbrock import * class_fun = Rosenbrock TEST_EPSILON = 1e-5 def test_init(): obj_fun = class_fun(2) with pytest.raises(TypeError) as error: class_fu...
1,788
913
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: POGOProtos.Data.Battle.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf impor...
26,314
10,941
def test_get_all(): ...
28
12
# Librerias import numpy as np from numpy import poly1d,polyfit import matplotlib.pyplot as plt from sympy import Symbol import pandas as pd # Para imprimir en formato LaTex from sympy.interactive import printing printing.init_printing(use_latex=True) def Rachford_Rice_4(z,k,Li,Ls,p): psi = np.arange(Li,Ls+p,...
1,162
585
# Time: O(n) # Space: O(n) , min(n,k) since only storing num%k element in map. class Solution: def checkSubarraySum(self, nums: List[int], k: int) -> bool: """ Lots of edge cases to take care of with 0. if a%k == b%k, then b-a%k==0 eg: if a%k==3, b%k==3, then (a+3)%k==0, (b+3)%k==0,...
840
300
from fastapi import APIRouter, Request from api.core import log_error router = APIRouter( prefix="/gifs", tags=["GIF generation endpoints"], responses={ 404: {"description": "Not found"}, }, ) # -- Router paths -- @router.get("/wink") @log_error() async def wink(request: Request) -> dict: ...
1,180
400
from feature_extract import get_feature_vector import time #demo objpath = "models/hhi_5.ply" start = time.time() features = get_feature_vector(objpath) end = time.time() time_cost = end-start #show the features cnt = 0 for feature_domain in ['l','a','b','curvature','anisotropy','linearity','planarity','sphericity']...
565
205
import numpy as np from bokeh.plotting import * N = 100 x = np.linspace(0, 4*np.pi, N) y = np.sin(x) output_file("glyphs.html", title="glyphs.py example") TOOLS = "pan,wheel_zoom,box_zoom,reset,save,box_select" p2 = figure(title="Another Legend Example", tools=TOOLS) p2.circle(x, y, legend="sin(x)") p2.line(x, y...
784
344
import pytest import json import subprocess defaultMinLength = 4 defaultMaxLength = 512 sites = {} with open("../data/sites.json", 'r') as json_file: sites = json.load(json_file) def test_lengths(): for length in range(defaultMinLength, defaultMaxLength): batcmd = "node -e \"consol...
2,103
661
from typing import Optional, Dict, List import json import os import re from pprint import pprint LIBC_REPO_PATH = os.getenv("LIBC_REPO_PATH", "libc") PREDICATES = { "fuchsia/mod.rs": {"os": ["fuchsia"]}, "unix/bsd/apple/mod.rs": {"os": ["macos", "ios"]}, "unix/bsd/freebsdlike/dragonfly/mod.rs": {"os": ["...
5,841
2,300
# (C) Copyright 1996- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernment...
686
196
def psyche1() -> str: return "3"
45
21
import logging _logger = logging.getLogger(__name__) import sys import os import csv import time import numpy as np class Statistics(object): """ This class handles all statistics of an experiment. The class keeps the statistics running and saves certain paramaters at the end of an epoch to files. It's a...
13,389
4,032
# -*- coding: utf-8 -*- from django.utils.translation import get_language from django.shortcuts import get_object_or_404, render_to_response from django.template import RequestContext from django.http import Http404 from cmskit.products.models import Category, Product def index(request): categories = Category.obje...
1,284
360
from time import time import xlart if __name__ == '__main__': start = time() xlart.resize_image('picture.jpg', 'picture_resized.jpg', 200, 200) xlart.image_to_xlsx('picture_resized.jpg', 'demo.xlsx') end = time() print('An xlart file has been generated in ' + str(end - start) + 's.')
307
120
import brownie AMOUNT = 10 ** 18 def test_single_withdraw_all(alice, vault, alcx, ss_compounder): prior_pool_balance = ss_compounder.stakeBalance() prior_alcx_balance = alcx.balanceOf(alice) alcx.approve(vault, AMOUNT, {'from': alice}) vault.deposit(AMOUNT, {'from': alice}) vault.withdrawAll({'...
528
215
from sigcom.cli import main main()
34
11
from rest_framework.decorators import api_view from rest_framework.response import Response @api_view() def hello_world(request): """Get for the hello world test.""" return Response({'message': 'Hello World!'})
221
62
"""Test Constituency Parsing module""" import unittest from pororo import Pororo class PororoConstParsingTester(unittest.TestCase): def test_modules(self): const = Pororo(task="const", lang="ko") const_res = const( "지금까지 최원호 한화 이글스 감독대행, 이동욱 NC 다이노스 감독, 이강철 KT 감독에 이어 4번째 선물이었다.") ...
685
302
import json import requests import pprint from time import sleep import random #extracts all user-agents from the provided 'ua_file.txt' into a list then randomly selects a user-agent def getUserAgent(): randomUserAgent = "" listOfUserAgents = [] userAgentFile = 'ua_file.txt' with open('ua_file.txt') ...
6,120
1,879
import numpy as np class InsertionSort(object): def insertionSort(self, array): """ :type array: before sort :rtype: array: after sort """ l = len(array) for i in range(1, l): key = array[i] j = i - 1 while j >= 0 and array[j] > ke...
585
183
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Update time: 2021/6/19 class MorsecodeError(Exception): ''' 自定义异常, 更明了的异常信息 ''' def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class Morsecoder: ''' 基于Python3.6+的摩斯密码库, 支持编码...
4,674
1,753
# -*- coding: utf-8 -*- # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Unit tests for puppet_metrics.""" # pylint: disable=protected-access from __future__ import absolute_import from __future__ i...
6,629
2,711
import os import time from flask import Blueprint, render_template, redirect, url_for, request, current_app from . import mvg from . import displays from PIL import Image, ImageFont, ImageDraw def create_bp(app): bp_mvg = Blueprint('mvg-frame', __name__, url_prefix='/mvg-frame') displays.init(app) @bp_m...
5,628
1,895
"""value_error.py Collection of functions useful in parsing ValueError messages and providing a more detailed explanation. """ import re from ..my_gettext import current_lang, no_information, internal_error from .. import info_variables from .. import debug_helper from .. import utils convert_type = info_variables....
4,770
1,530
import jwt from flask import json def test_token_with_game_data_is_generated_after_posting_valid_data(app, test_client, session): grid = ('CCCCC.....' + 'BBBB......' + 'RRR.......' + 'SSS.......' + 'DD........' + '..........' + '..........' + '..........' ...
874
287
#!/usr/bin/env python """BeatCleaver Unsorted Tree Implementation.""" from collections import deque # pylint: disable-msg=W0212 # pylint can't figure out that we're accessing a protected member of our own # class. class BcTree(object): """Unsorted Native Python Tree.""" DFS = 0 BFS = 1 def __init_...
5,951
1,610
""" Information ================== pypheus is a Python binding for Morpheus a prominent Cloud Management Platform. This application will abstract the the Morpheus API and allow users to make simple python requests. wookieware 2022 version 0.1.0 - init release """ from pypheus import (auth, network, storage, monitori...
324
90
#!/bin/python import datetime from http.server import HTTPServer, BaseHTTPRequestHandler import dose_rates class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): def do_GET(self): if self.path == '/metrics': results = dose_rates.get_data() body = '\n'.join(results) s...
773
244
from .base import JSONView from django.contrib.auth import authenticate, login, logout from django.urls import reverse from ..registration.utility import decrypt as password_decrypt class LoginView(JSONView): def get_context_data(self, **kwargs): username = self.request.POST['username'] password ...
824
224
#!flask/bin/python import os import sys from collections import defaultdict sys.path.append("./csv_detective_ml") # horrible hack to load my features class to load my ML pipeline :/ from flask import Flask from flask import request from flask import jsonify from flask_restplus import Api, Resource, fields from flask_...
7,487
2,233
''' 80-Crop Image Source: vars sources and shambleized pip install opencv-python ''' import cv2 # Load image to crop. img = cv2.imread('weird.jpg', cv2.IMREAD_UNCHANGED) # Set crop dimensions # We first supply the startY and endY coordinates, #followed by the startX and endX coordinates to the slice. #top-line-230 ...
624
245
import random def quick_select_helper(a, beg, end, k): if beg >= end: return if end == beg + 1: if a[beg] > a[end]: a[beg], a[end] = a[end], a[beg] return pivot_index = random.randint(beg, end) pivot = a[pivot_index] # 1 swap pivot with beginning if pivot_i...
1,474
574
from flask import * import pymongo from pymongo import * app = Flask(__name__) app.debug = True app.secret_key = 'test' cluster = MongoClient("mongodb://Ranuga:ranuga2008@cluster0-shard-00-00.odlbl.mongodb.net:27017,cluster0-shard-00-01.odlbl.mongodb.net:27017,cluster0-shard-00-02.odlbl.mongodb.net:27017/myFirstDatabas...
1,212
439
from app import db class SubtitlePath(db.Model): __tablename__ = "subtitle" id = db.Column(db.Integer, primary_key=True) uuid = db.Column(db.String(64), unique=True, nullable=True) lang = db.Column(db.String(32)) filepath = db.Column(db.String(128), nullable=False) def __repr__(self): ...
371
137
from django.contrib import admin from .import models from meme.models import Comment # Register your models here. admin.site.register(models.Mem) class CommentAdmin(admin.ModelAdmin): list_display =('user','approved') admin.site.register(Comment,CommentAdmin)
263
75
################################################################################ # A simple script to convert the iris training data to the vowpal wabbit format. # # Author: Carl Cortright # Date: 9/10/2016 # # Copyright 2016 Carl Cortright ###############################################################################...
2,033
698
from django.shortcuts import render from django.http import HttpResponse from sncfdata_rt.models import Station # Create your views here. def index(request): stations_list = Station.objects.order_by('station_name')[:5] context = {'stations_list': stations_list} return render(request, 'sncfdata_rt/index.ht...
767
211
""" https://programmers.co.kr/learn/courses/30/lessons/87946 피로도 """ result = 0 def gogo(k, dun, depth=0): global result if result < depth: result = depth if k < 1: return if dun == None: return for i in range(len(dun)): if k >= dun[i][0]: gogo(k - dun[i]...
516
227
# -*- coding: utf-8 -*- # ***************************************************************************** # NICOS, the Networked Instrument Control System of the MLZ # Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS) # # This program is free software; you can redistribute it and/or modify it under # the t...
10,914
3,434
""" sv_performance_test.py: Medium tests to ensure variant discovery hasn't changed too much """ import os import json import unittest import sys import subprocess from glob import glob from python.functest.utils.setup import ( ftest_setup, ftest_teardown, ftest_module_setup ) SEARCH_PATH = ["/scratch"] ...
5,391
1,883
def banner(): print "### Firesheep Detector p197-200 ###" print "" def fireCatcher(pkt): def main(): banner() fireCatcher(pkt): if __name__ == '__main__': main()
177
85
# Blender Mesh Export for the Whipstitch Game Engine # Copyright D. Scott Nettleton, 2013 # This software is released under the terms of the # Lesser GNU Public License (LGPL). import bpy,os from math import sqrt from mathutils import Matrix, Vector, Quaternion from copy import deepcopy workingDirectory = "./"...
27,257
10,004
from functions.Logger import log_info, error_handle from discord.ext import commands import sys class Basic(commands.Cog): def __init__(self, client): self.client = client #on_ready event example @commands.Cog.listener() async def on_ready(self): log_info("Basic module loaded!") ...
2,214
646
# Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k. # Example 1: # Input: nums = [1,2,3,1], k = 3 # Output: true # Example 2: # Input: nums = [1,0,1,1], k = 1 # Output...
638
227
# -*- coding: utf-8 -*- """ Created on Tue Jun 9 14:10:44 2020. @author: pielsticker """ import os import pickle import numpy as np import json from matplotlib import pyplot as plt import matplotlib.colors as mcolors import seaborn as sns from docx import Document from docx.enum.table import WD_TABLE_ALIGNMENT, WD_R...
23,120
7,044
"""Low-level wrapper around zbar's interface """ import platform import sys from ctypes import ( cdll, c_ubyte, c_char_p, c_int, c_uint, c_ulong, c_void_p, Structure, CFUNCTYPE, POINTER ) from ctypes.util import find_library from enum import IntEnum, unique from pathlib import Path # Types c_ubyte_p = POINTE...
7,743
2,778
#!/usr/bin/env python3 import argparse import time import random from configparser import ConfigParser from influxdb import SeriesHelper, InfluxDBClient parser = argparse.ArgumentParser() parser.add_argument('config', help='path to the config file') args = parser.parse_args() config_parser = ConfigParser() config_...
1,281
451
# Created by Egor Kostan. # GitHub: https://github.com/ikostan # LinkedIn: https://www.linkedin.com/in/egor-kostan/ # ALGORITHMS MATHEMATICS NUMBERS import unittest import allure from kyu_5.number_of_trailing_zeros_of_n.zeros import zeros from utils.log_func import print_log @allure.epic('5 kyu') @allure.parent_...
2,084
670
import numpy as np import pandas as pd import os import seaborn as sns import matplotlib.pyplot as plt from fairness.data.objects.list import DATASETS, get_dataset_names sns.set_context(rc={"figure.figsize": (8, 4)}) sns.set(style = 'white', font_scale = 1.5) colors = ['#2ECC71' , '#FFEB3B'] # Green, yellow curren...
1,404
572
info = { "name": "pt", "date_order": "DMY", "january": [ "janeiro", "jan" ], "february": [ "fevereiro", "fev" ], "march": [ "março", "mar" ], "april": [ "abril", "abr" ], "may": [ "maio", "mai" ...
25,744
7,491
from .async_web_agent import AsyncWebAgent from .utils import sync class WebAgent(AsyncWebAgent): update = sync(AsyncWebAgent.update) get_media = sync(AsyncWebAgent.get_media) get_likes = sync(AsyncWebAgent.get_likes) get_comments = sync(AsyncWebAgent.get_comments)
284
92
# List of ipymd cells expected for this example. output = [ {'cell_type': 'markdown', 'source': '# Header'}, {'cell_type': 'markdown', 'source': 'A paragraph.'}, {'cell_type': 'markdown', 'source': 'Python code:'}, {'cell_type': 'code', 'input': 'print("Hello world!")', 'out...
511
174
# -*- coding: utf-8 -*- ######################################################################## # # Copyright (c) 2021 Baidu.com, Inc. All Rights Reserved # # Author: suweiyue(suweiyue@baidu.com) # Date: 2021/06/03 23:12:20 # ######################################################################## """ Comment. """...
2,508
1,070
'''Autogenerated by get_gl_extensions script, do not edit!''' from OpenGL import platform as _p, constants as _cs, arrays from OpenGL.GL import glget import ctypes EXTENSION_NAME = 'GL_ARB_occlusion_query' def _f( function ): return _p.createFunction( function,_p.GL,'GL_ARB_occlusion_query',False) _p.unpack_constan...
1,463
637
def test_db_access_with_repr_in_report(django_testdir) -> None: django_testdir.create_test_module( """ import pytest from .app.models import Item def test_via_db_blocker(django_db_setup, django_db_blocker): with django_db_blocker.unblock(): Item.objects....
959
310
#coding:utf-8 import data import ssh import sftp import common import time import threading def threads_connect(name,i): ssh.create_conn(i) sftp.create_conn(i) print('\33[34m%d:\33[31m%s成功:%s(%s) \33[0m' %(i,name,data.servers[i]['name'],common.hideipFun(data.servers[i]['host']))) def threads_handle(threa...
2,754
917
__all__ = ["category", "item", "user"]
39
15
''' test need_to_wrap >>> assert not need_to_wrap(['127.0.0.1:8889', '127.0.0.1']) >>> assert need_to_wrap(['127.0.0.1:8889', 'source']) ''' from simple_pp.need_to_wrap import need_to_wrap def test_trivial(): ''' trivial tests''' assert not need_to_wrap(['127.0.0.1:8889', '127.0.0.1']) # extra...
588
270
# Copyright (C) 2010-2011 Richard Lincoln # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish...
6,304
2,182
# -*- coding: utf-8 -*- import configparser import cv2 import sys if (len(sys.argv)<2) : print("usage: ",sys.argv[0]," [config]") exit() if (sys.argv[1] == '--help')|(sys.argv[1] == '-h') : print("usage: ",sys.argv[0]," [config]") exit() config = configparser.ConfigParser() config.read(sys.argv[1])
319
132
from django import forms from .models import Product, Good class GoodForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(GoodForm, self).__init__(*args, **kwargs) class Meta: model = Good fields = ('name', 'options', 'description', 'image', 'tmp_responsibility', 'tmp_amo...
411
118
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals from operator import itemgetter import frappe from frappe import _ from frappe.utils import cint, date_diff, flt from six import iteritems from erpne...
9,219
3,883
import requests resp = requests.get("https://edu-tob.bdimg.com/v1/pc/pc%E5%85%88%E9%A6%96%E9%A1%B5%E5%A4%B4%E5%9B%BE5120-640-1608686903810.png") with open("a.png", "wb") as f: f.write(resp.content) # 返回cookie信息转换的字典 键值对 se = requests.session()
248
149
# # Copyright 2019-2020 Lukas Schmelzeisen # # 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 t...
2,652
848
# coding=UTF-8 from __future__ import print_function, absolute_import, division
80
24
#!/usr/bin/env python3 # # Copyright (C) 2019 jayson # from utils.connection import get_connection from config import RABBITMQ_MASTER if __name__ == '__main__': with get_connection(RABBITMQ_MASTER, 'hello') as channel: while True: channel.basic_publish(exchange='', routing_key='hell...
358
129
# coding: utf-8 # Copyright (c) Henniggroup. # Distributed under the terms of the MIT License. from __future__ import division, print_function, unicode_literals, \ absolute_import """ Wulff construction to create the nanoparticle """ from six.moves import range import itertools from math import gcd from functoo...
6,188
1,984
import os from collections import Counter MODULE_DIR = os.path.dirname(os.path.realpath(__file__)) PROJECT_DIR = os.path.join(MODULE_DIR, "..") INPUT_SOURCE_DIR = os.path.join(PROJECT_DIR, "input") def get_data_lines(input_file_name): input_file = os.path.join(INPUT_SOURCE_DIR, input_file_name) print(f"Inpu...
1,262
535
#!/usr/bin/env python3 """Verifies sizes and sha256 sums for files.yml files.""" import os import subprocess import sys from pathlib import Path import yaml def main(): """Main entry point""" for files_yaml_path in sys.argv[1:]: profile_root = Path(files_yaml_path).parent with open(files_yaml...
1,460
434
from abc import ABC from collections import OrderedDict class Witness(ABC): def __init__(self, a1, a2, s, eps, method, **kwargs): self.meth = method self.a1 = a1 self.a2 = a2 self.s = s self.eps = eps self.kwargs = OrderedDict(kwargs) def get_witness(self): ...
1,370
504
import numpy as np from tqdm import tqdm class TicTacToe(object): # Constructor of the TicTacToe class # <Params name="player1" type="Agent">The first player</Params> # <Params name="player2" type="Agent">The second player</Params> # <Params name="rewards" type="object"> # <Contains key="w...
6,873
2,048
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
9,780
3,239
import os import json import argparse import numpy as np from glob import glob from multiprocessing import Pool parser = argparse.ArgumentParser() parser.add_argument( "--root", default="/misc/kcgscratch1/ChoGroup/resnick/spaceofmotion/flows", type=str) parser.add_argument( "--store_dir", default="...
1,216
458
import setuptools with open("README.rst") as fh: long_description = fh.read() required = [] with open("requirements.txt", "r") as fh: required.append(fh.read().splitlines()) setuptools.setup( name="cornflow-core", version="0.0.3a11", author="baobab soluciones", author_email="sistemas@baobabso...
1,171
378
# Copyright (c) 2020 SMHI, Swedish Meteorological and Hydrological Institute # License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit). """ Created on 2020-12-11 16:04 @author: johannes """ import pandas as pd class PandasReaderBase: """ """ def __init__(self, *args, **kwargs): ...
1,265
387
from gevent import pywsgi from geventwebsocket.handler import WebSocketHandler from flask import Flask, render_template, session, request app = Flask(__name__) server = pywsgi.WSGIServer(('127.0.0.1', 3001), app, handler_class=WebSocketHandler) if __name__ == '__main__': server.serve_forever() # import os # ...
575
200
"""PURPOSE: Converters: Lexemes towards encodings UTF8/UTF16/UTF32. During exical analysis matches delivers lexemes in the encoding of the buffer. The functions develops converters of those lexemes to standard encodings, so that they can easily be reflected. Let 'Character' be a character in the buffer's encoding, '...
17,890
5,601
""" Write a function total_seconds that takes three parameters hours, minutes and seconds and returns the total number of seconds for hours hours, minutes minutes and seconds seconds """ # Hours, minutes, and seconds to seconds conversion formula def total_seconds(hours, minutes, seconds): return (hours *...
642
216
""" Some logging configuration and shortcut methods. """ from twisted.python import log def debug(message): """ Shortcut to logging a debug message through Twisted's logging module. :param str message: The message to log. """ log.msg(message) def info(message): """ Shortcut to logging...
1,089
306
#do not comment that line import FWCore.ParameterSet.Config as cms #cosmicsNavigationSchoolESProducer = cms.ESProducer("NavigationSchoolESProducer", # ComponentName = cms.string('CosmicNavigationSchool') #) cosmicsNavigationSchoolESProducer = cms.ESProducer("SkippingLayerCosmicNavigationSchoolESProducer", ...
1,084
258
import tensorflow as tf from script.util.MixIn import LoggerMixIn from script.util.misc_util import error_trace class SessionManager(LoggerMixIn): def __init__(self, sess=None, config=None, verbose=0): super().__init__(verbose) self.sess = sess self.config = config if...
1,568
516
''' This module defines the class QueryBioLink. QueryBioLink class is designed to communicate with Monarch APIs and their corresponding data sources. The available methods include: * query phenotype for disease * query disease for gene * query gene for disease * query phenotype for gene * query gene...
9,500
3,372
"""MPF plugin which adds events from monitoring a Twitch chat room.""" import threading from mpf.core.logging import LogMixin from .twitch.twitch_client import TwitchClient MYPY = False if MYPY: # pragma: no cover from mpf.core.machine import MachineController # pylint: disable-msg=cyclic-import,unused-import ...
2,056
570
import os from selenium import webdriver driver = webdriver.Chrome("D:/Programming/python/chromedriver.exe") driver.maximize_window() from os import path from selenium.webdriver.common.action_chains import ActionChains from selenium.common.exceptions import UnexpectedAlertPresentException import time,unittest, re fro...
7,319
2,760
from . import utils class ContinuousScale(object): def __init__(self, data_lim, svg_lim): self.data_0 = data_lim[0] self.data_len = utils.lims2len(data_lim) self.svg_0 = svg_lim[0] self.svg_len = utils.lims2len(svg_lim) def __call__(self, value): return self.svg_0 + s...
778
294
__all__ = ['local', 'development', 'production', 'test', 'constants'] # from .base import BaseConfig from .development import DevelopmentConfig from .local import LocalConfig from .production import ProductionConfig from .test import TestConfig from .constants import *
271
66
""" Workorder module can be used to retrieve Workorder information from AssetCentral. Classes are provided for individual Workorders as well as groups of Workorders (WorkorderSet). """ from sailor import _base from ..utils.timestamps import _string_to_timestamp_parser from .constants import VIEW_WORKORDERS from .util...
5,781
1,663
#!/usr/bin/python """ ZetCode PyQt6 tutorial In this example, we display an image on the window. Author: Jan Bodnar Website: zetcode.com """ from PyQt6.QtWidgets import (QWidget, QHBoxLayout, QLabel, QApplication) from PyQt6.QtGui import QPixmap import sys class Example(QWidget): def __init__(self): ...
796
299
import math import os import random import sys from multiprocessing.pool import ThreadPool import urllib import file_util import pandas as pd ds = pd.read_csv("../data/simplemaps-worldcities-basic.csv") # Heuristically select from DB cities likely to be on google maps cities = ds[ds["pop"]>20000][ds....
3,423
1,254
''' SDM is a package for using Series as features ''' from .StructureData import * from .StructureDataFrame import * from .Transformers import *
146
40
# Copyright 2016 - Brocade Communications Systems, 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 b...
1,501
426
import json import re import subprocess import sys import unittest sys.path.append('.') from integrationtests import TestBase, json_header, server_location class CourseTest(TestBase): def test_course(self): url = f'{server_location}/test/add_account_single_session' json_data = "'" + json.dumps(...
1,587
518
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 11 15:51:21 2019 @author: michi """ import inspect from types import FunctionType # In[] class Enumerable: _generator = None _values = None # In[] def __init__(self, values): if Enumerable._is_generator_type(va...
3,465
1,019
""" MIT License Copyright (c) 2020 Mahdi S. Hosseini 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...
5,309
2,243
# -*- coding: utf-8 -*- # # utils.py — Debexpo utility functions # # This file is part of debexpo - https://alioth.debian.org/projects/debexpo/ # # Copyright © 2008 Serafeim Zanikolas <serzan@hellug.gr> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and ass...
13,438
8,308
# -*- coding: utf-8 -*- """ utils.py ~~~~~~~~~~~ Generic helper functions :copyright: (c) 2014 by @zizzamia :license: BSD (See LICENSE for details) """ import datetime import json import string import re import unicodedata from collections import Iterable from flask import request, render_template from hashlib import...
3,272
990
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class NetcdfFortran(AutotoolsPackage): """Fortran interface for NetCDF4""" homepage = "http...
1,286
479
""" Copyright 2020 Inmanta 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 ...
2,293
688
from django.shortcuts import render from django.views.generic.base import TemplateView from lists.models import List def index(request): my_lists = List.objects.filter(user=request.user) if request.user.username else [] return render(request, 'home.html', { 'my_lists': my_lists })
306
91