text
string
size
int64
token_count
int64
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
7,239
2,707
from bot.api.api_client import ApiClient from bot.api.base_route import BaseRoute import typing as t from bot.models import Tag class TagRoute(BaseRoute): def __init__(self, api_client: ApiClient): super().__init__(api_client) async def create_tag(self, name: str, content: str, guild_id: int, user_...
3,396
1,059
# -*- coding: utf-8 -*- """ Created on Mon Sep 7 10:59:00 2020 @author: user """ import numpy as np import multiprocessing as mp import matplotlib.pyplot as plt import time import itertools import ctypes def formfactor(args): # with AL_dist_flat_glo.get_lock: AL_dist_flat_glo_r = np.frombuffer(AL_dist_flat_...
2,967
1,419
# coding: utf-8 import io import cairo # pycairo import cairocffi from pycairo_to_cairocffi import _UNSAFE_pycairo_context_to_cairocffi from cairocffi_to_pycairo import _UNSAFE_cairocffi_context_to_pycairo import pango_example def test(): cairocffi_context = cairocffi.Context(cairocffi.PDFSurface(N...
1,039
460
import random goat1 = random.randint(1, 3) goat2 = random.randint(1, 3) while goat1 == goat2: goat2 = random.randint(1, 3) success = 0 tries = 1_000_000 for _ in range(tries): options = [1, 2, 3] choice = random.randint(1, 3) options.remove(choice) if choice == goat1: options.remove(goat...
487
201
#!/usr/bin/env python3 import random N = 32 M = 64 # NOTE: 0 is a reserved value randu = lambda x: random.randint(1, 2**x-1) randU32 = lambda: randu(32) randU64 = lambda: randu(64) fmt_by_dtype = { 'u32hex': '0x{:08x}', 'u64hex': '0x{:016x}', } cpp_by_dtype = { 'u32hex': 'uint32_t', 'u64hex': 'ui...
1,909
829
"""Toy environment launcher. See the docs for more details about this environment. """ import sys import logging import numpy as np from deer.default_parser import process_args from deer.agent import NeuralAgent from deer.learning_algos.q_net_keras import MyQNetwork from Toy_env import MyEnv as Toy_env import deer.e...
6,143
1,865
# ------------------------------------------------------------------ # # RDF and CN related analysis # # ------------------------------------------------------------------ import sys py_path = '../../../../postprocessing/' sys.path.insert(0, py_path) py_path = '../../../../postprocessing/io_operations/' sys.path.inse...
626
225
from ..doctools import document from .geom import geom from .geom_path import geom_path from .geom_point import geom_point from .geom_linerange import geom_linerange @document class geom_pointrange(geom): """ Vertical interval represented by a line with a point {usage} Parameters ---------- ...
1,675
526
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'ar' import json import os import skimage.io as skio import matplotlib.pyplot as plt import numpy as np import keras from keras.models import Model from keras.layers import Input, Convolution2D, MaxPooling2D, Flatten, Dense from keras.utils.visualize_util import ...
3,704
1,332
""" Test the integrations related to the internal interface implementation and the 'Interface' interface itself """ import pytest from cppython_core.schema import InterfaceConfiguration from pytest_cppython.plugin import InterfaceIntegrationTests from cppython.console import ConsoleInterface class TestCLIInterface(...
760
171
class Solution: def allPossibleFBT(self, N): def constr(N): if N == 1: yield TreeNode(0) for i in range(1, N, 2): for l in constr(i): for r in constr(N - i - 1): m = TreeNode(0) m.left = l ...
407
120
#@contact Sejoon Oh (soh337@gatech.edu), Georgia Institute of Technology #@version 1.0 #@date 2021-08-17 #Influence-guided Data Augmentation for Neural Tensor Completion (DAIN) #This software is free of charge under research purposes. #For commercial purposes, please contact the main author. import torch f...
11,218
3,714
# Copyright © 2019 Province of British Columbia # # 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 agr...
12,719
4,586
from datetime import datetime, timedelta import jwt from flask import current_app from app import db from app.user.repository import UserRepository class AuthService: def __init__(self) -> None: self._user_repository = UserRepository(db.session) def create_token(self, data) -> dict: user = ...
1,933
554
import _init_paths import argparse import random import time import utils import os from collections import defaultdict import numpy as np import csv from progress.bar import IncrementalBar from utils.hash import * def parse_arguments(): parser = argparse.ArgumentParser() # add arguments parser.add_argume...
4,843
1,500
import math from pprint import pprint import matplotlib.pyplot as plt from scipy.optimize import minimize from frispy import Disc from frispy import Discs from frispy import Model model = Discs.roc mph_to_mps = 0.44704 v = 56 * mph_to_mps rot = -v / model.diameter ceiling = 4 # 4 meter ceiling tunnel_width = 4 # 4 ...
1,634
729
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distribu...
1,450
539
import os from Bio import AlignIO, Phylo from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor class Phylogenetic: def __init__(self, PATH): self.PATH=PATH def binary_sequence_generator(self, input_kmer_pattern, label): string_inp="".join([ 'A' if x==0 else 'C'...
1,230
396
#!/usr/bin/env python # #The MIT License (MIT) # # Copyright (c) 2015 Bit9 + Carbon Black # # 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 t...
8,854
2,481
# -*- coding: utf-8 -*- """Exceptions raised by the h application.""" from __future__ import unicode_literals from h.i18n import TranslationString as _ # N.B. This class **only** covers exceptions thrown by API code provided by # the h package. memex code has its own base APIError class. class APIError(Exception):...
1,225
356
#!/usr/bin/env python # Copyright (c) 2018 Orange and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 """ Shaker_...
5,535
1,762
import torch import functools if torch.__version__.startswith('0'): from .sync_bn.inplace_abn.bn import InPlaceABNSync BatchNorm2d = functools.partial(InPlaceABNSync, activation='none') BatchNorm2d_class = InPlaceABNSync relu_inplace = False else: # BatchNorm2d_class = BatchNorm2d = torch.nn.SyncBa...
410
161
from django.db import models from ordered_model.models import OrderedModel, OrderedModelBase class Item(OrderedModel): name = models.CharField(max_length=100) class Question(models.Model): pass class TestUser(models.Model): pass class Answer(OrderedModel): question = models.ForeignKey(Question, ...
2,193
727
import os import sys import numpy as np import pandas as pd def get_columns_percent_dataframe(df: pd.DataFrame, totals_column=None, percent_names=True) -> pd.DataFrame: """ @param totals_column: (default = use sum of columns) @param percent_names: Rename names from 'col' => 'col %' Return a dataframe...
2,288
782
from app.db import db # Ignore it if db can't find the row when updating/deleting # Todo: not ignore it, raise some error, remove checkers in view class BaseService: __abstract__ = True model = None # Create def add_one(self, **kwargs): new_row = self.model(**kwargs) db.session.add(ne...
1,587
488
""" How to set up virtual environment pip install virtualenv pip install virtualenvwrapper # export WORKON_HOME=~/Envs source /usr/local/bin/virtualenvwrapper.sh # To activate virtualenv and set up flask 1. mkvirtualenv my-venv ###2. workon my-venv 3. pip install Flask 4. pip freeze 5. #...
694
205
from SemiBin.main import generate_data_single import os import pytest import logging import pandas as pd def test_generate_data_coassembly(): logger = logging.getLogger('SemiBin') logger.setLevel(logging.INFO) sh = logging.StreamHandler() sh.setFormatter(logging.Formatter('%(asctime)s - %(message)s')) ...
1,346
403
# Copyright 2020 - The Android Open Source Project # # 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 ...
2,676
814
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from cx_Freeze import setup,Executable icondata='icon.ico' base = None # GUI=有効, CUI=無効 にする if sys.platform == 'win32' : base = 'win32GUI' exe = Executable(script = 'main.py', base = base, #icon=icondata ...
452
171
from __future__ import annotations from threading import Lock from typing import List, Set, Optional, Any, Tuple from stereotype.utils import ConfigurationError class Role: __slots__ = ('code', 'name', 'empty_by_default') def __init__(self, name: str, empty_by_default: bool = False): self.name = na...
2,903
895
# coding:utf-8 ''' 矢网的测试项,包括增益,带内波动,VSWR 一个曲线最多建10个marker ''' import os import logging from commoninterface.zvlbase import ZVLBase logger = logging.getLogger('ghost') class HandleZVL(object): def __init__(self, ip, offset): self.zvl = None self.ip = ip self.offset = float(offset) def...
7,175
2,734
from __future__ import division import numpy as np import matplotlib.pyplot as plt import shellmodelutilities as smutil # Set bin width and range bin_width = 0.20 Emax = 14 Nbins = int(np.ceil(Emax/bin_width)) Emax_adjusted = bin_width*Nbins # Trick to get an integer number of bins bins = np.linspace(0,Emax_adjust...
2,410
1,025
import abc import secrets from collections.abc import AsyncIterator, Awaitable, Callable, Mapping from contextlib import AbstractAsyncContextManager, asynccontextmanager from dataclasses import dataclass from datetime import datetime, timezone import pytest from aiohttp import ClientSession from yarl import URL from ...
15,480
4,348
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ sbpy bandpass Module """ __all__ = [ 'bandpass' ] import os from astropy.utils.data import get_pkg_data_filename def bandpass(name): """Retrieve bandpass transmission spectrum from sbpy. Parameters ---------- name : string ...
4,972
1,799
from django.http import HttpResponse from django.shortcuts import render, redirect from community.models import Community # Create your views here. def search_basic(request): communities = None if request.POST: community_query = request.POST.get('community_search', False) communities = Commun...
576
152
# Generated by Django 3.1.2 on 2020-10-18 17:19 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='GameScore', fields=[ ('id', models.AutoFiel...
1,566
452
# OxfordInstruments_ILM200.py class, to perform the communication between the Wrapper and the device # Copyright (c) 2017 QuTech (Delft) # Code is available under the available under the `MIT open-source license <https://opensource.org/licenses/MIT>`__ # # Pieter Eendebak <pieter.eendebak@tno.nl>, 2017 # Takafumi Fujit...
9,772
2,876
import numpy as np import matplotlib.pyplot as plt import pickle """ The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images. The dataset is divided into five training batches and one test batch, each with 10000 image...
4,417
1,704
# This file is Copyright 2019 Volatility Foundation and licensed under the Volatility Software License 1.0 # which is available at https://www.volatilityfoundation.org/license/vsl-v1.0 # """A module containing a collection of plugins that produce data typically found in Mac's lsmod command.""" from volatility3.framewor...
3,054
840
''' instahunter.py Author: Araekiel Copyright: Copyright © 2019, Araekiel License: MIT Version: 1.6.3 ''' import click import requests import json from datetime import datetime @click.group() def cli(): """Made by Araekiel | v1.6.3""" headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Inte...
16,722
5,217
#!/usr/bin/env python # Copyright 2014-2019 The PySCF Developers. 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 # # U...
6,901
3,083
import random import magent from magent.builtin.rule_model import RandomActor import numpy as np def init_food(env, food_handle): tree = np.asarray([[-1,0], [0,0], [0,-1], [0,1], [1,0]]) third = map_size//4 # mapsize includes walls for i in range(1, 4): for j in range(1, 4): base = np...
3,192
1,218
import itertools import logging from datetime import date from django.apps import apps from django.conf import settings from django.db import connection, transaction from django.db.models import Q from dimagi.utils.chunked import chunked from corehq.apps.accounting.models import Subscription from corehq.apps.account...
11,661
3,647
"""Subdivided icosahedral mesh generation""" from __future__ import print_function import numpy as np # following: http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html # hierarchy: # Icosphere -> Triangle -> Point class IcoSphere: """ Usage: IcoSphere(level) Maximum supported level =...
8,056
2,678
# Resolve the problem!! import string import random SYMBOLS = list('!"#$%&\'()*+,-./:;?@[]^_`{|}~') def generate_password(): # Start coding here letters_min = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','x','y','z'] letters_may = ['A','B','C','D','E','F','G','H...
1,840
583
#!/usr/bin/env python # Copyright JS Foundation and other contributors, http://js.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....
8,091
2,990
from math import sqrt import emoji num = int(input("Digite um número: ")) raiz = sqrt(num) print("A raiz do número {0} é {1:.2f}.".format(num, raiz)) print(emoji.emojize("Hello World! :earth_americas:", use_aliases=True))
222
91
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Maritalstatus, obj[8]: Children, obj[9]: Education, obj[10]: Occupation, obj[11]: Income, obj[12]: Bar, obj[13]: Coffeehouse, obj[14]: Restaurant20to50, obj[15]: Direct...
2,001
1,027
macs_response = '''<?xml version="1.0"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer"><s:Header><wsa:To>http://schemas.xmlsoap.org...
8,074
3,464
from __future__ import print_function import argparse import os import time, platform import cv2 import torch import torch.optim as optim from torch.utils.data import DataLoader from datasets import DATASET_NAMES, BipedDataset, TestDataset, dataset_info from losses import * from model import DexiNed # from model0C ...
18,786
5,612
#!/usr/bin/env python3 # coding=utf-8 # # Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
5,905
1,845
from __future__ import absolute_import from django.conf.urls import patterns, url from django_comments.feeds import LatestCommentFeed from custom_comments import views feeds = { 'comments': LatestCommentFeed, } urlpatterns = patterns('', url(r'^post/$', views.custom_submit_comment), url(r'^flag/(\d+)...
657
231
import pandas as pd, numpy as np from sklearn.preprocessing import OneHotEncoder author_int_dict = {'EAP':0,'HPL':1,'MWS':2} def load_train_test_data (num_samples=None): train_data = pd.read_csv('../data/train.csv') train_data['author'] = [author_int_dict[a] for a in train_data['author'].tolist()] ...
669
247
# pylint: skip-file import sys import os # code to automatically download dataset curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) sys.path = [os.path.join(curr_path, "../autoencoder")] + sys.path import mxnet as mx import numpy as np import data from scipy.spatial.distance import cdist from s...
6,987
2,616
from __future__ import division from cctbx.array_family import flex from cctbx import xray from cctbx import crystal from cctbx import maptbx from cctbx.maptbx import minimization from libtbx.test_utils import approx_equal import random from cctbx.development import random_structure from cctbx import sgtbx if (1): r...
7,537
3,009
""" LED matrix """ __all__ = ['Matrix'] from .colors import Color, on, off from .fonts import font_6x8 class Matrix(list): def __init__(self, source=None) -> None: if source is None: row_iter = ([off for _ in range(8)] for _ in range(8)) elif isinstance(source, list): row...
1,212
386
class Classifier(object): """Base class for classifiers."""
64
18
from pytest import raises from datek_app_utils.env_config.base import BaseConfig from datek_app_utils.env_config.errors import InstantiationForbiddenError class SomeOtherMixinWhichDoesntRelateToEnvConfig: color = "red" class TestConfig: def test_iter(self, monkeypatch, key_volume, base_config_class): ...
1,608
512
# -*- coding: utf-8 -*- # Name: comprehend # Version: 0.1a2 # Owner: Ruslan Korniichuk # Maintainer(s): import boto3 def get_sentiment(text, language_code='en'): """Get sentiment. Inspects text and returns an inference of the prevailing sentiment (positive, neutral, mixed, or negative). Args: ...
1,704
506
# -*- coding: utf-8 -*- ################################################################################ ## Form generated from reading UI file 'configuredialog.ui' ## ## Created by: Qt User Interface Compiler version 5.15.2 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ##########...
6,801
2,058
import base64 import tempfile import requests from osbot_aws.apis import Secrets from osbot_aws.apis.Lambdas import Lambdas def upload_png_file(channel_id, file): bot_token = Secrets('slack-gs-bot').value() my_file = { 'file': ('/tmp/myfile.png', open(file, 'rb'), 'png') } p...
1,039
381
from sys import argv from getopt import getopt from os import R_OK, access from string import Template DEFAULT_DATASET_FILE_PATH = "dataset/data.csv" DEFAULT_DATASET_COLUMNS = ['surface (m2)', 'height (m)', 'latitude', 'housing_type', 'longitude', 'country_code', 'city'] DEFAULT_VISU = ["sca...
2,131
645
# Must run example4.py first # Read an Excel sheet and save running config of devices using pandas import pandas as pd from netmiko import ConnectHandler # Read Excel file of .xlsx format data = pd.read_excel(io="Example4-Device-Details.xlsx", sheet_name=0) # Convert data to data frame df = pd.DataFrame(data=data) ...
1,490
449
# Copyright (C) 2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 VERIFIED_OP_REFERENCES = [ 'Abs-1', 'Acos-1', 'Add-1', 'Asin-1', 'Asinh-3', 'Assign-6', 'AvgPool-1', 'BatchNormInference-5', 'BatchToSpace-2', 'BinaryConvolution-1', 'Broadcast-1', 'Broadcast-3'...
2,385
1,117
"""Utilities for interacting with GitHub""" import os import json import webbrowser import stat import sys from git import Repo from .context import Context event_dict = { "added_to_project": ( lambda event: "{} added the issue to a project.".format(event["actor"]["login"]) ), "assigned": ( ...
18,542
5,658
# Generated by Django 3.0.7 on 2020-09-18 05:52 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import multiselectfield.db.fields class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(setting...
9,086
2,602
import pytest import gen from dcos_installer import cli def test_default_arg_parser(): parser = cli.get_argument_parser().parse_args([]) assert parser.verbose is False assert parser.port == 9000 assert parser.action == 'genconf' def test_set_arg_parser(): argument_parser = cli.get_argument_pars...
3,495
1,217
#!/usr/bin/env python3 import sys from random import randint import os try: import networkx as nx except: print("gPrint#-1#" + "netwrokx not installed for " + sys.executable) sys.stdout.flush() try: import igraph as ig except: print("gPrint#-1#" + "igraph not installed for " + ...
47,242
12,226
# -*- coding: utf-8 -*- """Define the base module for server test.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import sys from influxdb.tests import using_pypy from influxdb.tests.server_tests.influxdb_instanc...
2,843
848
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------ # file: $Id$ # auth: Philip J Grabner <grabner@cadit.com> # date: 2013/10/21 # copy: (C) Copyright 2013 Cadit Health Inc., All Rights Reserved. #-----------------------------------------------------------------------...
9,107
2,774
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # This dictionary of GPU information was captured from a run of # Telemetry on a Linux workstation with NVIDIA GPU. It helps test # telemetry.internal.platfo...
13,815
4,812
#! /usr/bin/env python3 # vim: et:ts=4:sw=4:fenc=utf-8 from abc import ABC, abstractmethod from collections import defaultdict import re class RegisterFile(ABC): registers = NotImplemented def __init__(self): # for each register kind an index pointing to the next register to use self.reset_...
10,073
4,646
import os from os import path import json import shutil import tensorflow as tf import numpy as np # Importa cosas de Keras API from tensorflow.keras.optimizers import Adam, RMSprop from tensorflow.keras.models import Sequential from tensorflow.keras.utils import plot_model # Importa callbacks del modelo from traini...
5,410
1,662
#!/usr/bin/env python """Setup script to make PUDL directly installable with pip.""" import os from pathlib import Path from setuptools import find_packages, setup install_requires = [ 'coloredlogs', 'datapackage>=1.9.0', 'dbfread', 'goodtables', 'matplotlib', 'networkx>=2.2', 'numpy', ...
3,563
1,269
from BTrees import OOBTree from datetime import datetime, date, timedelta from persistent import Persistent from .vulnerability import Vulnerability import fcntl import glob import gzip import json import logging import os import os.path as p import requests import transaction import ZODB import ZODB.FileStorage DEFAU...
7,836
2,383
from scapy.all import * src = input("Source IP: ") target = input("Target IP: ") i=1 while True: for srcport in range(1, 65535): ip = IP(src=src, dst=target) tcp = TCP(sport=srcport, dport=80) pkt = ip / tcp send(pkt, inter= .0001) print("Packet Sent ", i) i=i+1
316
125
import hashlib import unittest from colicoords.cell import Cell, CellList from colicoords.preprocess import data_to_cells from test import testcase from test.test_functions import load_testdata class DataTest(testcase.ArrayTestCase): def setUp(self): self.data = load_testdata('ds1') def t...
2,019
777
# --------------------------------------------------------------------------- # # Importing section # --------------------------------------------------------------------------- # import os import sys import argparse import logging import json from classes.alerts import SlackClient from influxdb import InfluxDBClient...
4,354
1,168
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' import re DEBUG = False def merge_str_literal(text: str) -> str: def _on_match(m: re.Match): return m.group().replace('"+"', '') return re.sub(r'".+?"(\+".+?")+ ', _on_match, text) lines = """ function II1I1_II takes real I...
2,791
1,054
from common.commons import * DATA_PATH = os.environ["DATA_PATH"] def core(): clusterPath = join(DATA_PATH, 'shapes') roots = listdir(clusterPath) roots = [i for i in roots if not (i.startswith('.') or i.endswith('.pickle'))] pattern = {} for root in roots: root sizes = listdir(join(...
5,656
1,700
# -*- coding: utf-8 -*- import os import sys import tensorflow as tf import numpy as np import data_utils from translate import Transliteration from flask import Flask, request, jsonify transliteration = Transliteration() app = Flask(__name__) # Flask 객체 선언, 파라미터로 어플리케이션 패키지의 이름을 넣어 준다. app.config['JSON_AS_ASCII'] =...
691
310
from django.apps import AppConfig class Pyano2Config(AppConfig): name = 'pyano2'
87
30
""" Interface to the env_build.xml file. This class inherits from EnvBase """ from CIME.XML.standard_module_setup import * from CIME.XML.env_base import EnvBase logger = logging.getLogger(__name__) class EnvBuild(EnvBase): # pylint: disable=unused-argument def __init__(self, case_root=None, infile="env_buil...
609
195
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2019, Battelle Memorial Institute. # # 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...
6,805
1,935
from rest_framework.serializers import ModelSerializer from .models import Place, Status, OSType, Stock, ComputerStock class PlaceSerializer(ModelSerializer): class Meta: model = Place fields = '__all__' class StatusSerializer(ModelSerializer): class Meta: model = Status fie...
675
184
def add_cswrapper(filename, outfilename=None): from fmpy import read_model_description, extract, sharedLibraryExtension, platform, __version__ from lxml import etree import os from shutil import copyfile, rmtree if outfilename is None: outfilename = filename model_description = read...
2,857
895
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
2,412
750
# -*- coding: UTF-8 -*- import logging from typing import List from echoscope.config import config from echoscope.util import mysql_util, str_util, log_util from echoscope.model import ds_model, config_model from echoscope.source import source class MysqlSource(source.Source): def __init__(self): self.exclude...
7,305
2,650
# last edited: 10/08/2017, 10:25 import os, sys, glob, subprocess from datetime import datetime from PyQt4 import QtGui, QtCore import math #from XChemUtils import mtztools import XChemDB import XChemRefine import XChemUtils import XChemLog import XChemToolTips import csv try: import gemmi import pandas excep...
99,064
31,626
# -*- coding: utf-8 -*- """ Global app forms """ # Standard Library import re # Django Library from django import forms from django.contrib.auth.forms import UserChangeForm, UserCreationForm from django.utils.translation import ugettext_lazy as _ # Thirdparty Library from dal import autocomplete # Localfolder Librar...
5,253
1,410
from unittest import mock import pytest from django.http import HttpRequest from rest_framework.response import Response from rest_framework.test import APIClient from drf_viewset_profiler.middleware import LineProfilerViewSetMiddleware @pytest.fixture def api_client(): return APIClient() @pytest.fixture def ...
1,042
331
# This allows for running the example when the repo has been cloned import sys from os.path import abspath sys.path.extend([abspath(".")]) # Example code follows import logging import numpy as np import matplotlib.pyplot as plt import muDIC.vlab as vlab import muDIC as dic """ This example case runs an experiment whe...
3,553
1,253
mongo = { "user": "", "passwd": "", "db": "ghtorrent" } perspective_api_key = ""
81
33
from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory from tests.unit.dataactvalidator.utils import number_of_errors, query_columns _FILE = 'fabs38_detached_award_financial_assistance_2' def test_column_headers(database): expected_subset = {"row_number", "awarding_office_co...
1,455
497
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 31 22:48:21 2021 @author: apple """ import numpy as np import pandas as pd from HRP import seriation import fastcluster from scipy.cluster.hierarchy import fcluster from gap_statistic import OptimalK from backtest import df_to_matrix #HERC def...
3,203
1,194
import urllib.request from bs4 import BeautifulSoup import csv import requests import os import json import time import glob files = glob.glob("/Users/nakamura/git/d_iiif/iiif/src/collections/nijl/data/json/*.json") for i in range(len(files)): file = files[i] file_id = file.split("/")[-1].replace(".json", "...
3,641
897
from lib import get_itineraries import data if __name__ == '__main__': for itinerary in get_itineraries(data.sicily): print("#" * 24) print(itinerary) print("")
190
67
import numpy as np from sawyer.mujoco.tasks.base import ComposableTask class TransitionTask(ComposableTask): """ Task to pick up an object with the robot gripper. Success condition: - Object is grasped and has been lifted above the table """ def __init__(self): pass def compute_...
5,574
1,844
# coding: utf-8 from types import SimpleNamespace from datetime import datetime, timedelta from unittest.mock import patch from dateutil.relativedelta import relativedelta from jinja2 import Undefined, Markup from mock import Mock from app.jinja_filters import ( format_date, format_conditional_date, format_curre...
36,485
12,297