text string | size int64 | token_count int64 |
|---|---|---|
import os.path
import datetime
import gpxpy
import osmnx
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import functions as functions
from collections import Counter, OrderedDict
import time
import math
import argparse
from customClasses import Cell
parser = argparse.ArgumentParser()
pa... | 8,155 | 2,885 |
#!/usr/bin/env python
u"""
ftp_mar_data.py
Written by Tyler Sutterley (05/2020)
Syncs MAR regional climate outputs for a given ftp url
ftp://ftp.climato.be/fettweis
CALLING SEQUENCE:
python ftp_mar_data.py --directory=<path> <ftp://url>
INPUTS:
full ftp url
COMMAND LINE OPTIONS:
--help: list the com... | 6,728 | 2,155 |
#!/usr/bin/python
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import requests
from bs4 import BeautifulSoup
import numpy as np
import pandas as pd
import warnings
import dateparser
import datetime
import time
import json
from json import encoder
encoder.FLOAT_REPR = lambda o: format(o, '.1f'... | 13,400 | 5,346 |
# The following comments couldn't be translated into the new config version:
#
# keep only muon-related info here
#
import FWCore.ParameterSet.Config as cms
process = cms.Process("MISO")
process.load("Configuration.EventContent.EventContent_cff")
# service = MessageLogger {
# untracked vstring destination... | 7,645 | 4,306 |
'''
@Description: Easter Egg
@Author: Tianyi Lu
@Date: 2019-08-10 10:30:29
@LastEditors: Tianyi Lu
@LastEditTime: 2019-08-10 10:36:24
'''
from flask import Blueprint
egg = Blueprint('egg', __name__)
from . import views | 220 | 107 |
def test_get_news(sa_session, sa_backend, sa_child_news):
assert(sa_child_news == sa_backend.get_news(sa_child_news.id))
assert(sa_backend.get_news(None) is None)
def test_get_news_list(sa_session, sa_backend, sa_child_news):
assert(sa_child_news in sa_backend.get_news_list())
assert(sa_child_news in ... | 1,830 | 665 |
from azure.storage.blob.baseblobservice import BaseBlobService
from azure.storage.blob.blockblobservice import BlockBlobService
from database.models.Blob import Blob
class ModelBlobRepository:
def __init__(self):
self.blockBlobService = BlockBlobService(account_name='stylesblobstorage', account_key='B4qA7P... | 1,024 | 398 |
"""
Advent Of Code 2020. Day 03. Puzzle 2.
2nd approach, just to see if this may be faster.
It turns out, the first approach had been at least 3 times faster.
This second approach is slower. Hummm!
"""
import time
input_file = 'day03.txt'
TREE = '#'
SLOPES = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]
def parse(puzzl... | 1,229 | 442 |
import ast
from ast import Import as IType, ImportFrom as IFType
from astor import to_source
from asttokens import ASTTokens
from .colours import colour_str as colour
from os import linesep as nl
from sys import stderr
__all__ = [
"get_import_stmt_str",
"multilinify_import_stmt_str",
"colour_imp_stmt",
... | 20,644 | 6,242 |
import pyaf.Bench.TS_datasets as tsds
import pyaf.Bench.YahooStocks as ys
import warnings
symbol_lists = tsds.get_yahoo_symbol_lists();
y_keys = sorted(symbol_lists.keys())
print(y_keys)
k = "nysecomp"
tester = ys.cYahoo_Tester(tsds.load_yahoo_stock_prices(k) , "YAHOO_STOCKS_" + k);
with warnings.catch_warnings():
... | 384 | 158 |
import os
from functools import wraps
from fabric.api import settings, warn
def teamcity(message_name, *params, **kwargs):
force = kwargs.get('force') or False
messages = {
'testSuiteStarted': "testSuiteStarted name='%s'",
'testSuiteFinished': "testSuiteFinished name='%s'",
'buildStat... | 1,376 | 433 |
# -*- coding: utf-8 -*-
"""
This module contains a single public function:
* `read_mf35`
Function `read_mf35` reads a MF35/MT section from a string and produces a
content object with a dictionary-like structure.
The content object can be accessed using most of the keywords specified in
the ENDF6 manual for this s... | 2,331 | 941 |
import pycropml.transpiler.antlr_py.grammars
from pycropml.transpiler.antlr_py.grammars.CSharpLexer import CSharpLexer
from pycropml.transpiler.antlr_py.grammars.CSharpParser import CSharpParser
from pycropml.transpiler.antlr_py.grammars.Fortran90Lexer import Fortran90Lexer
from pycropml.transpiler.antlr_py.grammars.F... | 29,748 | 8,386 |
try:
from nrgpy import logger
except ImportError:
pass
from datetime import datetime
import os
import subprocess
import time
import traceback
from nrgpy.api.convert import nrg_api_convert
from nrgpy.utils.utilities import check_platform, windows_folder_path, affirm_directory, count_files
class local(object):
... | 10,351 | 3,017 |
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.16.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class TimelineComment(object):
"""NOTE: This class is... | 23,127 | 7,452 |
import Blasting
name = "Blasting"
input_message = f"[{name} #]"
def menu():
print("-------------------------------弱口令爆破子模块-------------------------------")
print("1、SSH弱口令爆破")
print("2、MySQL弱口令爆破")
print("输入exit退出")
print("-----------------------------------END-----------------------------------"... | 686 | 236 |
# Generated by Django 2.2.10 on 2020-04-03 19:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0039_event_limits'),
]
operations = [
migrations.AddField(
model_name='event',
name='team_size',
... | 379 | 129 |
from enum import Enum
from typing import List
from sawtooth_sdk.protobuf.batch_pb2 import BatchHeader
from sawtooth_sdk.protobuf.batch_pb2 import Batch as SignedBatch
from .requests import AbstractRequest
from .requests.helpers import get_signer
class BatchStatus(Enum):
UNKNOWN = 'UNKNOWN'
PENDING = 'PENDIN... | 1,303 | 402 |
# Implemented from: https://stackoverflow.com/questions/9501337/binary-search-algorithm-in-python
def binary_search(sequence, value):
lo, hi = 0, len(sequence) - 1
while lo <= hi:
mid = (lo + hi) // 2
if sequence[mid] < value:
lo = mid + 1
elif value < sequence[mid]:
... | 1,290 | 386 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
from datetime import datetime as dt
import logging
import json
import sys
from particle_counter import ParticleCounter
# Make instance
device001 = ParticleCounter(30)
# Set signal pin
device001.set_pin_number(PIN=14)
# Excute
devic... | 409 | 157 |
#! /usr/local/msl/bin/python
#******************************************************************************
# InstLoc.py <image.IMG/VIC>
#
# Project: Instrument Loco String for a given file
# Purpose: Localizations stored in python dictionary
#
# Author: Hallie Gengl
#
# Updated: 8/24/1... | 7,548 | 3,005 |
'''Figure module
This file is a part of BdPy.
Functions
---------
makefigure
Create a figure
box_off
Remove upper and right axes
draw_footnote
Draw footnote on a figure
'''
__all__ = [
'box_off',
'draw_footnote',
'make_violinplots',
'makefigure',
]
import matplotlib.pyplot as plt
impo... | 4,758 | 1,709 |
from app import app, nlp
from brain import ACTIONS, LANGUAGES
from dateparser import parse
from datetime import datetime, date
from services import UserService, IntentService, AppointmentService
from utils import get_content
class MasterMind(object):
""" MasterMind class """
def __init__(self, user_servi... | 6,875 | 1,863 |
class Solution:
# @param {string} s A string
# @return {boolean} whether the string is a valid parentheses
def isValidParentheses(self, s):
stack = []
dict = {"]": "[", "}": "{", ")": "("}
for char in s:
if char in dict.values():
stack.append(char)
... | 628 | 168 |
from fpakman import ROOT_DIR
def get_path(resource_path):
return ROOT_DIR + '/resources/' + resource_path
| 113 | 41 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2019-07-10 06:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('studygroups', '0121_auto_20190708_2246'),
]
operations = [
migrations.Remov... | 602 | 208 |
from ray.rllib.contrib.bandits.envs.discrete import LinearDiscreteEnv, \
WheelBanditEnv
from ray.rllib.contrib.bandits.envs.parametric import ParametricItemRecoEnv
__all__ = ["LinearDiscreteEnv", "WheelBanditEnv", "ParametricItemRecoEnv"]
| 244 | 88 |
import torch
import torch.nn as nn
import torch.nn.functional as F
class HiddenGate(nn.Module):
def __init__(self, hidden_size, input_size, bias, nonlinearity="sigmoid"):
super(HiddenGate, self).__init__()
self.linear = nn.Linear(
3*hidden_size + input_size + hidden_size, hidden_size,... | 3,770 | 1,541 |
from ..utils.jl import make_prepare
prepare = make_prepare("Comparatist.Simulators.gcm.loop")
| 94 | 32 |
'''
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
Example:
Given array nums = [-1, 2, 1, -4], and target = 1.
The sum that is closest to... | 1,268 | 351 |
from netapp.netapp_object import NetAppObject
class FlexcacheInfo(NetAppObject):
"""
FlexCache Info
When returned as part of the output, all elements of this typedef
are reported, unless limited by a set of desired attributes
specified by the caller.
<p>
When used as input to specify desire... | 7,279 | 2,061 |
import string
import warnings
import re
from . import util
import spacy
class FileParser(object):
def __init__(self,
file_parser='txt',
xml_node_path=None, fparser=None):
if file_parser not in ['txt', 'xml', 'defined']:
msg = 'file_parser should be txt, xml or... | 5,974 | 1,721 |
# -*- coding: utf-8 -*-
# Copyright 2014 Matt Austin
# 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 ... | 4,688 | 1,370 |
# Hibiscus Sense - Exercise 07 RGB LED
#
# There is 1x RGB LED.
# This RGB LED is connected to GPIO16 and integrated with WS2812.
# WS2812 is an LED controller, which use single-wire control protocol to control the LEDs.
from machine import Pin
from neopixel import NeoPixel
from time import sleep
p... | 614 | 238 |
import logging
import time
from tests.common.helpers.assertions import pytest_assert
logger = logging.getLogger(__name__)
def join_master(duthost, master_vip):
"""
Joins DUT to Kubernetes master
Args:
duthost: DUT host object
master_vip: VIP of high availability Kubernetes master
If... | 4,082 | 1,267 |
from django.contrib.auth.models import User
from apps.account.models import Profile, Group
from tastypie import fields
from tastypie.authorization import DjangoAuthorization, Authorization
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from tastypie.exceptions import BadRequest
from django.db imp... | 2,467 | 685 |
"""An extension for workspace rules."""
load("@bazel_skylib//lib:paths.bzl", "paths")
load("//:dependencies.bzl", "dependencies")
def _workspace_dependencies_impl(ctx):
platform = ctx.os.name if ctx.os.name != "mac os x" else "darwin"
for dependency in dependencies:
ctx.download(
executabl... | 6,253 | 1,926 |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: surftrace_test.py
Description :
Author : liaozhaoyan
date: 2022/2/27
-------------------------------------------------
Change Activity:
2022/2/27:
-------------------------------... | 2,010 | 761 |
from django.db import models
from django.contrib.auth.models import User
class Post(models.Model):
user = models.ForeignKey(User, related_name='posts', on_delete=models.CASCADE)
content = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=... | 834 | 265 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `database` module."""
import pytest
import os
import sqlite3
from packit_app.database import Database
def test_database_connection():
db = Database()
assert type(db.cur) is sqlite3.Cursor
assert type(db.connection) is sqlite3.Connection
asse... | 560 | 177 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.nn.pytorch.glob import SumPooling, AvgPooling, MaxPooling
"""
GIN: Graph Isomorphism Networks
HOW POWERFUL ARE GRAPH NEURAL NETWORKS? (Keyulu Xu, Weihua Hu, Jure Leskovec and Stefanie Jegelka, ICLR 2019)
https://arxiv.o... | 3,943 | 1,289 |
/home/runner/.cache/pip/pool/0e/03/a2/8516ce170f58c40a340c994a5cb76273f276d7ad1ea824422b51c9e45c | 96 | 75 |
# -*- coding: ascii -*-
#
# Copyright 2007, 2008, 2009, 2010, 2011
# Andr\xe9 Malo or his licensors, as applicable
#
# 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.or... | 5,080 | 1,476 |
from django.urls import path
from . import views
urlpatterns = [
path('charge/', views.charge, name='charge'),
path('payment/', views.HomePageView.as_view(), name='payment'),
]
| 189 | 61 |
from NoteDeid import *
from NoteConceptParser import *
from Converter import *
from D2v import *
from MLPipeline import *
| 122 | 36 |
from django.urls import path
from . import views
from core import views as core
from community import views as community
from library import views as library
from ie.urls_baseline import baseline_urlpatterns
from ie.urls_education_baseline import baseline_education_urlpatterns
app_name = "education"
urlpatterns = bas... | 1,207 | 362 |
# Stat_Canada.py (flowsa)
# !/usr/bin/env python3
# coding=utf-8
'''
Pulls Statistics Canada data on water intake and discharge for 3 digit NAICS from 2005 - 2015
'''
import pandas as pd
import io
import zipfile
import pycountry
from flowsa.common import *
def sc_call(url, sc_response, args):
"""
Convert res... | 7,138 | 2,549 |
"""
Distributed under the terms of the BSD 3-Clause License.
The full license is in the file LICENSE, distributed with this software.
Author: Jun Zhu <jun.zhu@xfel.eu>
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH.
All rights reserved.
"""
from collections import deque
from threading import Event
im... | 3,952 | 1,125 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# coding: utf8
# This is a module loader. It will reload all the files dedicated to the module
# each time it is reloaded. Therefore, any code modification will be taken into
# account.
# Moreover, because all files are loaded in the same module. All classes and
# global va... | 1,017 | 291 |
# Generated by Django 3.1 on 2020-09-23 06:48
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('todos', '0001_initial'),
... | 849 | 271 |
# -*- coding:UTF-8 -*-
'''
MIT License
Copyright (c) 2018 Robin Chen
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, co... | 4,350 | 1,857 |
# -*- coding: utf-8 -*-
"""mopitt_data_analysis.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1bb_9kuO0Suo5761xgJioS84TrEdR5ojj
"""
import pandas as pd
df = pd.read_csv('MOP02J-20200101-L2V18.0.3.csv')
df.head()
df
tx = df[0:5000]
tx
import... | 869 | 365 |
import bybit
import math
import pandas as pd
import time
from datetime import datetime
from dateutil.relativedelta import relativedelta
# settings
num_orders = 3
order_size = 1
order_distance = 10
sl_risk = 0.03
tp_distance = 5
api_key = "YOUR_KEY"
api_secret = "YOUR_SECRET"
client = bybit.bybit(test=False, api_key=... | 5,413 | 1,817 |
from flask import Flask, render_template
print (__name__)
app = Flask(__name__)
@app.route('/<name>')
def hello(name):
return render_template("btn.html", name=name)
| 177 | 63 |
from datetime import datetime
from sqlalchemy import (
Boolean,
Column,
DateTime,
ForeignKey,
Integer,
String,
UnicodeText,
)
from sqlalchemy.orm import relationship
from zemfrog.globals import db
class Article(db.Model):
id = Column(Integer, primary_key=True)
user_id = Column(For... | 936 | 298 |
from biosimulators_utils.config import get_config
from src import app
from src.handlers.run.utils import get_simulator_api, get_simulators, exec_in_subprocess
from unittest import mock
import os
import parameterized
import pytest
import requests
import shutil
import tempfile
import unittest
class GetSimulatorsTestCas... | 7,079 | 2,222 |
import argparse
import os
import random
from random import Random
from misc import logger
from domain.network_premitives import *
from flow_gen.link_failure_change_generator import LinkFailureChangeGenerator
from flow_gen.random_change_generator import RandomChangeGenerator
if __name__ == '__main__':
parser = arg... | 2,372 | 724 |
# coding: utf-8
#------------------------------------------------------------------------------------------#
# This file is part of Pyccel which is released under MIT License. See the LICENSE file or #
# go to https://github.com/pyccel/pyccel/blob/master/LICENSE for full license details. #
#------------------------... | 6,020 | 1,730 |
def print_lol(arr):
for row in arr:
if (isinstance(row, list)):
print_lol(row)
else:
print
row
| 151 | 47 |
#!/usr/bin/env cctbx.python
from __future__ import print_function
"""
xds_plot_integrate.py
(c) RIKEN 2015. All rights reserved.
Author: Keitaro Yamashita
This software is released under the new BSD License; see LICENSE.
"""
"""
TODO: plot differences in direct beam and rotation axis
"""
import sys
import re
import... | 8,471 | 3,269 |
class Source:
"""Source class to define News Source Objects"""
def __init__(self,id,name,description,url,category,country):
self.id = id
self.name = name
self.description = description
self.url = url
self.category = category
self.country = country
class Article:... | 732 | 193 |
#
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""
Channel sub-package of the Sionna library implementing 3GPP TR39.801 models.
"""
# pylint: disable=line-too-long
from .antenna import AntennaElement, AntennaPanel, Pane... | 823 | 287 |
import sys
sys.path.insert(0, '/var/www/katty')
from index import app as application
| 85 | 29 |
######
# If you do not want to post results on Twitter remove the lines marked with TWITTER
######
import time
import tweepy
import os
import classes.utility
import requests
from bs4 import BeautifulSoup, SoupStrainer
tools = classes.utility.ScavUtility()
iterator = 1
session = requests.session()
session.proxies = {}... | 5,632 | 2,394 |
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from docutils.core import publish_parts
register = template.Library()
@register.filter(name='rst')
@stringfilter
def rst_to_html5(text):
parts = publish_parts(text, writer_name='html5'... | 428 | 127 |
# Copyright (C) 2019 by eHealth Africa : http://www.eHealthAfrica.org
#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with
# the License. Y... | 35,931 | 10,117 |
# -*- coding: utf-8 -*-
"""Top-level package for ballet."""
__author__ = 'Micah Smith'
__email__ = 'micahs@mit.edu'
__version__ = '0.19.5'
# filter warnings
import warnings # noqa E402
warnings.filterwarnings(
action='ignore', module='scipy', message='^internal gelsd')
# silence sklearn deprecation warnings
im... | 1,083 | 363 |
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 8,816 | 2,439 |
# Copyright (c) 2019 PaddlePaddle Authors. 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 applic... | 1,549 | 477 |
from zpy.logger import TLogger, c_info
from zpy.db.utils import get_current_schema
from marshmallow_objects import models
from typing import Any, Dict, List, Optional, Union
from zpy.db import DBConnection
from zpy.utils.funcs import exec_ifnt_null, safely_exec
from enum import Enum
from marshmallow import Schema
impor... | 15,825 | 4,424 |
from pyscf import gto
import radii
def from_frag(xyz, frags, chgs, spins, gjfhead='', scrfhead='', gjfname='', basis=None, wfnpath=None):
# mol = gto.Mole()
# mol.atom = xyz
# mol.basis = bas
# mol.verbose = 1
# mol.build()
#
if isinstance(frags[0], str):
frags = str2list(frags)
guess_fr... | 2,469 | 1,002 |
"""
File to control the parameters of the SITE approach and to specify the postprocessing functionality.
The parameters for each equation are the ones used in the paper. All results of the paper
'Sparse Identification of Trunction Errors' of Thaler, Paehler and Adams, 2019 can be replicated only be
setting the appropri... | 7,485 | 2,308 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Will Brennan'
import os
import cv2
import numpy
def find_images(path, recursive=False, ignore=True):
if os.path.isfile(path):
yield path
elif os.path.isdir(path):
assert os.path.isdir(path), 'FileIO - get_images: Directory does not ... | 1,347 | 449 |
from aoc2019 import *
import unittest
class Day1(unittest.TestCase):
def test_mass_12(self):
chall = Rocket()
self.assertEqual(chall.calc_fuel_weight(12), 2)
def test_mass_14(self):
chall = Rocket()
self.assertEqual(chall.calc_fuel_weight(14), 2)
def test_mass_1969(self):
... | 955 | 400 |
"""
Contains the definition of Compound.
"""
from xdtools.artwork import Artwork
from xdtools.utils import Point
class Compound(Artwork):
"""
A compound shape.
=== Attributes ===
uid - the unique id of this Compound shape.
name - the name of this Compound shape as it appears in the Layers panel.... | 1,397 | 394 |
from PyQt5 import QtWidgets
from PyQt5.QtCore import QSettings
from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox, FCLabel
from appGUI.preferences import machinist_setting
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext
import appTranslation as fcTranslate
imp... | 9,084 | 3,214 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
"""
Test play sounds. (January 1st, 2015)
Piece of SimpleGUICS2Pygame.
https://bitbucket.org/OPiMedia/simpleguics2pygame
GPLv3 --- Copyright (C) 2015 Olivier Pirson
http://www.opimedia.be/
"""
import time
try:
import simplegui
SIMPLEGUICS2PYGAME = False
exce... | 1,094 | 451 |
# 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
# d... | 2,270 | 673 |
import torch as t
from torch.autograd import Variable
import numpy as np
import re
import pickle
import h5py
from .load import Data
from .load_chinese import ChineseData
class TrainData:
def __init__(self, data_path, conversation_path, results_path, chinese, prev_sent=2, load=True):
if chinese:
... | 2,202 | 734 |
import requests
from datetime import timedelta
from .language import Language
class Config(object):
"""
Contains global configuration
"""
DEFAULT_USER_AGENT = 'mediawikiapi (https://github.com/lehinevych/MediaWikiAPI/)'
DONATE_URL = 'https://donate.wikimedia.org/w/index.php?title=Special:FundraiserLandingPa... | 2,935 | 867 |
from sys import stdout
H, W = map(int, input().split())
a = [input() for _ in range(H)]
h = [all(c == '.' for c in a[i]) for i in range(H)]
w = [True] * W
for i in range(H):
for j in range(W):
w[j] = w[j] and a[i][j] == '.'
for i in range(H):
if h[i]:
continue
for j in range(W):
... | 403 | 163 |
""" Data Transfer Objects """
from pydantic import BaseModel
class WarehouseDto(BaseModel):
name: str # this is our unique identifier!
location: str
capacity: int | 175 | 49 |
from django.contrib import admin
# Register your models here.
from .models import Cart,CartItem
admin.site.register(Cart)
admin.site.register(CartItem)
| 155 | 46 |
import os
import os.path as osp
import pickle
import time
import numpy as np
from multiprocessing import Pool
from ..utils import get_bbox_dim
from .misc import read_img_info, change_cls_order, get_classes
def load_imgs(img_dir, ann_dir=None, classes=None, nproc=10,
def_bbox_type='poly'):
assert d... | 2,865 | 970 |
def cwinstart(callobj, *args, **kwargs):
print('cwinstart')
print(' args', repr(args))
for arg in args:
print(' ', arg)
print(' kwargs', len(kwargs))
for k, v in kwargs.items():
print(' ', k, v)
w = callobj(*args, **kwargs)
print(' callobj()->', w)
return w
def cwincall(req1, req2, ... | 562 | 229 |
from setuptools import setup
setup(name='emoji_map',
version='0.1',
description='Maps unicode emoji to its description',
url='http://github.com/rchurch4/emoji_map',
author='Rob Churchill',
author_email='rchurch4@bu.edu',
license='MIT',
packages=['emoji_map'],
include_pac... | 358 | 118 |
import json
import os
import pytest
import tempfile
@pytest.fixture(scope='session', autouse=True)
def working_test_dir():
# create a produce a temporary directory to use for everything
tmp_working_dir = tempfile.TemporaryDirectory()
yield tmp_working_dir.name
# delete it at the end of the session
... | 1,034 | 334 |
'''
File name: gin_rummy/melding.py
Author: William Hale
Date created: 2/12/2020
'''
from rlcard3.games.gin_rummy.card import Card
import rlcard3.games.gin_rummy.utils.utils as utils
from typing import List
from typing import Set
import copy
import random
"""
Terminology:
run_meld - three o... | 6,348 | 2,337 |
"""Module for RL2.
This module contains RL2, RL2Worker and the environment wrapper for RL2.
"""
# yapf: disable
import abc
import collections
import akro
from dowel import logger
import numpy as np
from garage import (EnvSpec,
EnvStep,
EpisodeBatch,
log_mul... | 17,255 | 4,858 |
from typing import Tuple, List, TypeVar
T = TypeVar("T")
def orderForLeastMotorMovement(positions: List[Tuple[T, Tuple[float, float]]], startposition: Tuple[float, float]) -> List[T]:
xpositions = set([p[1][0] for p in positions] + [startposition[0]])
ypositions = set([p[1][1] for p in positions] + [startpos... | 2,059 | 586 |
r"""
Collection of functions for manipulating network topology
=========================================================
This module contains a selection of functions that deal specifically with
network topology.
"""
from ._topotools import *
from ._perctools import *
from ._graphtools import *
from ._plottools impo... | 350 | 84 |
#!/usr/bin/env python
#
# Copyright (C) 2009 Google 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 ... | 7,560 | 2,507 |
#!/usr/bin/env python
import rospy
from math import sqrt
from geometry_msgs.msg import Twist, PoseStamped, Pose2D, PointStamped, PoseWithCovarianceStamped
from std_msgs.msg import Empty, String
import Queue
goal_point = rospy.Publisher(
"move_base_simple/goal", PoseStamped, queue_size=1)
servo = rospy.Publisher(... | 3,299 | 1,547 |
from unittest import TestCase
from pylibsrtp import Error, Policy, Session
RTP = (
b"\x80\x08\x00\x00" # version, packet type, sequence number
b"\x00\x00\x00\x00" # timestamp
b"\x00\x00\x30\x39" # ssrc: 12345
) + (b"\xd4" * 160)
RTCP = (
b"\x80\xc8\x00\x06\xf3\xcb\x20\x01\x83\xab\x03\xa1\xeb\x02\x0... | 5,587 | 2,108 |
#!/usr/bin/python
# Copyright 2020 Red Hat, 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 ... | 7,974 | 2,111 |
# Generated by Django 3.2.6 on 2021-09-10 11:56
import uuid
import django.db.models.deletion
import django.db.models.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("user_management", "0002_remove_username"),
... | 2,207 | 541 |
#!/usr/bin/env python3
# Copyright (C) 2020-2021 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except... | 624 | 217 |
import pyGDP
import os
from nose.tools import assert_equal
from nose.tools import assert_not_equal
class TestFeatureCategoricalGridCoverage(object):
def test_submit_FCGC(self):
pyGDP.WPS_URL='http://cida.usgs.gov/gdp/process/WebProcessingService'
testPyGDP = pyGDP.pyGDPwebProcessing()
... | 1,009 | 333 |
# Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 16,521 | 5,226 |
from __future__ import absolute_import
from collections import namedtuple
from datetime import datetime, timedelta
import pytz
from casexml.apps.case.dbaccessors import get_open_case_docs_in_domain
from casexml.apps.case.mock import CaseBlock
from casexml.apps.case.xml import V2
import uuid
from xml.etree import Elemen... | 7,151 | 2,244 |