text string | size int64 | token_count int64 |
|---|---|---|
#!/usr/bin/env python
# coding=utf-8
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkcore.client import AcsClient
# from aliyunsdkcr.request.v20160607 import GetImageLayerRequest
from aliyunsdkcr.request.v20160607 import... | 983 | 387 |
#
# Copyright (C) 2015 Jason Mar
#
# 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 writi... | 1,564 | 509 |
import math
import json
import os
import optparse
def H(data):
entropy = 0
for x in range(256):
p_x = float(data.count(chr(x)))/len(data)
if p_x > 0:
entropy += - p_x*math.log(p_x, 2)
return entropy
def bytes_from_file(filename, chunksize... | 2,212 | 670 |
import time
from abc import ABC, abstractmethod
import pytest
from unittest.mock import Mock
from nextline.registry import PdbCIRegistry
from nextline.utils import Registry
from nextline.state import (
Initialized,
Running,
Exited,
Finished,
Closed,
StateObsoleteError,
StateMethodError
)
... | 11,654 | 3,459 |
n_sum = 0
for n in range(1000): n_sum += n if not n % 3 or not n % 5 else 0
print(n_sum)
| 89 | 46 |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
l_a = self.findLength(headA)
l_b = self.findLength(headB)
while ... | 783 | 242 |
import os
from os import path
import socket # Import socket module
import asyncio
import sys
"""
Notes
==============
socket.gethostname() gets the current machines hostname, for example "DESKTOP-1337PBJ"
string.encode('UTF-8') encodes the given string into a 'bytes' liter... | 12,968 | 3,657 |
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from swagger_client.api.administration_api import AdministrationApi
from swagger_client.api.authentication_api import AuthenticationApi
from swagger_client.api.configuration_api import ConfigurationApi
from swagger_client.api.data_so... | 923 | 260 |
# Generated by Django 1.11.28 on 2020-02-19 16:50
import collections
import jsonfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('site_configuration', '0003_auto_20200217_1058'),
]
operations = [
migrations.AddField(
mo... | 928 | 298 |
""" Python class to represent a layer within an ingest """
class Layer(object):
"""Construct layer to ingest"""
def __init__(self, id, output_uri, sources, cell_size, crs="epsg:3857", pyramid=True, native=False,
cell_type="uint16raw", histogram_buckets=512, tile_size=256,
re... | 2,767 | 761 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redist... | 7,603 | 2,473 |
#!/usr/bin/python
# coding=utf-8
"""
第 0014 题: 纯文本文件 student.txt为学生信息, 里面的内容(包括花括号)如下所示,
请将上述内容写到 student.xls 文件中,如下图所示:
"""
import os
import json
import xlwt
def read_txt(path):
with open(path, 'r') as f:
text = f.read().decode('utf-8')
text_json = json.loads(text)
return text_json
def sav... | 861 | 378 |
import argparse as ap
parser = ap.ArgumentParser(description='delete the blank line and keep sequence length less than 50')
parser.add_argument('--input1', type=str)
parser.add_argument('--input2', type=str)
#parser.add_argument('--output', type=str, default=str + ".less50")
parser.add_argument('--encoding',... | 1,135 | 444 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
## _ _
## | | | |
## __ _| |_ ___| | __ _ _ __ __ _
## ... | 8,247 | 2,387 |
# Generated by Django 3.2.5 on 2021-07-15 15:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='InputType',
fields=[
... | 4,248 | 1,162 |
"""show_PPP.py
IOSXE parsers for the following show commands:
* 'show ppp statistics'
"""
# Python
import re
# Metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Schema, Optional
# import parser utils
from genie.libs.parser.utils.common import Common
class ShowPppSt... | 20,969 | 6,153 |
# -*- coding: utf-8 -*-
import warnings
import pytest
from skimage.data import retina
from skimage.color import rgb2gray
from skimage.transform import rescale
from skimage.filters import sato
@pytest.fixture(scope='session')
def retina_speed_image():
with warnings.catch_warnings():
warnings.simplefilter... | 479 | 166 |
import numpy as np
import pandas as pd
import scipy.special
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
plt.style.use(['../optdynim.mplstyle'])
import palettable
import sys
sys.path.append('../lib')
import optdynlib
import plotting
import misc
df = misc.loadnpz('data/data.npz')
df['tauc']... | 1,046 | 470 |
from django.contrib import messages
from django.contrib.auth import login
from django.contrib.auth.models import User
from django.shortcuts import render, redirect
from django.urls import reverse
from django.views import View
from application.forms import RegistrationForm
from application.views import get_navbar, Page
... | 1,864 | 456 |
import unittest
from meshcat.servers.zmqserver import start_zmq_server_as_subprocess
class TestStartZmqServer(unittest.TestCase):
"""
Test the StartZmqServerAsSubprocess method.
"""
def test_default_args(self):
proc, zmq_url, web_url = start_zmq_server_as_subprocess()
self.assertIn("1... | 554 | 206 |
# Copyright 2019 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 2,558 | 849 |
import graphene
from . import types
from . import models
from graphene.types.generic import GenericScalar
class SlateInput(graphene.InputObjectType):
data = GenericScalar(required=True)
class UpdateSlate(graphene.Mutation):
class Arguments:
slate_id = graphene.Int(required=True)
data = Slate... | 985 | 309 |
from . import commands
if __name__ != "__main__":
raise ImportError("This module should not be imported")
commands.main_command.run()
| 140 | 41 |
from mbed.generation import make_line_mesh
from mbed.meshing import embed_mesh1d
import numpy as np
import sys
coords = np.array([[0, 0], [1, 0], [1, 1], [0, 1.]])
mesh1d = make_line_mesh(coords, close_path=True)
embed_mesh1d(mesh1d,
bounding_shape=0.1,
how='as_lines',
gmsh_arg... | 702 | 256 |
"""Models and enumerators."""
from enum import Enum
from typing import (Optional, List, Tuple)
from pydantic import BaseModel # pylint: disable=no-name-in-module
# pylint: disable=too-few-public-methods
# Sample-specific enumerators and models
class SampleIds(BaseModel):
"""Sample identifiers and aliases.
... | 7,235 | 1,944 |
# Copyright 2017 NeuStar, 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... | 1,394 | 405 |
import math
import torch
def l1(params):
# calc L1 error over all params in the network
l1 = 0
for param in params:
l1 += torch.norm(param, 1)
return l1
def lp_norm(params, p):
# calc Lp error over all params in the network
loss = 0
for param in params:
loss += torch.nor... | 4,267 | 1,607 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 10,298 | 2,998 |
from sklearn_gbm_ots.sklearn_gbm_wrapper import GBMwrapper
| 59 | 22 |
"""
Loads policies by
1. load the list of PUID from "puid_list.csv"
2. load "Policy_<PUID>" class that is defined in ./Policies/<PUID>.py
by Donghun Lee 2018
"""
import csv
from importlib import import_module
def get_pols():
puids = get_puids()
mod_names = ["Policies" + "." + puid for puid in puids]
pol... | 1,015 | 364 |
# reference: https://github.com/open-mmlab/mmclassification/tree/master/mmcls/models/backbones
# modified from mmclassification resnext.py
import random
import torch.nn as nn
from mmcv.cnn import build_conv_layer, build_norm_layer
from ..registry import BACKBONES
from .resnet_mmcls import Bottleneck as _Bottleneck
fro... | 20,378 | 6,672 |
import os
import msgpack
import pytest
import plyvel
from click.testing import CliRunner
from oclc_lookup import get_primary_ocn
from oclc_lookup import get_ocns_cluster_by_primary_ocn
from oclc_lookup import get_ocns_cluster_by_ocn
from oclc_lookup import get_clusters_by_ocns
from oclc_lookup import convert_set_to_l... | 11,998 | 5,138 |
from django.contrib import admin
from optimal_transport_morphometry.core.models import (
FeatureImage,
JacobianImage,
RegisteredImage,
SegmentedImage,
)
class CommonAdmin(admin.ModelAdmin):
list_display = ['id', 'atlas', 'blob', 'source_image']
list_display_links = ['id']
@admin.register(Ja... | 751 | 231 |
from typing import Dict
from django import template
from django.urls import resolve, reverse
from django.urls.exceptions import Resolver404
from django.utils import translation
register = template.Library()
@register.simple_tag(takes_context=True)
def current_path_for_language_code(context: Dict, code: str) -> str:... | 675 | 196 |
import requests
import datetime, pytz
from quickchart import QuickChart
OPEN_WEATHER_MAP_APIKEY = '16786afe8ea0f6b683ab9298e52ac247'
def get_weather_data_by_location( lat, long):
url = f'https://api.openweathermap.org/data/2.5/onecall?lat={lat}&lon={long}&appid={OPEN_WEATHER_MAP_APIKEY}&units=metric'
print(f"Getti... | 2,113 | 1,026 |
#!/usr/bin/env python3
import argparse
import sys
import json
from typing import Dict, List
def run():
parser = argparse.ArgumentParser(description=f'Output digraph data for Cincinnati json',
usage="curl -sH 'Accept:application/json' 'https://api.openshift.com/api/upgrades_in... | 2,269 | 704 |
import imageio
import numpy as np
import scipy.ndimage
start_img = imageio.imread(
"http://static.cricinfo.com/db/PICTURES/CMS/263600/263697.20.jpg"
)
gray_inv_img = 255 - np.dot(start_img[..., :3], [0.299, 0.587, 0.114])
blur_img = scipy.ndimage.filters.gaussian_filter(gray_inv_img, sigma=5)
def dodge(front, b... | 543 | 255 |
print "welcome to the jungle"
| 30 | 12 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Convenience functions for in memory deduplication
"""
import collections
import dedupe.core
def dataSample(data, sample_size):
'''Randomly sample pairs of records from a data dictionary'''
data_list = data.values()
random_pairs = dedupe.core.randomPair... | 935 | 315 |
import os
from PIL import Image, ImageOps
artwork_dir = "./docs/artworks"
artwork_filename = "/artwork.jpg"
thumbnail_filename = "/thumbnail.jpg"
image_width_large = 2000
image_width_medium = 1000
image_width_small = 500
image_width_thumbnail = 300
save_as_jpg = True
save_as_webp = False
def save_image(output_image, ... | 2,459 | 843 |
import argparse
try:
from time import perf_counter
except:
from time import time
perf_counter = time
import dataset
import numpy as np
import datetime
import os
import logging
from src.inference import log_likelihood
from src.xpc import create_xpc, SD_LEVEL_2
from src.cltree import create_cltree
fr... | 11,099 | 3,044 |
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
def array_indices_to_slices(a):
return tuple(slice(0, x, 1) for x in a.shape)
def prune_nans_from_table(table):
nan_in_row = np.zeros(len(table), dtype=bool)
for col in table.colnames:
nan_in_ro... | 376 | 141 |
# Motivation for replacing the default `coco` parser
# See Issue : https://github.com/airctic/icevision/issues/467
import json
import os
import pickle
from collections import defaultdict
from pathlib import Path
from typing import Dict, Hashable, List, Tuple, Union
import numpy as np
from icevision import ClassMap
f... | 8,202 | 2,850 |
# Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYING file.
" Generate source/generated.rst "
def main():
with open("source/generated.rst", "w") as fp:
fp.write("""\
Generated section
==============... | 370 | 133 |
import os
import sys
import unittest
from multiprocessing import Process, Queue
import mock
from xv_leak_tools.log import L
from xv_leak_tools.manual_input import allow_manual_input, disallow_manual_input
from xv_leak_tools.manual_input import message_and_await_string
from xv_leak_tools.manual_input import message_a... | 3,386 | 1,055 |
from setuptools import setup, find_packages
import sys, os
version = '0.3'
setup(name='pytravis',
version=version,
description="Python wrapper for Travis-CI API",
long_description="""\
Python wrapper for Travis-CI API. Set of scripts to get information from travis.""",
classifiers=[], # Get st... | 904 | 290 |
import collection
import user
| 30 | 7 |
#!/usr/bin/python
# import osqp
import sys, os
from klampt import *
from klampt import vis
from klampt.vis.glrobotprogram import GLSimulationPlugin
import numpy as np
import string
import scipy as sp
import scipy.sparse as sparse
from klampt.model.trajectory import Trajectory
import time
import math
sys.path.insert(0... | 7,057 | 2,033 |
#!/usr/bin/python3
import numpy as np
import sys
if len(sys.argv) < 3:
print("Error: Invalid parameters: Path to trace not existed")
print("usage: ./program window [<path_to_trace>]")
exit(0)
# data = np.loadtxt("1M_Req_1_Concurrency.txt")
# data = np.loadtxt("/tmp/ab_stats_7.txt")
ts_data = []
try:
... | 2,524 | 1,146 |
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# Subscribing to an Adafruit IO Group
# and Publishing to the feeds in the group
import time
from random import randint
import board
import busio
from digitalio import DigitalInOut
from adafruit_esp32spi import adafruit_esp3... | 4,090 | 1,472 |
import os
import io
from setuptools import setup, find_packages
HERE = os.path.dirname(os.path.realpath(__file__))
README = os.path.join(HERE, 'README.md')
with io.open(README, encoding='utf-8') as f:
long_description = f.read()
VERSION = os.path.join(HERE, 'ckb_toolkit', 'version.py')
with io.open(VERSION, enco... | 1,082 | 352 |
import logging
import threading
from flask import request, make_response, json, redirect, url_for
from config.configs import configs
from ocbot import app
from ocbot.pipeline.routing import RoutingHandler
from ocbot.pipeline.slash_command_handlers.log_handlers import can_view_logs, get_temporary_url, handle_log_view
... | 4,672 | 1,477 |
# encoding: utf-8
from . import query
class Account:
"""
An account can be associated with a number of web
properties.
You should navigate to a web property to run queries.
Usage:
>>> import searchconsole
>>> account = searchconsole.authenticate(
... client_config='auth/client_s... | 2,936 | 838 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | 145,280 | 41,837 |
from collections import defaultdict
import pytorch_lightning as pl
import torch
from ...containers import Optimizers
from .. import utils as f_utils
def set_adapter_optimizers_to_pl(adapter, pl_optimizers):
if isinstance(adapter.optimizers, Optimizers):
keys = adapter.optimizers.keys()
adapter.o... | 2,546 | 795 |
#!/usr/bin/env python
# Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
import os, sys
from os.path import join as pjoin
import time
import traceback
from . import ... | 5,740 | 2,033 |
import attr
import click
import datetime
import sys
from docker.errors import NotFound
from .base import BasePlugin
from ..cli.colors import CYAN, GREEN, RED, remove_ansi
from ..cli.argument_types import ContainerType, HostType
from ..cli.tasks import Task
from ..constants import PluginHook
from ..docker.build import ... | 13,956 | 3,746 |
# Models for game_list
from django import template
from django.db import models
register = template.Library()
class Game(models.Model):
class Meta:
ordering = ["index"]
index = models.IntegerField(help_text="Bruk helst 10, 20, 30 osv.")
title = models.TextField()
url = models.TextField(
... | 889 | 302 |
# Complete the printLinkedList function below.
#
# For your reference:
#
# SinglyLinkedListNode:
# int data
# SinglyLinkedListNode next
#
#
def printLinkedList(head):
if head == None:
return;
n = head
while(n != None):
print(n.data)
n = n.next | 288 | 98 |
# Section12-2
# 파이썬 데이터베이스 연동(SQLite)
import sqlite3
# DB 파일 조회(없으면 새로 생성)
conn = sqlite3.connect('C:/pythonbasic/resource/database.db') # 본인 db 경로
# 커서 바인딩
c = conn.cursor()
# 데이터 조회(전체)
#c.execute("SELECT * FROM users")
# 커서 위치가 변경
# 1개 로우 선택
#print('One -> \n', c.fetchone())
# 지정 로우 선택
#pr... | 1,877 | 1,025 |
import unittest
import numpy as np
from pyapprox.models.wrappers import DataFunctionModel
class ModelWithCounter(object):
def __init__(self):
self.counter=0
def __call__(self,samples):
self.counter+=samples.shape[1]
return np.sum(samples**2,axis=0)[:,np.newaxis]
class TestDataFunc... | 3,182 | 977 |
import ffmpeg
import os
import logging
import glob
logger = logging.getLogger('segmenter')
class BaseSegmenter:
def __init__(self, in_src, out_dir, channel_id):
if not channel_id or channel_id <= 0:
raise ValueError("channel_id must be a positive integer")
if not in_src or not out_dir... | 4,945 | 1,639 |
# Copyright (c) 2020 - 2021 Open Risk (https://www.openriskmanagement.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 ... | 23,753 | 7,106 |
from injector import inject
from pdip.cqrs import IQueryHandler
from pdip.dependency import IScoped
from pdi.application.dashboard.GetDataOperationJobExecutionWidget.GetDataOperationJobExecutionWidgetMapping import \
GetDataOperationJobExecutionWidgetMapping
from pdi.application.dashboard.GetDataOperationJobExecut... | 1,396 | 320 |
# -------------------------------------------------------------------------------
# Licence:
# Copyright (c) 2012-2020 Luzzi Valerio
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANT... | 1,947 | 682 |
#!/usr/bin/env python2.7
import argparse
import json
import re
import sys
import traceback
import urllib
import urllib2
SUCCESS, WARNING, CRITICAL, UNKNOWN = range(4)
ERRORS = dict((v, k) for k, v in vars(sys.modules[__name__]).items() if type(v) == int)
def lookup_val(host, port, expr, auth=None, proxy='http://loca... | 6,309 | 1,898 |
import numpy as np
from scipy.sparse import csr_matrix
from feature_mining.em_base import ExpectationMaximization
class ExpectationMaximizationVector(ExpectationMaximization):
"""
Vectorized implementation of EM algorithm.
"""
def __init__(self, dump_path="../tests/data/em_01/"):
print(type(s... | 14,042 | 4,043 |
# Generated by Django 4.0.3 on 2022-03-23 14:48
from django.db import migrations, models
import django.db.models.expressions
class Migration(migrations.Migration):
dependencies = [
('api', '0008_alter_contributor_unique_together'),
]
operations = [
migrations.AddConstraint(
... | 521 | 167 |
#!/usr/bin/env python3
import argparse
import sys
import re
def displaymatch(match):
if match is None:
return None
return '<Match: %r, groups=%r>' % (match.group(), match.groups())
def bib2rest(input_bibfile, output_txtfile):
fields = ('author', 'title', 'journal', 'year', 'doi')
patterns =... | 2,706 | 815 |
from settings import STATS_DICT
def handle_stats():
"""Return a tuple containing True and the contents of the STATS dict."""
return (True, STATS_DICT)
| 161 | 51 |
class Solution:
def replaceElements(self, arr: List[int]) -> List[int]:
curr = -1
for idx in range(len(arr) -1, -1, -1):
temp = arr[idx]
arr[idx] = curr
if temp > curr:
curr = temp
return arr | 276 | 83 |
# Copyright IBM Corp, All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
import os
import bcrypt
class Config(object):
DEBUG = False
SECRET_KEY = '?\xbf,\xb4\x8d\xa3"<\x9c\xb0@\x0f5\xab,w\xee\x8d$0\x13\x8b83'
class ProductionConfig(Config):
DEBUG = False
class DevelopmentConfig(Config):
... | 658 | 307 |
import os
import pandas as pd
try:
module_path = os.path.abspath(os.path.join("."))
world_capitals = pd.read_csv(os.path.join(module_path, "data/world_capitals.csv"))
except FileNotFoundError:
module_path = os.path.abspath(os.path.join(".."))
world_capitals = pd.read_csv(os.path.join(module_path, "da... | 556 | 219 |
import cv2
import numpy as np
import time
import matplotlib.pyplot as plt
#####################################################
#
# Author: Joseph Cheng
# HSV: Hue Saturation Value
# Hue is the color
# Saturation is the greyness
# Value is the brightness of the pixel
#
#
############################... | 3,166 | 1,100 |
from netharn.layers import common
from netharn.layers import rectify
from netharn.layers import conv_norm
import numpy as np
class MultiLayerPerceptronNd(common.Module):
"""
A multi-layer perceptron network for n dimensional data
Choose the number and size of the hidden layers, number of output channels,... | 5,371 | 1,750 |
# -*- coding: utf-8 -*-
from finicityapi.api_helper import APIHelper
from finicityapi.configuration import Configuration
from finicityapi.controllers.base_controller import BaseController
from finicityapi.http.auth.custom_header_auth import CustomHeaderAuth
from finicityapi.models.consumer import Consumer
from ... | 11,116 | 2,878 |
from functools import partial
from unittest import TestCase, main
from expects import expect, be_empty, equal
from twin_sister.expects_matchers import complain
from twin_sister.fakes import FunctionSpy
from questions_three.constants import TestEvent
from questions_three.event_broker import EventBroker
class TestMul... | 2,199 | 700 |
# Compatibility Python 2/3
from __future__ import division, print_function, absolute_import
from builtins import range
# ----------------------------------------------------------------------------------------------------------------------
import numpy as np
from dotmap import DotMap
from .Logs import Logs
fro... | 5,075 | 1,585 |
#coding:utf-8
#
# id: bugs.core_3675
# title: CREATE INDEX considers NULL and empty string being the same in compound indices
# decription:
# tracker_id: CORE-3675
# min_versions: ['2.5.2']
# versions: 2.5.2
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, Acti... | 1,359 | 504 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.template.loader import render_to_string
from django.utils import timezone
def get_refund_transaction_valid(transaction_id):
return render_to_string(template_name='tests/transaction_refund.xml',
context={'transaction': transactio... | 1,278 | 395 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : hotrgTc.py
# Author : Xinliang(Bruce) Lyu <lyu@issp.u-tokyo.ac.jp>
# Date : 22.02.2021
# Last Modified Date: 22.02.2021
# Last Modified By : Xinliang(Bruce) Lyu <lyu@issp.u-tokyo.ac.jp>
# -*- coding: utf-8 -*-
"""
Created on S... | 7,724 | 2,723 |
"""
Modeling Pipeline
Author: Jia Geng
Email: gjia0214@gmail.com | jxg570@miami.edu
"""
import gc
import os
import random
import copy
import torch
import torch.nn as nn
from sklearn import metrics
from torch.optim.lr_scheduler import *
from torch.optim.optimizer import Optimizer
from datautils.datahandler import Dat... | 32,442 | 8,999 |
from discord import Embed
from discord.errors import InvalidArgument
from discord.ext import commands
import json
import os.path
from discord.ext.commands.core import command
DEBUG = True
"""
Example of the structure of the json file for storing elos
If we ever want to add a new mode we can just add a new enum to ... | 5,805 | 2,009 |
from tests.sharepoint.sharepoint_case import SPTestCase
from office365.sharepoint.webs.web import Web
class TestClientSideComponent(SPTestCase):
target_web = None # type: Web
@classmethod
def setUpClass(cls):
super(TestClientSideComponent, cls).setUpClass()
def test1_get_all_client_side_co... | 653 | 214 |
from discord.ext import commands
from player import Player
FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
'options': '-vn'}
class Music(commands.Cog):
def __init__(self, bot, color_theme):
self.players = []
self.bot = bot
... | 4,203 | 1,296 |
"""
MIT License
Copyright (c) 2019 Ali Mert Ceylan, Adopted from original resources provided
by Korhan Karabulut for COMP 5658 Modern Heuristics Course
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 Soft... | 3,895 | 1,221 |
coordinates_E0E1E1 = ((127, 144),
(127, 146), (128, 108), (128, 110), (128, 111), (128, 112), (128, 113), (128, 114), (128, 115), (128, 116), (128, 118), (129, 102), (129, 103), (129, 106), (129, 107), (129, 108), (129, 109), (129, 110), (129, 111), (129, 112), (129, 113), (129, 114), (129, 115), (129, 118), (129, 12... | 19,817 | 16,299 |
import torch
from torch.nn import Module, Parameter
from theforce.regression.algebra import positive, free_form
import warnings
class RBF(Module):
"""
Parameters: scale, variance
"""
def __init__(self, scale, variance):
super(RBF, self).__init__()
self._scale = Parameter(free_form(sc... | 5,024 | 1,878 |
import tests_module
import other_module
class RegularObject(object):
pass
class RegularObject2(other_module.RegularObjectInOtherModule):
pass
class TestMixed(tests_module.TestCase):
def test_it(self):
pass
| 229 | 71 |
from aesthetic import main_window
from logic import capture
def main():
app = main_window.MainWindow()
app.after(1000, capture.instance.logicLoop, app)
app.mainloop()
if __name__ == '__main__':
main()
| 223 | 76 |
from .dualformer import DualFormer
__all__ = [
'DualFormer'
]
| 66 | 30 |
import math
from rlbot.agents.base_agent import BaseAgent, SimpleControllerState
from rlbot.utils.structures.game_data_struct import GameTickPacket
from rlbot.utils.game_state_util import GameState, BallState, CarState, Physics, Vector3 as vector3, Rotator
from Utilities import *
from States import *
import cProfile, p... | 21,431 | 6,873 |
# BEGIN_COPYRIGHT
#
# Copyright 2009-2014 CRS4.
#
# 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... | 1,048 | 324 |
import random, sys, curses, threading, time
import main_menu
import leaderboard
from methods.menus import *
scissors=[" ▓▓▓▓▓▓ ",
" ▓▓▓▓░░░░▓▓ ",
" ... | 17,707 | 6,815 |
import numpy as np
import networkx as nx
import pandas as pd
import bct
task_networks(dset_dir, subject, session, task, event_related, conditions, runs, connectivity_metric, space, atlas, confounds)
for subject in subjects:
print(subject)
try:
for i in np.arange(0,len(sessions)):
print i
... | 1,901 | 489 |
import time
import os
import json
import dtmm
dtmm.conf.set_fftlib("mkl_fft")
import numpy as np
import nemaktis as nm
import matplotlib.pyplot as plt
from copy import deepcopy
from propagate_fields import *
########################
# Simulation constants #
########################
ne = 1.75
no = 1.5
wavelength ... | 7,775 | 3,232 |
import telebot
bot = telebot.TeleBot('1073948237:AAGKs3HzRBZwBZGkoQ5moJIakWQn39nQtX4')
def restrict(message):
try:
member = bot.get_chat_member(chat_id=message.chat.id,
user_id=message.from_user.id)
if member.status == 'creator' or member.status == 'administrat... | 6,240 | 1,768 |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, list_output
@click.command('get_jobs')
@pass_context
@custom_exception
@list_output
def cli(ctx):
"""Get the list of jobs of the current user.
Output:
list of dictionaries containing summary job info... | 978 | 383 |
import uuid
from invenio_pidstore.minters import recid_minter
from invenio_records import Record
from oarepo_validate import JSONSerializer
def test_serializer(app, db):
data = {'test': 'blah'}
record_uuid = uuid.uuid4()
pid = recid_minter(record_uuid, data)
rec = Record.create(data, id_=record_uuid... | 1,208 | 411 |
# -*- coding: utf-8 -*-
""""""
import sys
if './' not in sys.path: sys.path.append('./')
from screws.freeze.main import FrozenOnly
from objects.CSCG._3d.mesh.elements.element.sub_geometry.sub_geometry import ElementSubGeometry
import numpy as np
from objects.CSCG._3d.mesh.elements.element.sides.main import _3dCSCG_Mes... | 3,741 | 1,251 |