text
string
size
int64
token_count
int64
# memoro.wsgi # WSGI config for memoro project. # # Author: Benjamin Bengfort <benjamin@bengfort.com> # Created: Sat Nov 28 13:44:01 2020 -0500 # # Copyright (C) 2020 Bengfort.com # For license information, see LICENSE # # ID: wsgi.py [] benjamin@bengfort.com $ """ WSGI config for memoro project. It exposes the W...
1,100
327
""" Serialized Data Converter. Licensed under MIT Copyright (c) 2012 - 2015 Isaac Muse <isaacmuse@gmail.com> """ import sublime import sublime_plugin import codecs import re import traceback import os from SerializedDataConverter.lib.log import error_msg from SerializedDataConverter.lib import plist_includes as plist ...
29,679
8,122
#!/usr/bin/env python2.7 import urho v = urho.Vector3() c = urho.Context() fs = urho.FileSystem(c) from urho import StringHash as sh import os print (os.getcwd()) class App(urho.Application): #def __init__(self, name): # Dog.__init__(self) # Without this, undefind behavior may occur if the C++ portions a...
1,592
540
""" Django settings for tesis project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # -*- coding: utf-8 -*- # A tuple that lists people who get code error notifi...
7,696
2,446
#!/usr/bin/env python # This software code is made available "AS IS" without warranties of any # kind. You may copy, display, modify and redistribute the software # code either by itself or as incorporated into your code; provided that # you do not remove any proprietary notices. Your use of this software # cod...
4,445
1,408
from __future__ import absolute_import, division, print_function from models.base_net import BaseNet import losses.all as losses_lib import tensorflow as tf import tensorflow.contrib.slim as slim import numpy as np import pdb import optimizers.train_steps as train_steps import optimizers.ops as optimize from functo...
7,468
2,225
# trigger build import json import uuid import pytest from mock import MagicMock, patch from src import handler, db from src.models import User, MiniApp, TObject from src.constants import ROLE from werkzeug.exceptions import BadRequest @patch('src.db.push', side_effect=Exception) def test_execute_obj_post_exception(m...
13,459
4,868
try: import uuid except ModuleNotFoundError as err: uuid = None ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" PATTERN = [8, 4, 4, 4, 12] SEP = "-" class LongIdentifier(object): def __init__(self): super().__init__() @staticmethod def encode(): """Get UUID code (long identifie...
579
212
# Copyright (c) 2019-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import glob import unittest from typing import List, Optional from unittest.mock import MagicMock, patch from .. import BuilderException, FastBuckB...
19,622
5,668
from time import time from typing import List from core.security import verify_password from db import users as DBUsers from fastapi import APIRouter, Depends, HTTPException, status from fastapi.responses import JSONResponse from models.user import DBUser from schemas.user import (UserCreate, UserUpdateActivate, UserU...
5,970
1,891
## License: Apache 2.0. See LICENSE file in root directory. ## Copyright(c) 2015-2017 Intel Corporation. All Rights Reserved. ############################################### ## Open CV and Numpy integration ## ############################################### import pyrealsense2 as rs import numpy a...
3,265
1,205
import logging import os import psycopg2 import time import shlex import subprocess import shutil import threading from urllib.parse import urlparse logger = logging.getLogger(__name__) class Postgresql: CONN_OPTIONS = { 'connect_timeout': 3, 'options': '-c statement_timeout=2000', } ...
12,800
3,820
import genetic_algorithm #where the population will be processed and the main loop is contained #initialise population with random candidate solutions print("Enter a function to be solved: \n") fitness_function = [1780, 17, -2] #n = ax + by #function: [n, a, b] ga = genetic_algorithm.genetic_algorithm(fitness_func...
566
168
from flask import Flask, render_template app = Flask(__name__) @app.route("/") def index(): return render_template("macro.html", type="text", value="from endpoint") if __name__ == '__main__': print(app.url_map) app.run(debug=True, host="0.0.0.0")
264
97
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2018-09-26 01:25 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('fishpass', '0003_auto_20180925_1825'), ] operatio...
549
202
# Generated by Django 2.2.13 on 2021-03-10 21:33 import account.models import datetime from django.conf import settings import django.contrib.auth.models import django.contrib.auth.validators from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migr...
8,956
2,500
import tensorflow from PIL import Image from keras.models import Sequential from keras.layers import Conv2D, Conv2DTranspose, ConvLSTM2D from keras.optimizers import SGD import numpy as np import os from keras import backend as K from src.predictionAlgorithms.machineLearning.algorithms.ConvLSTM import ConvLstm from sr...
1,983
607
import bchlib from PIL import Image, ImageOps import numpy as np import glob from tqdm import tqdm import torch import matplotlib.pyplot as plt from model import StegaStampDecoder BCH_POLYNOMIAL = 137 BCH_BITS = 5 def get_bits(secret="MITPBL"): # 输入字符串,输出BCH码 bch = bchlib.BCH(BCH_POLYNOMIAL, BCH_BITS) da...
1,927
798
import pytest from django.test import TestCase from django.test import override_settings import ozpcenter.api.contact_type.model_access as model_access from ozpcenter.models import ContactType from tests.cases.factories import ContactTypeFactory @pytest.mark.model_access @override_settings(ES_ENABLED=False) class Co...
1,249
396
#!/usr/bin/python3 """Simple bot to reply exactly the same what user sent to chat.""" # This program is dedicated to the public domain under the CC0 license. from telegrask import Telegrask bot = Telegrask("BOT_TOKEN") @bot.command("echo", help="repeat user words", allow_without_prefix=True) def echo(update, contex...
428
139
from django.db import models from django.utils.translation import ugettext_lazy as _ from emailqueue.models import BaseModel class Domain(BaseModel): '''Domain: - used for :ref:`postfix.relay_domains`, :ref:`postfix.transport_maps` ''' domain = models.CharField( _('Domain'), max_length=50, u...
2,238
707
#!/usr/bin/env python # -*- coding: utf-8 -*- """This module is used to crawler emoji unicode from http://www.unicode.org/ """ import urllib import json import base64 import os from bs4 import BeautifulSoup __EMOJI_V4_URL = "http://www.unicode.org/emoji/charts/emoji-list.html" __EMOJI_V5_URL = "http://www.unicode.org/...
3,314
1,211
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in LICENSE.txt and may be redistributed only under # the conditions described in the aforementioned license. The license # is also available online at...
1,628
606
import mmap import numpy as np from time import sleep import os class PacketManager(object): buf_size = 0x1000 packet_size = 2072 #typedef struct _Packet{ # PacketType type; # uint32_t size; # uint64_t cycle; # uint32_t address; # uint8_t data[8]; # uint32_t flags; ...
5,072
1,796
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. from torch.optim import *
119
32
# -*- coding: utf-8 -*- import pandas as pd import numpy as np from datetime import date from typing import Union,Tuple,Optional,List from ..config_features import CATEGORICAL_FEATURES,NUMERICAL_FEATURES from ..config import DAYS_FORECAST,ALL_STATIONS from ..utils.normalizer import get_normalizer_stats def train_tes...
3,824
1,319
from .Preprocessor import Pipeline
35
9
import os import sys import copy import ctypes import socket import logging import threading import functools import webbrowser logger = logging.getLogger(__name__) import keyboard from PySide2 import QtCore, QtWidgets, QtGui, QtWebEngineWidgets # TODO # Be able to import a text file in the description/title as variab...
80,229
23,582
""" Contains unit tests to ensure single database items are created correctly in a Pascal VOC compatible format. """ import os from xml.etree.ElementTree import Element, SubElement import numpy as np from breakdb.io.export.voc import create_annotation from tests.helpers.dataset import create_random_string from tests....
4,009
1,307
import os import os.path as osp import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Circle, Polygon, Rectangle from config import PARAMS class WorldMap(object): def __init__(self, shapes=[], params=PARAMS): ''' The 'WorldMap' class is useful in constructing a 3D fig...
8,242
2,347
from django.db import models from .base import BaseModel class Provider(BaseModel): name = models.CharField(max_length=50, primary_key=True) class Meta: db_table = "providers" verbose_name = "Provider" verbose_name_plural = "Providers" def __str__(self): return self.nam...
322
101
import random import numpy as np import cPickle as pkl Train_handle = open("./data/weixin_data/weixin_train.txt",'w') Test_handle = open("./data/weixin_data/weixin_test.txt",'w') Feature_handle = open("./data/weixin_data/weixin_feature.pkl",'w') max_len = 50 def produce_neg_item_hist_with_cate(train_file, test_file):...
6,753
2,468
import sys import sqlite3 import csv from random import randint from faker import Faker fake = Faker() def setup_db(): try: db = sqlite3.connect('data/quotes.sqlite3') # Get a cursor object cursor = db.cursor() cursor.execute(''' CREATE TABLE quotes(id INTEGER PRIMAR...
2,197
684
from __future__ import annotations from amulet.world_interface.chunk.interfaces.leveldb.leveldb_12.leveldb_12_interface import ( LevelDB12Interface, ) class LevelDB13Interface(LevelDB12Interface): def __init__(self): LevelDB12Interface.__init__(self) self.features["chunk_version"] = 13 ...
523
170
from oarepo_model_builder.builders.json import JSONBuilder from oarepo_model_builder.output import JsonSchemaOutput class JSONSchemaBuilder(JSONBuilder): """Handles building of jsonschema from a data model specification.""" def __init__(self): super().__init__() self.output = None def pre...
921
264
import numpy as np def square(x): """Square a number""" return x ** 2 def volume_converter(volume, unit): """Convert certain SI volumes to mLs""" conversions = {'mL': 1E-3, 'uL': 1E-6, 'nL': 1E-9, 'kL': 1E3} return round(volume * conversions[unit], 10) def squared_sum(in_list): """Finds the s...
399
160
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import psycopg2 import time import statistics from selenium.webdriver.support.select import Select import json def wait_unt...
10,305
2,922
# # $Header: /home/inqwell/cvsroot/dev/scripts/python/FotechUtils/dbUtils.py,v 1.1 2009/05/22 22:16:32 sanderst Exp $ # import KBC.fotech from Util import db from dbConfig import configurationProvider def getConnection( confile, system, level, access = "read", site = None, user = None, pwdfile = None ): """ ...
963
290
#!/usr/bin/env python3 import random import argparse import sys def error(message): print(message) sys.exit(1) parser = argparse.ArgumentParser() parser.add_argument("number", help="Generate a random numbers until they are equal to this.", type=int) parser.add_argument("-s", "--start", t...
1,517
474
""" Clase para representar a los diferentes modelos y su comportamiento atributos(de momento) df=dataframe de entrenamiento proviniente del conjunto de datos de entrenamiento del usuario x_train,x_test,y_train,y_test, particiones de df para entrenar el modelo El resto de métodos son autoexplicativos """ from numpy ...
2,798
901
#!/usr/bin/env python3 import numpy as np import sys import struct # from math import fabs from enum import IntEnum from scipy import spatial from math import * from collections import OrderedDict def second(elem): return elem[1] def get_topk(a, k): k = min(a.size, k) idx = np.argpartition(-a.ravel(), k - 1)[:...
10,698
4,040
from src.eda import make_counter import pandas as pd import numpy as np from src.heroes import heroes, name_id, id_name def id_list_from_history(data): ''' Takes raw data returnd by api_calls.get_match_history() and returns a list of just the match ID's Input: data(list): ...
4,508
1,389
from django.shortcuts import render from .models import * def all_product(request): products = Product.objects.all() context = { 'products':products, } return render(request, 'essEcommerce/all_product.html', context) def cart(request): if request.user.is_authenticated: customer = ...
808
242
from rest_framework import serializers from rest_framework.validators import UniqueValidator from core.models import User class UserSerializer(serializers.Serializer): username = serializers.CharField( max_length=16, min_length=5, validators=[UniqueValidator(User.objects.all()), ]) pas...
431
121
from . import experts, gating_networks, gps, mixture_of_experts, training
74
26
from pynfldata.coaches_data import coaches_parser
49
17
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers, optimizers # BatchNorm 归一化网络激活函数 # 2 images with 4x4 size, 3 channels # we explicitly enforce the mean and stddev to N(1, 0.5) x = tf.random.normal([2, 4, 4, 3], mean=1.0, stddev=0.5) net = layers.BatchNormalization(axis=-1, ce...
991
372
"""Application entry point.""" import argparse import logging from pytocl.protocol import Client def main(): """Main entry point of application.""" parser = argparse.ArgumentParser(description='Client for TORCS racing car simulation with SCRC ' 'network server...
1,001
304
import sublime import sublime_plugin import re import os rexLastTabs = re.compile(r'(\t+|\s+)$', re.MULTILINE) rexEmptyLines = re.compile('^[ \t]*$\r?\n', re.MULTILINE) rexCont = re.compile(r'[^\t\s].*[^\t\s]') rexFormatted = re.compile(r"((?<=\s)'|(?<=\t)')|('*\s[\+|\\|])") class RunMultilineAction(sublime_plugin.T...
2,381
960