text
string
size
int64
token_count
int64
import typing from typing import Any import json import os from multiprocessing import Process, Queue from allennlp.data.tokenizers.word_splitter import SpacyWordSplitter from spacy.tokenizer import Tokenizer import spacy from tqdm.auto import tqdm import time nlp = spacy.load("en") class TokenizingWorker(Process):...
2,605
838
# For larger scale projects, I really should learn to use classes... lol from PIL import ImageGrab, ImageTk, Image import keyboard import pyautogui import tkinter as tk import os import time, datetime import text_redirect as TR import sys # GUI stuff TITLE = "Minecraft-Fisher - Made by Hoswoo" DARK_BLUE = '#0A3D62' L...
5,823
2,061
""" Iterates through a collection of BioModels """ from sbml_shim import SBMLShim import sys import os.path ################################################ # Classes that count pattern occurrences ################################################ class BiomodelIterator(object): def __init__(self, path, excludes=Non...
1,248
396
from __future__ import annotations from typing import TYPE_CHECKING, List from sqlalchemy import Column, String from sqlalchemy.orm import relationship from ...database import BaseModel if TYPE_CHECKING: from ..user.models import User class Company(BaseModel): name: str = Column(String) users: List[U...
411
124
# -*- coding: utf-8 -*- from os import path from google_images_download import google_images_download for keyword in [ "dog", "cat", "bird", "elephant", "fork", "knife", "spoon", "carrot", "orange", "turnip", "tomato", "potato", "water", "hair", "table", "chair", "house", "factory", "microwave", "cigarette", ...
1,913
686
dnas = [ ['jVXfX<', 37, 64, 24.67, 14, 7, -4.53, {'ott_len': 42, 'ott_percent': 508, 'stop_loss': 263, 'risk_reward': 65, 'chop_rsi_len': 31, 'chop_bandwidth': 83}], ['o:JK9p', 50, 62, 32.74, 37, 8, -0.2, {'ott_len': 45, 'ott_percent': 259, 'stop_loss': 201, 'risk_reward': 41, 'chop_rsi_len': 12, 'chop_bandwidth': 274}...
4,752
3,076
############################################################################## # Copyright 2009, Gerhard Weis # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code ...
2,909
987
import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp from scipy.sparse.linalg.eigen.arpack import eigsh import sys import tensorflow as tf import os import time import json from networkx.readwrite import json_graph from sklearn.metrics import f1_score import multiprocessing def parse...
17,848
6,370
from django.db import models from django.utils.timezone import now from django.contrib.auth.models import User from utils.base_model import SoftDeletionModel class Tag(SoftDeletionModel): name = models.CharField('标题名', max_length=100, unique=True, blank=False, null=False) created_time = models.DateTimeField(...
506
162
""" Runs a pre-check of a staging area to identify issues that might cause the snapshot or indexing processes to fail. """ import argparse import sys from hca.staging_area_validator import StagingAreaValidator def _parse_args(argv): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--...
1,410
378
# -*- coding:utf-8 -*- import random import time from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from app.api.util.web_request import WebRequest, USER_AGENT_PC, USER_AGENT_MOBILE class SpiderWebDriver(object): def __init__(sel...
6,621
2,151
import unittest import main import re class MatrixRowsVerification(unittest.TestCase): def setUp(self): self.matrix1 = {0: [1, 2, 3], 1: [4, 5, 6]} self.matrix2 = {0: [1, 2], 1: [3, 4], 2: [5, 6]} def test_getRowsType(self): self.assertIsInstance(main.getRows(self.matrix1), int, 'wrong...
2,879
1,026
import os from setuptools import setup def read(fname): filename = os.path.join(os.path.dirname(__file__), fname) return open(filename).read().replace('#', '') setup( name="livedumper", version="0.3.0", author="Thiago Kenji Okada", author_email="thiago.mast3r@gmail.com", description=("Liv...
1,210
394
import os import argparse import numpy as np import csv import cv2 img_w = 0 img_h = 0 def relativ2pixel(detection, frameHeight, frameWidth): center_x, center_y = int(detection[0] * frameWidth), int(detection[1] * frameHeight) width, height = int(detection[2] * frameWidth), int(detection[3] * frameHeight) ...
2,862
1,198
#! /urs/bin/env python # Copyright 2017-2020 Fitbit, Inc # SPDX-License-Identifier: Apache-2.0 ##################################################################### # This script post-processes the XCode project generated # by CMake, so that it no longer contains absolute paths. # It also remaps UUIDs so that they ar...
8,687
2,642
#!/bin/python3 # Application for getting early US visa interview: # The tool will Scrape the CGI website and check # available date before the current appointment date, # if a date is available, the program will beep. # NOTE: SET THESE GLOBAL VARIABLES BEFORE USE # COOKIE: After you login, there is a `cookie` # ...
3,091
1,210
def createArray(dims) : if len(dims) == 1: return [0 for _ in range(dims[0])] return [createArray(dims[1:]) for _ in range(dims[0])] def f(A, x, y): m = len(A) for i in range(m): if A[i][x] > A[i][y]: return 0 return 1 class Solution(object): def minDeletionSize(self, A): ...
815
324
# Copyright 2017 Google Inc. 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 law or a...
3,883
1,325
from mock import patch from custom.icds_reports.ucr.tests.test_base_form_ucr import BaseFormsTest @patch('custom.icds_reports.ucr.expressions._get_user_location_id', lambda user_id: 'qwe56poiuytr4xcvbnmkjfghwerffdaa') @patch('corehq.apps.locations.ucr_expressions._get_location_type_name', lambda loc_id...
10,713
3,250
# 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...
2,898
987
from inqry.system_specs import win_physical_disk UNIQUE_ID_OUTPUT = """ UniqueId -------- {256a2559-ce63-5434-1bee-3ff629daa3a7} {4069d186-f178-856e-cff3-ba250c28446d} {4da19f06-2e28-2722-a0fb-33c02696abcd} 50014EE20D887D66 eui.0025384161B6798A 5000C5007A75E216 500A07510F1A545C ATA LITEONIT LMT-256M6M mSATA 256GB ...
1,257
706
import time # NOQA from app import db class Link(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String) url = db.Column(db.String) description = db.Column(db.String) type = db.Column(db.Integer) enabled = db.Column(db.Boolean) createtime = db.Column(db.DateTi...
572
182
from pyopenproject.api_connection.exceptions.request_exception import RequestError from pyopenproject.api_connection.requests.get_request import GetRequest from pyopenproject.business.exception.business_error import BusinessError from pyopenproject.business.services.command.find_list_command import FindListCommand from...
1,786
404
from django.test import TestCase from django.urls import reverse_lazy from ..models import PHOTO_MODEL, UploadedPhotoModel, IMAGE_SIZES from .model_factories import get_image_file, get_zip_file import time from uuid import uuid4 class UploadPhotoApiViewTest(TestCase): def check_photo_ok_and_delete(self, photo): ...
1,745
559
import os import time from PIL import Image import pyscreenshot as ImageGrab import resource from drive import box_drive64 from util import image_util, data_config_parser from util.data_parser import read_data from weapon import weapon, page_check, weapon_selection, left_right_correction import environment import thr...
16,756
6,448
from concurrent.futures import ALL_COMPLETED, ThreadPoolExecutor, as_completed import csv import dearpygui.dearpygui as dpg from os.path import isfile, isdir, join import pyperclip import subprocess import sys from tempfile import gettempdir from traceback import print_exc import core import extruct import utilio fro...
16,009
5,270
# Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # 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 ...
3,813
1,109
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from asdf import yamlutil from asdf.versioning import AsdfSpec from ..types import AstronomyDataModelType from ..fixed_location import FixedLocation class FixedLocationType(AstronomyDataModelType): name = 'datamodel/fixed_loca...
1,835
592
# Generated by Django 4.0.3 on 2022-03-21 13:04 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('app', '0002_remove_profile_caption_alter_profile_profile_pic_and_more'), ] operations = [ migrations.Create...
868
277
from .seed_assessment_type import seed_assessment from .seed_question import seed_question from .seed_answer import seed_answer from .seed_user import seed_user from .seed_score import seed_score from .seed_assessment_name import seed_assessment_name class Seeder(object): def seed_all(self): seed_assess...
440
138
from pandas import DataFrame from contek_tusk.table import Table class MetricData: def __init__(self, table: Table, df: DataFrame) -> None: self._table = table self._df = df def get_table(self) -> Table: return self._table def get_data_frame(self) -> DataFrame: return s...
328
103
from .inlinec import inlinec
28
8
""" SpaceCRAFT - Astro Pi competition[http://astro-pi.org/] entry Conceived by Hannah Belshaw Created by Martin O'Hanlon[http://www.stuffaboutcode.com] For the Raspberry Pi Foundation[https://www.raspberrypi.org] mcastropi.py A movable minecraft model of a Raspberry Pi with an Astro Pi on top """ from minec...
3,360
1,592
import copy import math import numpy as np # import rpack from rectpack import newPacker from rectpack.maxrects import MaxRectsBssf def _change_dim_order(sizes): return [[s[1], s[0]] for s in sizes] # def get_pack_coords(sizes): # # list of [height, width] i.e. img.shape order # sizes = _change_dim_ord...
1,444
592
# DD.MM.YYYY (DD — номер дня, MM — номер месяца, YYYY — номер года) import re import datetime def is_task_current(task, date): result = None groups = re.match('([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})', task['condition']) type_is_correct = groups != None if type_is_correct: task...
626
228
from setuptools import setup setup( name='pyons', version='1.0', author="Andrey Larionov", author_email="larioandr@gmail.com", license="MIT", py_modules=['pyons'], install_requires=[ ], tests_requires=[ 'pytest', ], )
268
98
#! /usr/bin/env python3.2 import re def _subpre(text): list=re.split('(<pre>|</pre>)',text) for i in range(len(list)): # begin of pre if i%4==1: list[i]='\n\n ' # in pre elif i%4==2: list[i]=re.sub('<p>|<br>|\n\n', '\n\n ',list[i]) # end of pre elif i%4==3: list[i]=...
2,262
1,049
class Encoder: def __init__(self, encoding = {}): self.encoding = encoding def updateEncoding(self,string1,string2): list1 = str.split(string1) list2 = str.split(string2) self.encoding = {} for i in range(len(list1)): self.encoding[list1[i]] = list2[i] ...
2,572
817
from requests.adapters import HTTPAdapter, DEFAULT_POOLBLOCK from requests.packages.urllib3.poolmanager import PoolManager class TribAdapter(HTTPAdapter): def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK): self._pool_connections = connections self._pool_maxsize = maxsize ...
543
143
from .phc import *
18
7
import sympy as sym import torch import torch.nn as nn import torch.nn.functional as F class LambdaLayer(nn.Module): """ Layer that applies a given function on the input """ def __init__(self, lambd): super(LambdaLayer, self).__init__() self.lambd = lambd def forward(self, x): ...
14,006
4,226
import movies def action_handler(action, parameters, return_var): return_values = {} if action == 'trendings': return_values = get_trendings(parameters, return_var) elif action == 'search': return_values = search_movies(parameters, return_var) return { 'skills': { ...
1,326
416
lista = list(range(0,10001)) for cont in range(0,10001): print(lista[cont]) for valor in lista: print(valor)
118
52
import spacy from spacy.lang.ro import Romanian from typing import Dict, List, Iterable from nltk import sent_tokenize import re # JSON Example localhost:8081/spacy application/json # { # "lang" : "en", # "blocks" : ["După terminarea oficială a celui de-al doilea război mondial, în conformitate cu discursul lu...
8,282
2,633
#! /usr/bin/env python # comando con argumentos # y procesamiento de una imagen # enviada por el usuario from telegram.ext import Updater, CommandHandler, MessageHandler, Filters from io import BytesIO from PIL import Image import cv2 as cv import skimage.io as io updater = Updater('api token del bot') def sendImag...
1,375
512
from sklearn.preprocessing import StandardScaler, LabelEncoder, MinMaxScaler, OneHotEncoder import numpy as np import pandas as pd import tqdm """ Class for Preprocessing CICIDS2017 Data represented as rows """ class CICIDSPreprocessor: def __init__(self): self.to_delete_columns = ['Flow ID', ' Timestamp...
1,236
438
import os from netmiko import ConnectHandler from getpass import getpass from pprint import pprint # Code so automated tests will run properly # Check for environment variable, if that fails, use getpass(). password = os.getenv("NETMIKO_PASSWORD") if os.getenv("NETMIKO_PASSWORD") else getpass() my_device = { "dev...
646
212
#!/usr/bin/env python3 # # Tests if the HES1 Michaelis-Menten toy model runs. # # This file is part of PINTS (https://github.com/pints-team/pints/) which is # released under the BSD 3-clause license. See accompanying LICENSE.md for # copyright notice and full license details. # import unittest import numpy as np impor...
2,793
1,025
from . base import Actions, get_users def get_followers(username, password, victim_username, proxies=None): return get_users(username, password, victim_username, proxies=proxies, relation=Actions.followers) def get_followings(username, password, victim_username, proxies=None): return get_users(username, pas...
390
118
import requests import os from user_data import UserData import json class DataManager: """This class is responsible for talking to the Google Sheet.""" def __init__(self) -> None: self.SHEETY_URL = f"https://api.sheety.co/{os.environ['SHEETY_SHEET_ID']}/pythonFlightDeals" self.sheet_data = {...
1,636
526
from webargs.flaskparser import use_args from itertools import filterfalse from crime_data.common import cdemodels, marshmallow_schemas, models, newmodels from crime_data.common.base import CdeResource, tuning_page, ExplorerOffenseMapping from crime_data.extensions import DEFAULT_MAX_AGE from flask.ext.cachecontrol imp...
4,232
1,401
import copy from deploy_config_generator.utils import yaml_dump from deploy_config_generator.output import kube_common class OutputPlugin(kube_common.OutputPlugin): NAME = 'kube_kong_consumer' DESCR = 'Kubernetes KongConsumer output plugin' FILE_EXT = '.yaml' DEFAULT_CONFIG = { 'fields': { ...
1,522
427
import numpy as np class MeanShift: def __init__(self, radius=2): self.radius = radius def fit(self, data): centroids = self.initialize_starting_centroids(data) self.centroids = self.make_centroids(centroids, data) def initialize_starting_centroids(self, data): centroids ...
2,450
777
"""AWS Athena query client. Overrides the `get_df` convenience methods for loading a DataFrame using PandasCursor, which is more performant than using sql alchemy functions. """ import pandas as pd from pyathena.pandas_cursor import PandasCursor from . import decorators, sqla_client __all__ = ["AthenaClient"] cl...
931
284
import pytest from conflow.merge import merge_factory from conflow.node import Node, NodeList, NodeMap def test_merge_node_node(default_config): base = Node('base', 'node_A') other = Node('other', 'node_B') assert merge_factory(base, other, default_config) == other def test_merge_node_nodelist(default_...
3,592
1,152
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2020 dlilien <dlilien@hozideh> # # Distributed under terms of the MIT license. """ """ import numpy as np import cartopy.crs as ccrs import matplotlib.pyplot as plt from .cartopy_overrides import SPS # import shapely.geometry as sgeom U...
864
411
from django.test import TestCase from robber import expect from toast.serializers import ToastDesktopSerializer, ToastMobileSerializer from toast.factories import ToastFactory class ToastDesktopSerializerTestCase(TestCase): def test_serialization(self): toast = ToastFactory( name='CR', ...
1,010
296
""" KPI ADV ======= Script to execute an inventory and otap benchmark for the advertiser feature. .. Copyright: Copyright 2019 Wirepas Ltd under Apache License, Version 2.0. See file LICENSE for full license details. """ import queue import random import datetime import importlib ...
12,063
3,447
import doctest def leven_distance(iterable1: str or list, iterable2: str or list) -> int: """Takes two strings or lists and will find the Levenshtein distance between the two. Both iterables must be same type (str or list) for proper functionality. If given strings, function will find distance per c...
1,608
547
from .utils import * class Filter(object):####TODO add logging def __init__(self, measure, cutting_rule): """ Basic univariate filter class with chosen(even custom) measure and cutting rule :param measure: Examples -------- >>> f=Filter("PearsonCorr", GLOB_CR[...
18,496
6,005
from PyQuantum.TC3.Cavity import Cavity from PyQuantum.TC3.Hamiltonian3 import Hamiltonian3 capacity = { '0_1': 2, '1_2': 2, } wc = { '0_1': 0.2, '1_2': 0.3, } wa = [0.2] * 3 g = { '0_1': 1, '1_2': 200, } cv = Cavity(wc=wc, wa=wa, g=g, n_atoms=3, n_levels=3) # cv.wc_info() # cv.wa_info() #...
457
246
# https://stackoverflow.com/questions/31921313/matplotlib-animation-moving-square import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib import animation x = [0, 1, 2] y = [0, 10, 20] y2 = [40, 30, 20] colors = ['r','b','g','orange'] fig = plt.figure() plt.axis('equal') plt.grid() ax = f...
1,058
428
import sys import warnings if not sys.warnoptions: warnings.simplefilter("ignore") import numpy as np import pandas as pd import matplotlib.pylab as plt from sklearn.naive_bayes import MultinomialNB from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble import GradientBoostingClassifier from ...
6,145
2,812
# Copyright 2016-present CERN – European Organization for Nuclear Research # # 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...
16,895
4,570
# -*- coding: utf-8 -*- # Copyright 2018 Zhang, Chen. 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 re...
1,268
424
from rest_framework import serializers from .models import Mood class MoodSerializer(serializers.ModelSerializer): class Meta: model = Mood fields = ['profile', 'characteristic', 'latitude', 'longitude', 'image', 'location'] read_only_fields = ['latitude', 'longitude']
303
85
import json import requests import unittest import Utilities # Precondiciones: # Intereses: # No debe haber ningun usuario en el Shared que tenga "interesUnico" # Address = "http://localhost:8000" #Tal vez mandar las URIs a sus respectivas clases URIResgistro = "/registro" URILogin = "/login" URIPedirCandidato = ...
7,604
2,777
import datetime import cStringIO import psycopg2 from shapely.wkb import loads import numpy as np import sys from geopandas import read_postgis import matplotlib matplotlib.use("agg") from pyiem.plot import MapPlot import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.collections impor...
3,639
1,651
from datetime import datetime, timedelta class IterDates(object): def __init__(self, start: datetime, stop: datetime, step: timedelta): self.start = start self.stop = stop self.step = step self.value = (self.start, self.start + self.step) def __iter__(self): return se...
1,053
320
cont = 1 while True: t = int(input('Quer saber a tabuada de que numero ? ')) if t < 0: break for c in range (1, 11): print(f'{t} X {c} = {t * c}') print('Obrigado!')
193
84
import random as rd def genPass(num , length): print ("Password Generator") print ("===================\n") numpass=num lenpass=length AlphaLcase=[ chr(m) for m in range(65, 91)] AlphaCcase=[ chr(n) for n in range(97, 123)] Intset=[ chr(p) for p in range(48,58)] listsetpass=[] for j...
1,172
390
from datetime import date, datetime, timedelta from matplotlib import pyplot as plt, dates as mdates from matplotlib.ticker import MaxNLocator from helpers import programmes_helper filename = 'offers.png' class OffersService: def __init__(self, db_conn): self.db_conn = db_conn async def generate_gra...
5,413
1,747
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2020, Andrew Klychkov (@Andersson007) <aaklychkov@mail.ru> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = r'''...
11,397
3,301
""" Copyright (C) king.com Ltd 2019 https://github.com/king/s3vdc License: MIT, https://raw.github.com/king/s3vdc/LICENSE.md """ import tensorflow as tf def _session_config() -> tf.ConfigProto: """Constructs a session config specifying gpu memory usage. Returns: tf.ConfigProto -- session config. ...
1,586
528
from pycontacts import AddressBook from pycontacts.models import Person from pycontacts.managers import ( EmailAddressManager, GroupManager, PhoneNumberManager, PersonManager, StreetAddressManager, ) def test_create_book(): book = AddressBook() assert book._store is not None assert isi...
974
278
#!/usr/bin/env python # pylint: disable=no-value-for-parameter,too-many-nested-blocks import contextlib import datetime import functools import re from abc import abstractmethod import sqlalchemy as sa from sqlalchemy import event, exc, func, select from sqlalchemy.ext import declarative from sqlalchemy.ext import hy...
46,266
13,963
#!/usr/bin/env python3 seq = 'ACGACGCAGGAGGAGAGTTTCAGAGATCACGAATACATCCATATTACCCAGAGAGAG' w = 11 for i in range(len(seq) - w + 1): count = 0 for j in range(i, i + w): if seq[j] == 'G' or seq[j] == 'C': count += 1 print(f'{i} {seq[i:i+w]} {(count / w) : .4f}')
267
146
import unittest import os.path import requests_mock import tableauserverclient as TSC TEST_ASSET_DIR = os.path.join(os.path.dirname(__file__), 'assets') SIGN_IN_XML = os.path.join(TEST_ASSET_DIR, 'auth_sign_in.xml') SIGN_IN_IMPERSONATE_XML = os.path.join(TEST_ASSET_DIR, 'auth_sign_in_impersonate.xml') SIGN_IN_ERROR_X...
6,159
2,368
import gym from gym import spaces, error, utils from gym.utils import seeding import numpy as np import configparser from os import path import matplotlib.pyplot as plt from matplotlib.pyplot import gca font = {'family': 'sans-serif', 'weight': 'bold', 'size': 14} class FlockingEnv(gym.Env): def...
7,991
2,731
import scrapy import re from urllib.parse import urljoin, urlencode, parse_qs from dataPipelines.gc_scrapy.gc_scrapy.items import DocItem from dataPipelines.gc_scrapy.gc_scrapy.GCSpider import GCSpider type_and_num_regex = re.compile(r"([a-zA-Z].*) (\d.*)") class ArmyReserveSpider(GCSpider): name = "Army_Reserve...
3,010
912
import logging import mimetypes import os from twisted.internet import defer from lbrynet.core import file_utils from lbrynet.file_manager.EncryptedFileCreator import create_lbry_file log = logging.getLogger(__name__) class Publisher(object): def __init__(self, session, lbry_file_manager, wallet, certificate_i...
4,036
1,176
import sys,os from torch.autograd import Variable import torch.optim as optim from tensorboardX import SummaryWriter import torch import time import shutil from torch.utils.data import DataLoader import csv from samp_net import EMDLoss, AttributeLoss, SAMPNet from config import Config from cadb_dataset import CADBData...
10,498
3,499
import keras import keras.backend as K class Combine(keras.layers.Layer): """Combine layer This layer recombines the output of its internal layers #Arguments layers: A list of Keras layers output_spec: A list of integer lists, indices from each layer in 'layers' that make up each outp...
3,282
957
import pygame from pygame.mixer import music from pystage.core.assets import SoundManager from pystage.core._base_sprite import BaseSprite import time class _Sound(BaseSprite): # Like for costumes and backdrops, we need a class structure here. # Plus a global sound manager. def __init__(self): su...
4,308
1,425
from django.test import TestCase from django.test.runner import DiscoverRunner class DiscoverRunnerTest(TestCase): def test_dotted_test_module(self): count = DiscoverRunner().build_suite( ["test_discovery_sample.tests_sample"], ).countTestCases() self.assertEqual(count, 3) ...
2,126
671
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Basic permissions module.""" from sqlalchemy import or_ class SystemWideRoles(object): """List of system wide roles.""" # pylint: disable=too-few-public-methods SUPERUSER = u"Superuser" ADMINI...
1,265
433
#!/usr/bin/env python # -*- coding: utf-8 -*- # # import from future to make Python2 behave like Python3 from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from future import standard_library standard_library.install_alias...
2,075
807
from django.contrib import admin from rango.models import Category, Page admin.site.register(Page) admin.site.register(Category) class CategoryAdmin(admin.ModelAdmin): prepopulated_fields = {'slug':('name',)} class PageAdmin(admin.ModelAdmin): list_display = ('title', 'cate...
335
105
#!/usr/bin/env python from os.path import join, dirname from cloudify import ctx ctx.download_resource( join('components', 'utils.py'), join(dirname(__file__), 'utils.py')) import utils # NOQA # Most images already ship with the following packages: # # python-setuptools # python-backports # python-b...
1,334
376
from .models import ReservedName def gen_master(apps, scheme_editor): reserved_names = ['co', 'com', 'example', 'go', 'gov', 'icann', 'ne', 'net', 'nic', 'or', 'org', 'whois', 'www'] for reserved_name in reserved_names: ReservedName(name=reserved_name).save()
278
96
# Copyright (c) 2021, CRS4 # # 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, distribu...
5,180
1,719
from numpy.random import random import random root = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="...
9,121
4,806
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def add_webhook_notification_template_fields(apps, schema_editor): # loop over all existing webhook notification templates and make # sure they have the new "http_method" field filled in with "POST" Notificat...
803
237
from typing import Tuple, Union from aiohttp import web from ogc_edr_lib.ogc_api import OgcApi import logging from ogc_edr_lib.ogc_api_collection_metadata_get_queries import ( OgcApiCollectionMetadataGetQueries) from ogc_edr_lib.ogc_api_collection_metadata_list_data_items import ( OgcApiCollectionMetadataListD...
7,964
2,211
from .normalization import *
28
7
#!/usr/bin/env python import os import sys import subprocess from django.core.management import execute_from_command_line FLAKE8_ARGS = ['django_restql', 'tests', 'setup.py', 'runtests.py'] WARNING_COLOR = '\033[93m' END_COLOR = '\033[0m' def flake8_main(args): print('Running flake8 code linting') ret = su...
800
314
# Copyright (c) 2016 Civic Knowledge. This file is licensed under the terms of the # Revised BSD License, included in this distribution as LICENSE """ Parser for the Simple Data Package format. The parser consists of several iterable generator objects. """ NO_TERM = '<no_term>' # No parent term -- no '.' -- in ter...
17,549
5,045
# -*- coding: utf-8 -*- # Copyright (c) 2016 Mirantis 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 ...
1,462
478
# take a bunch of model_0 model_1 etc files and merge them alphabetically from settings import * # for each file, load the file into one giant list # call sort on the list # write this output somewhere else for timestep in range(START_IDX,NUM_TIMES): model = dict() #Add the full vocabulary to the dictionary ...
1,135
394
# Copyright (c) 2021, SIDN Labs # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the fol...
5,428
1,698