text
string
size
int64
token_count
int64
def main(request, response): headers = [("Content-type", "text/html;charset=shift-jis")] # Shift-JIS bytes for katakana TE SU TO ('test') content = chr(0x83) + chr(0x65) + chr(0x83) + chr(0x58) + chr(0x83) + chr(0x67); return headers, content
261
111
import re from setuptools import setup, find_packages import sys if sys.version_info < (3, 5): raise 'must use Python version 3.5 or higher' with open('./gmailapi_backend/__init__.py', 'r') as f: MATCH_EXPR = "__version__[^'\"]+(['\"])([^'\"]+)" VERSION = re.search(MATCH_EXPR, f.read()).group(2).strip() ...
1,676
534
"""Script to ensure a configuration file exists.""" import argparse import os import openpeerpower.config as config_util from openpeerpower.core import OpenPeerPower # mypy: allow-untyped-calls, allow-untyped-defs def run(args): """Handle ensure config commandline script.""" parser = argparse.ArgumentParser...
1,351
410
# Vicfred # https://atcoder.jp/contests/abc132/tasks/abc132_a # implementation S = list(input()) if len(set(S)) == 2: if S.count(S[0]) == 2: print("Yes") quit() print("No")
195
85
import pytest import numpy as np import pandas as pd import matplotlib.pyplot as plt import itertools from sklearn.datasets import (make_regression, make_blobs, load_digits, fetch_openml, load_diabetes) from sklearn.preprocessing import KBinsDiscretizer from dabl.preprocessing import cle...
11,146
3,921
################################################################################ # Copyright (c) 2017 Dan Iorga, Tyler Sorenson, Alastair Donaldson # 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...
4,480
1,325
import sys import subprocess as sub import os """ Simple utility script to generate HTML charts of how ANTLR parses every query and what is the resulting AST. """ def run(grammar_name, basedir='', cp='.:/dvt/antlr-142/lib/antlr-3.4-complete.jar:/x/dev/antlr-34/lib/antlr-3.4-complete.jar', grammardi...
6,206
2,054
""" MIT License Copyright (c) 2020 Susant Achary <sache.meet@yahoo.com> 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, ...
6,318
2,288
import paho.client as mqtt HOST = 'localhost' PORT = 1883 class MQTTConnector: def __init__(self, host, port): host = host port = port client = mqtt.Client() def connect(): self.client.connect(self.host, self.port, 60) def run(self): self.client.loop_...
517
185
#!/bin/env python from black import main import spacy import json from spacy import displacy import unidecode import pandas as pd import numpy as np import os csv_source = "scripts/spacy_files/data/thesis_200_with_school.csv" df = pd.read_csv(csv_source) df = df[df['isScan']==False] df = df.sort_values('isScan', asce...
1,886
720
# Copyright 2018 Tensorforce Team. 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 la...
7,212
2,076
"""init module for reveal app""" # pylint: disable=invalid-name default_app_config = "mspray.apps.reveal.apps.RevealConfig" # noqa
132
51
from django.db import models from django import forms from audit_log.models.managers import AuditLog # Create your models here. class Port(models.Model): name = models.CharField(max_length=250) port = models.CharField(max_length=250) description = models.TextField(blank=True) audit_log = AuditLog()...
513
163
# Generated by Django 2.2.5 on 2019-09-25 00:12 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('arm', '0001_initial'), ] operations = [ migrations.DeleteModel( name='CautionMessage', ), migrations.Dele...
386
141
import tensorflow as tf import json import math import cv2 import time import argparse import concurrent.futures import posenet import keyboard import sys import numpy as np from threading import Thread from slugify import slugify parser = argparse.ArgumentParser() parser.add_argument('--model', type=int, default=101)...
7,112
2,278
# 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 # distrib...
6,265
2,051
from ._ffi.base import string_types from ._ffi.object import register_object, Object from ._ffi.node import register_node, NodeBase from ._ffi.node import convert_to_node as _convert_to_node from ._ffi.node_generic import _scalar_type_inference from ._ffi.function import Function from ._ffi.function import _init_api, r...
830
280
import copy import torch from ..attack import Attack class MultiAttack(Attack): r""" MultiAttack is a class to attack a model with various attacks agains same images and labels. Arguments: model (nn.Module): model to attack. attacks (list): list of attacks. Examples:: >>> at...
4,121
1,417
# -*- coding:utf-8 -*- # Copyright (c) 2020 Huawei Technologies Co.,Ltd. # # openGauss is licensed under Mulan PSL v2. # You can use this software according to the terms # and conditions of the Mulan PSL v2. # You may obtain a copy of Mulan PSL v2 at: # # http://license.coscl.org.cn/MulanPSL2 # # THIS SOFTWARE...
2,627
840
import subprocess import sys from . import ROOT, PY_SRC, _run, PY, DIST CONDA_ORDER = [ "core", "html", "lab", "datagrid", "svg", "tpl-jjinja" "yaml" ] CONDA_BUILD_ARGS = [ "conda-build", "-c", "conda-forge", "--output-folder", DIST / "conda-bld", ] if __name__ == "__main__": f...
646
282
import requests, time, re, rsa, json, base64 from urllib import parse s = requests.Session() username = "" password = "" if(username == "" or password == ""): username = input("账号:") password = input("密码:") def main(): login(username, password) rand = str(round(time.time()*1000)) surl = f'https:...
5,279
2,226
import subprocess from .Genome_fasta import get_fasta import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import numpy as np import pysam def run(parser): args = parser.parse_args() bases,chrs = get_fasta(args.genome) l={} for c in chrs: l[c]=len(bases[c]) chrs = se...
3,318
1,314
"""A clean customisable Sphinx documentation theme.""" __version__ = "2020.9.8.beta2" from pathlib import Path from .body import wrap_tables from .code import get_pygments_style_colors from .navigation import get_navigation_tree from .toc import should_hide_toc def _html_page_context(app, pagename, templatename, c...
1,536
511
#!/usr/bin/env python3 # Copyright 2016 Curtis Sand # # 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 la...
2,059
664
from dataclasses import dataclass from hrepr import H from hrepr import hrepr as real_hrepr from hrepr.h import styledir from .common import one_test_per_assert css_hrepr = open(f"{styledir}/hrepr.css", encoding="utf-8").read() hrepr = real_hrepr.variant(fill_resources=False) @dataclass class Point: x: int ...
8,704
3,374
import inspect from sympy.core.cache import cacheit from sympy.core.singleton import S from sympy.core.sympify import _sympify from sympy.logic.boolalg import Boolean from sympy.utilities.source import get_class from contextlib import contextmanager class AssumptionsContext(set): """Set representing assumptions. ...
6,218
1,836
import numpy as np from unittest import TestCase import numpy.testing as npt from distancematrix.util import diag_indices_of from distancematrix.consumer.distance_matrix import DistanceMatrix class TestContextualMatrixProfile(TestCase): def setUp(self): self.dist_matrix = np.array([ [8.67, 1...
5,794
2,725
"""Constants file for Supervisor.""" from enum import Enum from ipaddress import ip_network from pathlib import Path SUPERVISOR_VERSION = "DEV" URL_HASSIO_ADDONS = "https://github.com/home-assistant/addons" URL_HASSIO_APPARMOR = "https://version.home-assistant.io/apparmor.txt" URL_HASSIO_VERSION = "https://version.ho...
11,460
5,164
import inspect from math import hypot, sin, asin, cos, radians, degrees from abc import ABCMeta, abstractmethod from random import randint, choice from typing import Dict, List, Tuple, Union class Agent(metaclass=ABCMeta): """ Class to represent an agent in an agent-based model. """ _id = 0 colo...
8,334
2,388
import torch import torch.nn as nn import os import torch.nn.functional as F class LDS(nn.Module): def __init__(self,): super(LDS, self).__init__() self.pool1 = nn.MaxPool2d(kernel_size=(2, 2), stride=2, padding=0) self.pool2 = nn.MaxPool2d(kernel_size=(2, 2), stride=2, padding=0) ...
15,337
5,812
#!/usr/bin/env python from wand.image import Image from wand.drawing import Drawing from wand.color import Color import wandplus.image as wpi from wandplus.textutil import calcSuitableFontsize, calcSuitableImagesize import os import unittest tmpdir = '_tmp/' def save(img, function, channel=False, ext='.png'): ...
25,418
9,120
import mitsuba import pytest import enoki as ek from enoki.dynamic import Float32 as Float from mitsuba.python.test.util import fresolver_append_path from mitsuba.python.util import traverse def test01_create_mesh(variant_scalar_rgb): from mitsuba.core import Struct, float_dtype from mitsuba.render import Me...
7,652
3,192
from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str, super, zip) from ...._utils import send_session_request from ..._PortalEndpointBase import Por...
1,457
418
# Generated by Django 2.1.7 on 2019-08-09 09:36 from django.db import migrations, models def migrate_public_event(apps, schema_editor): """Migrate options previously with no contents (displayed as "Other:") to a new contents ("other"). The field containing these options is in CommonRequest abstract model...
3,995
1,069
import torch import torch.nn as nn class Discriminator(nn.Module): def __init__(self, input_nc, ndf=64, norm_layer=nn.BatchNorm2d, use_sigmoid=False) : super(Discriminator, self).__init__() self.conv1 = nn.Sequential( nn.Conv2d(input_nc, ndf, kernel_size=4, stride=2, padding=1), nn.LeakyReLU(0.2,...
1,278
591
from unittest import TestCase import numpy as np from robustnessgym.cachedops.spacy import Spacy from robustnessgym.slicebuilders.subpopulations.length import LengthSubpopulation from tests.testbeds import MockTestBedv0 class TestLengthSubpopulation(TestCase): def setUp(self): self.testbed = MockTestBed...
1,067
353
import json from astroquery.vizier import Vizier with open("Jankowski_2018_raw.txt", "r") as raw_file: lines = raw_file.readlines() print(lines) pulsar_dict = {} for row in lines[3:]: row = row.split("|") print(row) pulsar = row[0].strip().replace("−", "-") freqs = [] fluxs = [] flux_e...
1,146
455
# Copyright (c) 2018, WSO2 Inc. (http://wso2.com) 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 ap...
15,018
4,613
# Copyright (c) 2019 Leiden University Medical Center # # 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, me...
2,376
735
from math import sqrt def is_simple(n: int) -> bool: if n % 2 == 0 and n != 2: return False for i in range (3, int(sqrt(n)) + 2, 2): if n % i == 0 and n != i: return False return True def next_prime(n: int) -> int: n += 1 if n <= 2: return 2 else: i...
420
159
#!/usr/bin/env python3 # Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
6,622
1,906
# -*- coding: utf-8 -*- """ Created on Fri May 30 17:15:27 2014 @author: Parke """ from __future__ import division, print_function, absolute_import import numpy as np import matplotlib as mplot import matplotlib.pyplot as plt import mypy.my_numpy as mnp dpi = 100 fullwidth = 10.0 halfwidth = 5.0 # use these with li...
13,843
5,414
from django.shortcuts import render,redirect from django.http import HttpResponse,HttpResponseRedirect from django.views import generic from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from .models import Character,Comic,Power,CharacterPower,CharacterComic f...
13,185
4,596
"""Set-up and execute the main loop""" import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) #Right motor input A GPIO.setup(18,GPIO.OUT) #Right motor input B GPIO.setup(23,GPIO.OUT) GPIO.output(18,GPIO.HIGH) GPIO.output(23,GPIO.LOW)
267
136
import pymysql # 连接配置信息 config = { 'host': '127.0.0.1', 'port': 3306, 'user': 'root', 'password': '', 'db': 'classdata', 'charset': 'utf8', 'cursorclass': pymysql.cursors.DictCursor, } def get_summary_db(unitag): # 创建连接 conn = pymysql.connect(**config) cur = conn.cursor() ...
931
396
from rest_framework import viewsets from rest_framework.views import APIView from registerapp import serializers from registerapp import models class RegisterViewSet(viewsets.ModelViewSet): serializer_class = serializers.RegisterSerializer queryset = models.RegisterPage.objects.all()
290
74
#!/usr/bin/env python # -*- coding: utf-8 -*- """ jduck.py Description: Author: luutp Contact: luubot2207@gmail.com Created on: 2021/02/27 """ # Utilities # %% # ================================IMPORT PACKAGES==================================== # Utilities from traitlets.config.configurable import SingletonConfigur...
1,412
503
# pylint: disable=missing-class-docstring,invalid-name import typing from graphql.language import ( InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, ) from graphql.type import ( GraphQLArgument, GraphQLBoolean, GraphQLEnumType, ...
5,193
1,526
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
2,297
742
from .grandchild_objects import Cookies from .grandchild_objects import Dns from .grandchild_objects import Dom from .grandchild_objects import Geo #from .grandchild_objects import Http #from .grandchild_objects import Meta from .grandchild_objects import Ssl #from .grandchild_objects import WhoIs class Properties(obj...
1,618
473
#!/usr/bin/env python3 """ script for calculating gc skew Chris Brown ctb@berkeley.edu """ # python modules import os import sys import argparse import numpy as np from scipy import signal from itertools import cycle, product # plotting modules from matplotlib import use as mplUse mplUse('Agg') import matplotlib.py...
9,084
3,251
# This sample is provided for demonstration purposes only. # It is not intended for production use. # This example does not constitute trading advice. import os from dotenv import dotenv_values from algosdk import mnemonic, account from algofi.v1.asset import Asset from algofi.v1.client import AlgofiTestnetClient, Algo...
2,429
777
#!/usr/bin/env python import getopt import sys import string import re import time sys.path.insert(1,"..") from SOAPpy import SOAP import traceback DEFAULT_SERVERS_FILE = './inventory.servers' DEFAULT_METHODS = ('SimpleBuy', 'RequestForQuote','Buy','Ping') def usage (error = None): sys.stdout = sys.std...
9,059
2,921
import os import json import shutil with open("entry.tp") as entry: entry = json.loads(entry.read()) startcmd = entry['plugin_start_cmd'].split("%TP_PLUGIN_FOLDER%")[1].split("\\") filedirectory = startcmd[0] fileName = startcmd[1] if os.path.exists(filedirectory): os.remove(os.path.join(os.getcwd(), "Wi...
934
345
for _ in range(int(input())): x, y = list(map(int, input().split())) flag = 1 for i in range(x, y + 1): n = i * i + i + 41 for j in range(2, n): if j * j > n: break if n % j == 0: flag = 0 break if flag == 0: break if flag: print("OK") else: print("Sorry")
292
155
{ 'targets': [ { 'target_name': 'hiredis', 'sources': [ 'src/hiredis.cc' , 'src/reader.cc' ], 'include_dirs': ["<!(node -e \"require('nan')\")"], 'dependencies': [ 'deps/hiredis.gyp:hiredis-c' ], 'defines': [ '_GNU_SOURCE' ], ...
389
151
from pywire import * def invert(signal): if signal: return False else: return True class Inverter: def __init__(self, a, b): b.drive(invert, a) width = 4 a = Signal(width, io="in") b = Signal(width, io="out") Inverter(a, b) build()
272
103
# Minhyuk Sung (mhsung@cs.stanford.edu) # April 2018 import os, sys BASE_DIR = os.path.normpath( os.path.join(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.join(BASE_DIR, '..')) from datasets import * from generate_outputs import * from scipy.optimize import linear_sum_assignment #impor...
4,521
1,835
import os from conans import ConanFile, tools from conans.errors import ConanInvalidConfiguration class CxxOptsConan(ConanFile): name = "cxxopts" homepage = "https://github.com/jarro2783/cxxopts" url = "https://github.com/conan-io/conan-center-index" description = "Lightweight C++ option parser librar...
2,388
732
class CoinArray(list): """ Coin list that is hashable for storage in sets The 8 entries are [1p count, 2p count, 5p count, ... , 200p count] """ def __hash__(self): """ Hash this as a string """ return hash(" ".join([str(i) for i in self])) def main(): """ En...
1,868
637
#!/usr/bin/env python # 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...
2,358
657
from . import utils ################################################# """ INSTRUMENT """ ################################################# def Instrument(symbol): symbol = str(symbol).upper() return { '__symbol' : symbol, 'Sym' : symbol, 'SecTyp' : 'CS', ...
1,853
563
# # Copyright (c) 2022 Airbyte, Inc., all rights reserved. # import pytest pytest_plugins = ("source_acceptance_test.plugin",) @pytest.fixture(scope="session", autouse=True) def connector_setup(): """This fixture is a placeholder for external resources that acceptance test might require.""" # TODO: setup t...
432
124
# -*- coding: utf-8 -*- """ @Time : 2021/10/9 17:51 @Auth : 潇湘 @File :__init__.py.py @IDE :PyCharm @QQ : 810400085 """
118
86
""" Standard Regression model ------------------------- """ import numpy as np import pandas as pd from typing import Union from ..logging import get_logger from .regression_model import RegressionModel from sklearn.linear_model import LinearRegression logger = get_logger(__name__) class LinearRegressionModel(Regre...
1,809
483
from hailtop.utils import (partition, url_basename, url_join, url_scheme, url_and_params, parse_docker_image_reference) def test_partition_zero_empty(): assert list(partition(0, [])) == [] def test_partition_even_small(): assert list(partition(3, range(3))) == [range(0, 1), range(...
4,862
1,910
from django.urls import path,include from . import views urlpatterns = [ path('home/', views.home, name = 'home'), path('add_hood/',views.uploadNeighbourhood, name = 'add_hood'), path('viewhood/',views.viewHood, name = 'viewhood'), path('hood/<int:pk>/',views.hood, name = 'hood'), path('add_bizna/'...
863
319
# -*- coding: utf-8 -*- # # Copyright (c) 2017 nexB Inc. and others. All rights reserved. # http://nexb.com and https://github.com/nexB/scancode-toolkit/ # The ScanCode software is licensed under the Apache License version 2.0. # Data generated with ScanCode require an acknowledgment. # ScanCode is a trademark of nexB ...
8,305
2,820
# ensaio = [[[[1, 999.4951009067408, 999.495100909791, '1001100.11100010011001100001001', '100011.10010111010000111110100', '1', '1'], [2, 999.5052434400473, 999.5052434497359, '0000100.11100010011001100001001', '111011.10010111010000111110000', '1', '2'], [3, 999.51676448592, 999.516764613072, '0000100.111000100110011...
679,794
623,102
"""Ebuild Test Fixtures.""" import os from typing import Any, Dict, List from etest_test import helpers_test EBUILDS: Dict[str, List[Dict[str, Any]]] = {} helpers_test.import_directory(__name__, os.path.dirname(__file__))
225
83
import random from pymongo import MongoClient from observable import Observable from phrase import Phrase class MongoDbProxy: """Proxy for MongoDB""" def __init__(self, url, dbName, tableName): self.client = MongoClient(url) self.db = self.client[dbName] self.table = tableName ...
3,764
1,141
#!flask/bin/python #from user import User from sampleObjects.User import User from datetime import datetime from sampleObjects.DetectionPoint import DetectionPoint import time, requests, random, atexit def requestGenerator(): userObject = randomUser() detectionPointObject = randomDetectionPoint() req = r...
1,381
484
import asyncio import json import datetime from aiohttp import ClientSession from channels.generic.http import AsyncHttpConsumer from .constants import BLOGS class NewsCollectorAsyncConsumer(AsyncHttpConsumer): """ Async HTTP consumer that fetches URLs. """ async def handle(self, body): # Ad...
1,873
513
import os from pathlib import Path def write(file_name, content): Path(os.path.dirname(file_name)).mkdir(parents=True, exist_ok=True) with open(file_name, 'w') as file: file.write(content) def read_line_looping(file_name, count): i = 0 lines = [] file = open(file_name, 'r') line = fi...
737
244
from stringtoiso.convert_to_iso import convert
46
13
from aux_sys_err_prediction_module.additive.R_runmed_spline.my_R_runmed_spline_fit import R_runmed_smooth_spline from numpy import random, array, median, zeros, arange, hstack from win32com.client import Dispatch import math myName = 'R_runmed_spline' useMAD = True # use median absolute deviations instead of ...
5,495
2,119
#!/usr/bin/env python # Copyright (c) 2016-present, Gregory Szorc # All rights reserved. # # This software may be modified and distributed under the terms # of the BSD license. See the LICENSE file for details. import os import sys from setuptools import setup try: import cffi except ImportError: cffi = None ...
2,721
901
import math num = float(input('Digite um numero real qualquer: ')) print('O numero: {} tem a parte inteira {}'.format(num, math.trunc(num)))
140
45
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from .active_rotating_filter import active_rotating_filter from .active_rotating_filter import ActiveRotatingFilter from .rotation_invariant_encoding import rotation_invariant_encoding from .rotation_invariant_encoding import RotationI...
551
150
from sympy.core.cache import cacheit def test_cacheit_doc(): @cacheit def testfn(): "test docstring" pass assert testfn.__doc__ == "test docstring" assert testfn.__name__ == "testfn"
218
72
import torch class RankSort(torch.autograd.Function): @staticmethod def forward(ctx, logits, targets, delta_RS=0.50, eps=1e-10): classification_grads=torch.zeros(logits.shape).cuda() #Filter fg logits fg_labels = (targets > 0.) fg_logits = logits[fg_labels] fg_targets = targets[fg_labels] fg_num = l...
8,694
3,621
# Copyright (c) 2017-2018 Martin Olejar # # SPDX-License-Identifier: BSD-3-Clause # The BSD-3-Clause license for this file can be found in the LICENSE file included with this distribution # or at https://spdx.org/licenses/BSD-3-Clause.html#licenseText import os import pytest from imx import img # Used Directories DAT...
997
393
#!/usr/bin/env python # -*- coding: utf-8 -*- # Return recent items from a json feed. Recent means "In the last X days." import os import doctest import json import urllib2 import argparse import types import gzip from datetime import datetime, timedelta from time import mktime class RecentJson: """ Methods for in...
9,387
2,933
#! /usr/bin/python # Multistage table builder # (c) Peter Kankowski, 2008 ############################################################################## # This script was submitted to the PCRE project by Peter Kankowski as part of # the upgrading of Unicode property support. The new code speeds up property # matching...
34,521
11,861
from setuptools import setup, find_packages from retrobiocat_web import __version__ with open('requirements.txt') as f: requirements = f.read().splitlines() setup( name = 'retrobiocat_web', packages = find_packages(), include_package_data=True, version = __version__, license='', description = 'Retrosynt...
638
211
# -*- coding: utf-8 -*- import pickle import numpy as np from rdkit import Chem from rdkit.Chem import AllChem,DataStructs def get_classes(path): f = open(path, 'rb') dict_ = pickle.load(f) f.close() classes = sorted(dict_.items(), key=lambda d: d[1],reverse=True) classes = [(x,y) fo...
1,748
668
import functools import logging import random from flask import Flask, render_template, request import joblib from lxml.html import html5parser import lxml.html import requests import yarl import webstruct.model import webstruct.sequence_encoding import webstruct.webannotator webstruct_demo = Flask(__name__, instan...
6,434
2,025
__author__ = 'Alex Rogozhnikov' from setuptools import setup setup( name="einops", version='0.3.2', description="A new flavour of deep learning operations", long_description=open('README.md', encoding='utf-8').read(), long_description_content_type='text/markdown', url='https://github.com/arogo...
757
228
# Generated by Django 3.1.6 on 2021-02-15 19:01 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('website', '0083_remove_aisubmission_code'), ] operations = [ migrations.AddField( model_name='e...
1,146
355
"""Core experiments for the dependency label prediction task.""" import collections import copy import logging from typing import (Any, Dict, Iterator, Optional, Sequence, Set, Tuple, Type, Union) from ldp import datasets, learning from ldp.models import probes, projections from ldp.parse import pt...
14,667
4,019
#!/usr/bin/env python3 # # Author: # Tamas Jos (@skelsec) # import os import io import datetime import glob import hashlib from pycquery_krb.protocol.asn1_structs import Ticket, EncryptedData, \ krb5_pvno, KrbCredInfo, EncryptionKey, KRBCRED, TicketFlags, EncKrbCredPart from pycquery_krb.common.utils import dt_to_k...
23,613
9,783
#!/opt/az/psf/python/2.7/bin/python from openeye.oechem import * import cgi #creates a list of smiles of the syntax [smiles|molId,smiles|molId] def process_smiles(smiles): smiles = smiles.split('\n') mol = OEGraphMol() smiles_list=[] for line in smiles: if len(line.rstrip())>0: lin...
3,054
1,082
# This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.2 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info < (2, 7, 0): raise Runtime...
37,988
12,307
import os import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PWA_SERVICE_WORKER_PATH = os.path.join( BASE_DIR, 'routes/static/routes/js', 'serv...
6,861
2,560
""" Plotter Lighting Systems ~~~~~~~~~~~~~~~~~~~~~~~~ The :class:`pyvista.Plotter` class comes with three options for the default lighting system: * a light kit consisting of a headlight and four camera lights, * an illumination system containing three lights arranged around the camera, * no lighting. With mes...
2,647
738
from swimport.all import * src = FileSource('src.h') swim = Swim('example') swim(pools.c_string) swim(pools.numpy_arrays(r"../resources", allow_char_arrays=True)) swim(pools.include(src)) assert swim(Function.Behaviour()(src)) > 0 swim.write('example.i') print('ok!')
272
113
import numpy as np import PIL.Image import pythreejs import ipyvolume as ipv from .datasets import UrlCached def _randomSO3(): """return random rotatation matrix, algo by James Arvo""" u1 = np.random.random() u2 = np.random.random() u3 = np.random.random() R = np.array([[np.cos(2*np.pi*u1), np.si...
4,523
1,973
''' * @author Waldinsamkeit * @email Zenglz_pro@163.com * @create date 2020-09-25 14:33:38 * @desc ''' import torch '''--------------------- Weighted Binary cross Entropy ----------------------''' ''' In Torch BCELoss, weight is set to every element of input instead of to every class ''' def weighted_binary_cr...
1,157
422
from typing import * import attr from dlms_cosem.hdlc import validators @attr.s(auto_attribs=True) class HdlcAddress: """ A client address shall always be expressed on one byte. To enable addressing more than one logical device within a single physical device and to support the multi-drop configurat...
7,055
2,071
from __future__ import division, absolute_import, print_function import warnings import numpy as np try: import scipy.stats as stats except ImportError: pass from .common import Benchmark class Anderson_KSamp(Benchmark): def setup(self, *args): self.rand = [np.random.normal(loc=i, size=1000) fo...
3,676
1,312