text string | size int64 | token_count int64 |
|---|---|---|
#!/usr/bin/env python3
"""TarSync.py: Synchronize .fcstd and .tar files.
Usage: TarSync.py [OPTIONS] [DIR] ...
Recursively scans directories searching for `.fcstd`/`.FCstd` files
and synchronizes them with associated `.tar` files. The current
directory is used if no explicit directory or files are listed.
Options:
... | 13,959 | 4,260 |
from tcga_encoder.utils.helpers import *
from tcga_encoder.data.data import *
#from tcga_encoder.data.pathway_data import Pathways
from tcga_encoder.data.hallmark_data import Pathways
from tcga_encoder.definitions.tcga import *
#from tcga_encoder.definitions.nn import *
from tcga_encoder.definitions.locations import *
... | 20,325 | 8,835 |
from XXX_PROJECT_NAME_XXX.settings import * # noqa
# Override any settings required for tests here
| 102 | 32 |
from django.db import models
#from djangosphinx import SphinxSearch, SphinxRelation, SphinxQuerySet
#import djangosphinx.apis.current as sphinxapi
from advancedsearch.models import Movie, Episode, Song
from browseNet.models import Host, Path
# Create your models here.
class File(models.Model):
'''An indexed ... | 3,808 | 1,217 |
#!/usr/bin/env python3
# Copyright (c) 2016-2020, henry232323
#
# 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, mo... | 1,790 | 614 |
#
# -*- coding: utf-8 -*-
#
# This file is part of reclass (http://github.com/madduck/reclass)
#
# Copyright © 2007–14 martin f. krafft <madduck@madduck.net>
# Released under the terms of the Artistic Licence 2.0
#
from reclass.utils.refvalue import RefValue
from reclass.defaults import PARAMETER_INTERPOLATION_SENTINE... | 4,465 | 1,544 |
"""
Author: Isamu Isozaki (isamu.website@gmail.com)
Description: description
Created: 2021-12-01T16:32:53.089Z
Modified: !date!
Modified By: modifier
"""
from flask import Blueprint, redirect, jsonify, url_for, request
from neuroflow.repository import create_mood, get_authorized, load_moods_from_user
from functools i... | 1,506 | 490 |
import logging
import time
from pathlib import Path
from configparser import ConfigParser
import boto3
from botocore.exceptions import ClientError
def create_bucket(bucket_name: str, region: str = 'us-west-2'):
"""
Create S3 bucket
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-example-c... | 2,684 | 843 |
# -*- coding: utf-8 -*-
import time
help_msg = '''------ §aMCR 时钟插件帮助信息 §f------
§b!!time help §f- §c显示帮助消息
§b!!time ct §f- §c显示当前时间
§b!!time timer [秒] §f- §c开启倒计时
§b!!time stopwatch start §f- §c开启秒表
§b!!time stopwatch stop §f- §c停止秒表
--------------------------------'''
no_input = '''------ §a温馨提示 §f------
§c未知指令 请输入... | 4,734 | 1,574 |
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020 EntySec
#
# 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,... | 4,174 | 1,159 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 5
@author: Melisa Maidana
This script runs different cropping parameters, motion correct the cropped images using reasonable motion correction parameters that were previously selected
by using the parameters_setting_motion_correction scripts, and ... | 8,556 | 2,938 |
import pandas as pd
import json
import urllib2
def download_nordpool(limit, output_file):
'''
The method downloads the nordpool available data from www.energidataservice.dk and saves it in a csv file
limit: Int, the number of maximum rows of data to download
output_file: Str, the name of the output file
'''
... | 1,676 | 608 |
from typing import Any
import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self, entity_dim):
super(CNN, self).__init__()
self.dim = entity_dim
self.conv1 = nn.Conv1d(in_channels=1, out_channels=10,
kernel_s... | 1,873 | 772 |
from rest_framework import generics
from rest_framework.response import Response
from rest_framework.views import APIView
from .serializers import *
class WarriorListView(APIView):
def get(self, request):
warriors = Warrior.objects.all()
serializer = WarriorSerializer(warriors, many=True)
... | 2,608 | 756 |
# -*- encoding:utf-8 -*-
class Platform:
def __init__(self):
pass
class Win(Platform):
pass
class Ios(Platform):
pass
class Android(Platform):
pass | 157 | 61 |
'''
Created on 19 de ene. de 2016
@author: david
'''
import time
class MotorDummy(object):
MAX_THROTTLE = 80.0 #percentage
def __init__(self, motorId):
"""
Constructor
@param motorId: Identificator of the motor. A number between 0 to 3 (in case of quadcopter)
... | 1,801 | 552 |
import asyncio
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Type
from typing import Union
try:
import simplejson as json
except ImportError:
import json
import websockets
from valr_python.enum import AccountEvent
from valr_python.e... | 29,136 | 8,774 |
from enum import Enum
class Compressor(Enum):
NoneCompressor = None
Uint8Compressor = "MinMaxUInt8"
| 110 | 41 |
#!/usr/bin/env python3
from database import Database
from rafflecollector import RaffleCollector
import os
import smtplib, ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import schedule
import time
class Emailer:
db = Database()
email_id = os.environ['RAFFLE_EMAIL']
... | 2,215 | 721 |
import os
import json
import shutil
import time
from pathlib import Path
from sys import platform
# TODO: (stackoverflow.com/question/17136514/how-to-get-3rd-party-cookies)
# stackoverflow.com/questions/22200134/make-selenium-grab-all-cookies, add the selenium, phantomjs part to catch ALL cookies
# TODO: Maybe save ... | 4,391 | 1,332 |
from flask import current_app
from ..internals.database.database import get_cursor
def take_lock(service, artist_service_id, post_service_id):
query = 'INSERT INTO post_import_lock (service, artist_service_id, post_service_id) VALUES (%s, %s, %s) ON CONFLICT DO NOTHING RETURNING id'
with get_cursor() as curso... | 925 | 283 |
""" Tank shapes package for Guns.
This init file marks the package as a usable module.
"""
| 93 | 29 |
def main():
lines = open('input.txt', 'r').readlines()
if __name__ == '__main__':
main()
| 99 | 38 |
import feedparser
import vlc
import argparse
import sys
import time
import curses
import wget
def arg():
parser = argparse.ArgumentParser(
description='Simple Podcast Streamer.')
parser.add_argument('--add', '-a', type=str, default=None,
help='Pass Podcast an URL argument that you want to add.... | 4,468 | 1,423 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convenience wrapper for running tfbs_footprinter directly from source tree."""
from tfbs_footprinter.tfbs_footprinter import main
if __name__ == '__main__':
main()
| 229 | 87 |
import shap
from pandas import DataFrame
from sklearn.preprocessing import StandardScaler
from metalfi.src.data.meta.importance.featureimportance import FeatureImportance
class ShapImportance(FeatureImportance):
def __init__(self, dataset):
super(ShapImportance, self).__init__(dataset)
self._na... | 2,573 | 829 |
def is_area_in_board(area):
if 0 <= area[0] <= 7 and 0 <= area[1] <= 7:
return True
return False
def cancel_castling(checker):
if abs(checker.val) == 50 or abs(checker.val) == 900:
checker.castling = False
def is_king_beaten(board, color):
for row in board:
for are... | 5,704 | 2,065 |
"""
Original code Copyright 2009 [Waylan Limberg](http://achinghead.com)
All changes Copyright 2008-2014 The Python Markdown Project
Changed by Mohammad Tayseer to add CSS classes to table
License: [BSD](http://www.opensource.org/licenses/bsd-license.php)
"""
from __future__ import absolute_import
from __future__ ... | 2,281 | 631 |
import argparse
import json
import logging
import os
import sys
import time
import cv2
import numpy as np
import PIL
import torch
import torch.nn as nn
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from PIL import Image
from angle import generate_angle
# from cifar100_dataset im... | 6,320 | 2,100 |
# -*- coding: utf-8 -*-
"""
Image, 2D{3} datasets
^^^^^^^^^^^^^^^^^^^^^
"""
# %%
# The 2D{3} dataset is two dimensional, :math:`d=2`, with
# a single three-component dependent variable, :math:`p=3`.
# A common example from this subset is perhaps the RGB image dataset.
# An RGB image dataset has two spatial dim... | 3,231 | 1,032 |
from .procedure import (
CrossCouplingBlueprint,
GenericBlueprint
)
| 76 | 25 |
s = float(input('Digite o valor do salário: R$ '))
p = s + (s * 15 / 100)
print('o salário de R$ {} com mais 15% ficará {:.2f}'.format(s, p)) | 141 | 66 |
import codecs
import sqlite3
import json
from fnmatch import fnmatch
from abc import ABC, abstractmethod
class FilesAnalysis(ABC):
"""Abstraction for analysis of transaction input data that contain popular file types."""
def __init__(self, chain: str, limit: int = 0, content_types: list[str] = ['*']):
"""
Initi... | 2,868 | 1,059 |
# Create your models here.
import datetime
from django.db import models
from rest_framework.compat import MinValueValidator
class Movie(models.Model):
title = models.CharField(max_length=512)
year = models.IntegerField(validators=[MinValueValidator(0), ],
null=True,
... | 3,615 | 890 |
"""An example of using Dakota as a component with PyMT.
This example requires a WMT executor with PyMT installed, as well as
the CSDMS Dakota interface and FrostNumberModel installed as
components.
"""
import os
from pymt.components import MultidimParameterStudy, FrostNumberModel
from dakotathon.utils import configur... | 1,211 | 420 |
from callback import ValidationHistory
from dataloader import Dataloader
from normalizer import Normalizer
import tensorflow as tf
import numpy as np
import argparse
def get_model(input_shape, n_classes):
base_model = tf.keras.applications.MobileNetV2(input_shape=input_shape,
... | 4,427 | 1,316 |
# coding=utf-8
from orgmode_entry import OrgmodeEntry
entry = u'#A Etwas machen:: DL: Morgen S: Heute Ausstellung am 23.09.2014 12:00 oder am Montag bzw. am 22.10 13:00 sollte man anschauen. '
org = OrgmodeEntry()
# Use an absolute path
org.inbox_file = '/Users/Alex/Documents/Planung/Planning/Inbox.org'
org.delim... | 1,354 | 482 |
import gzip
import bz2
import lzma
s = b'witch which has which witches wrist watch'
with open('2.txt', 'wb') as f: f.write(s)
with gzip.open('2.txt.gz', 'wb') as f: f.write(s)
with bz2.open('2.txt.bz2', 'wb') as f: f.write(s)
with lzma.open('2.txt.xz', 'wb') as f: f.write(s)
print('txt', len(s))
print('gz ', len(gzip... | 407 | 198 |
import pytz
from datetime import datetime
MEETING_HOURS = range(6, 23) # meet from 6 - 22 max
TIMEZONES = set(pytz.all_timezones)
def within_schedule(utc, *timezones):
"""Receive a utc datetime and one or more timezones and check if
they are all within schedule (MEETING_HOURS)"""
times = []
... | 751 | 256 |
from os import sys, environ
from tracker.__main__ import args
# Name of the file to save kernel versions json
DB_FILE_NAME = "data.json"
# By default looks up in env for api and chat id or just put your stuff in here
# directly if you prefer it that way
BOT_API = environ.get("BOT_API")
CHAT_ID = environ.get("CHAT_ID"... | 450 | 152 |
from django.apps import AppConfig
class DiveSitesConfig(AppConfig):
name = 'dive_sites'
| 94 | 32 |
# test_utils.py를 아래 내용으로 overwrite합니다(-a 옵션 없이!)
import pytest
import pandas as pd
import datetime
from utils import is_working_day, load_data
def test_is_working_day():
assert is_working_day(datetime.date(2020,7,5)) == False
assert is_working_day(datetime.date(2020,7,4)) == False
assert is_working_day(dat... | 615 | 243 |
import json
import subprocess
from CommonServerPython import *
TWIST_EXE = '/dnstwist/dnstwist.py'
if demisto.command() == 'dnstwist-domain-variations':
KEYS_TO_MD = ["whois_updated", "whois_created", "dns_a", "dns_mx", "dns_ns"]
DOMAIN = demisto.args()['domain']
LIMIT = int(demisto.args()['limit'])
... | 3,302 | 1,087 |
# encoding: utf-8
import inspect
def caller(frame=2):
"""
Returns the object that called the object that called this function.
e.g. A calls B. B calls calling_object. calling object returns A.
:param frame: 0 represents this function
1 represents the caller of this function (e.g. ... | 595 | 167 |
# pylint: disable=missing-docstring,protected-access
"""
Copyright 2017 ARM Limited
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 b... | 3,395 | 1,067 |
#!/bin/python3
import sys
prev = ''
cnt = 0
for x in sys.stdin.readlines():
q, w = x.split('\t')[0], int(x.split('\t')[1])
if (prev == q):
cnt += 1
else:
if (cnt > 0):
print(prev + '\t' + str(cnt))
prev = q
cnt = w
if (cnt > 0):
print(prev + '\t' + str(cnt))... | 321 | 132 |
import attr
from covid19_id.utils import ValueInt
@attr.dataclass(slots=True)
class VaksinasiHarian:
key_as_string: str
key: int
doc_count: int
jumlah_vaksinasi_2: ValueInt
jumlah_vaksinasi_1: ValueInt
jumlah_jumlah_vaksinasi_1_kum: ValueInt
jumlah_jumlah_vaksinasi_2_kum: ValueInt
| 313 | 136 |
import json
import hashlib
from .test_case.blockchain import BlockchainTestCase
class TestHashingAndProofs(BlockchainTestCase):
def test_hash_is_correct(self):
self.create_block()
new_block = self.blockchain.last_block
new_block_json = json.dumps(
self.blockchain.last_block, ... | 511 | 165 |
import warnings
import numpy as np
import pandas as pd
import xgboost as xgb
import scipy.stats as st
from sklearn.neighbors import BallTree
from xgbse._base import XGBSEBaseEstimator
from xgbse.converters import convert_data_to_xgb_format, convert_y
from xgbse.non_parametric import (
calculate_kaplan_vectorized,... | 14,495 | 4,224 |
import math
import numpy as np
import pandas as pd
import tensorflow as tf
import datetime as dt
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import warnings
warnings.filterwarnings('ignore')
# Hiperparametri
epoch_max = 10
alpha_max = 0.025
alpha_min = 0.001
batch_size = 32
window_size = 14
test... | 3,932 | 1,599 |
# Generated by Django 3.1 on 2020-10-10 14:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("submission", "0052_auto_20201010_1307"),
]
operations = [
migrations.AddField(
model_name="reviewphase",
name="can_tag... | 420 | 151 |
from os import path
package_dir = path.abspath(path.dirname(__file__))
def setup(app):
app.add_html_theme("zsbase", path.join(package_dir, "themes", "zsbase"))
app.add_html_theme(
"zzzeeksphinx", path.join(package_dir, "themes", "zzzeeksphinx")
)
app.add_html_theme("zsmako", path.join(package... | 440 | 164 |
# -*- coding: utf-8 -*-
__author__ = 'S.I. Mimilakis'
__copyright__ = 'MacSeNet'
import torch
from torch.autograd import Variable
import numpy as np
dtype = torch.DoubleTensor
np.random.seed(2183)
torch.manual_seed(2183)
# D is the "batch size"; N is input dimension;
# H is hidden dimension; N_out is output dimens... | 2,674 | 1,068 |
# project/main/views.py
#################
#### imports ####
#################
import os
import json
import requests
import pickle
from flask import Blueprint, Flask, jsonify, request, g, url_for, abort, redirect, flash, render_template, current_app
from flask_login import current_user
from flask_login import login_re... | 2,657 | 743 |
import string
from django import forms
from django.conf import settings
from django.shortcuts import get_object_or_404
from accounts.models import User, Profile
from .models import Blogs
from .utils import get_limit_for_level, write_to_limit
class EditLimitForm(forms.Form):
free_limit = forms.IntegerField(help_t... | 3,195 | 1,088 |
a = [1, 2, 3, 5, 6]
def recursive_search(array, item_to_find, current_index=0):
if current_index == len(array):
return None
elif array[current_index] == item_to_find:
return current_index
else:
return recursive_search(array, item_to_find, current_index + 1)
# print(recursive_search(... | 1,032 | 364 |
from heap.max_binary_heap import MaxBinaryHeap
def test_exists_and_instantiation():
assert MaxBinaryHeap
assert MaxBinaryHeap()
def test_properties():
bh = MaxBinaryHeap()
bh.heapList = [1,2,3]
assert bh.heapList == [1,2,3]
def test_percUp():
bh = MaxBinaryHeap()
bh.heapList = [3,2,1,4]
... | 1,134 | 526 |
# -*- coding: utf-8 -*-
def del_duplicate(ip_combine):
ip_combine = list(set(ip_combine))
ip_combine_temp = []
del ip_combine[0]
# print(len(ip_combine))
for i in range(len(ip_combine)):
ip1, ip2 = ip_combine[i].split(":")
if ip2+":"+ip1 not in ip_combine_temp:
ip_combin... | 409 | 167 |
# -*- coding: utf-8 -*-
"""Mock Kwik files."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import os.path as op
import numpy as np
import numpy.random as nr
from .mea import staggered_posit... | 6,623 | 2,127 |
# Copyright 2020 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 law or agreed to in writing, ... | 1,824 | 508 |
import logging
from urllib.parse import urlsplit
import asyncio as aio
from functools import partial
from .api.service import Service
from .api.xsd import device as deviceParser
from ..utils import requests_get
log = logging.getLogger(__name__)
class DeviceUnreachable(Exception): pass
class UnknownService(Excepti... | 3,355 | 984 |
"""File providing localtime support."""
import time
import network
import ntptime
from machine import RTC, reset
from config import Config
system_config = Config('system_config.json')
class Localtime():
"""Synchronized realtime clock using NTP."""
def __init__(self, utc_offset=None):
self.utc_offset =... | 2,012 | 591 |
from django.urls import path
from . import views
urlpatterns = [
path('register/', views.registration_view, name='api_register'),
path('login/', views.LoginView.as_view(), name='api_login'),
path('complete_profile/', views.complete_profile_view, name='api_complete_profile'),
path('logout/', views.Logou... | 448 | 142 |
"""A kernel manager for multiple kernels
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as par... | 8,347 | 2,327 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,
# 小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少?
# 2 2 4 6 10 ...
# 输出前20个月
f1 = 2
f2 = 2
for i in range(1, 20):
print '%d\n%d' % (f1, f2)
f1 = f1 + f2
f2 = f1 + f2
| 256 | 208 |
from random import randrange
from time import time
from __future__ import generators,division
from Subs import *
patch = {
'side l' : 45,
'side r' : 46,
'main 1' : 1,
'main 2' : 2,
'main 3' : 3,
'main 4' : 4,
'main 5' : 5,
'main 6' : 6,
'main 7' : 7,
'main 8' : 8,
'main 9' ... | 13,312 | 6,657 |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
# @file
# @author Simon Heybrock
# flake8: noqa
from . import runtime_config
user_configuration_filename = runtime_config.config_filename
config = runtime_config.load()
del runtime_config
from ._scipp import _... | 3,672 | 1,180 |
# Import the required 'libraries' for pin definitions and PWM
from machine import Pin, PWM
# Also import a subset for sleep and millisecond sleep. If you just import
# the utime you will have to prefix each call with "utime."
from utime import sleep, sleep_ms
# Define what the buzzer object is - a PWM output o... | 1,733 | 744 |
from sqlalchemy.test.testing import assert_raises, assert_raises_message
from sqlalchemy import MetaData, Integer
from sqlalchemy.test.schema import Table
from sqlalchemy.test.schema import Column
from sqlalchemy.orm import mapper, create_session
import sqlalchemy as sa
from sqlalchemy.test import testing
from test.orm... | 1,789 | 498 |
"""
Backend abstraction for PDFDocuments
"""
import abc
import os
DEFAULT_BACKEND = "poppler"
BACKEND = os.environ.get("PDFTABLES_BACKEND", DEFAULT_BACKEND).lower()
# TODO(pwaller): Use abstract base class?
# What does it buy us? Can we enforce that only methods specified in an ABC
# are used by client code?
class... | 2,607 | 739 |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import gym
from class_ppo import *
from gym_torcs import TorcsEnv
#----------------------------------------------------------------------------------------
EP_MAX = 2000
EP_LEN = 1000
GAMMA = 0.95
A_LR = 1e-4
C_LR = 1e-4
BATCH = 128
A_UPDA... | 3,316 | 1,312 |
""" Test case for the DocumentationWidget """
from tempfile import mkdtemp
from pySUMOQt import MainWindow
import pysumo
import shutil
"""
Steps:
1. Open pySUMO
2. Open Merge.kif
3. Open DocumentationWidget
3a. Switch to the Ontology tab in the DocumentationWidget
4. Type subrelation into the search field
4a. Press En... | 681 | 224 |
import unittest
import threading
from garage.threads import executors
class ExecutorTest(unittest.TestCase):
def test_executor(self):
pool = executors.WorkerPool()
self.assertEqual(0, len(pool))
# No jobs, no workers are hired.
with executors.Executor(pool, 1) as executor:
... | 1,628 | 532 |
import os
import json
from tqdm import tqdm
from loader.Database import DBViewIndex, DBView, check_target_path
from exporter.Shared import snakey
from exporter.Adventurers import CharaData
from exporter.Dragons import DragonData
class BattleRoyalCharaSkin(DBView):
def __init__(self, index):
super().__ini... | 2,619 | 906 |
from .user.queries import UserQuery # isort:skip
from .user_group.queries import UserGroupQuery # isort:skip
| 111 | 36 |
import matplotlib
matplotlib.use('Agg')
from statiskit import core
from statiskit.data import core as data
import unittest
from nose.plugins.attrib import attr
@attr(linux=True,
osx=True,
win=True,
level=1)
class TestSlopeHeuristic(unittest.TestCase):
@classmethod
def setUpClass(cls):
... | 772 | 251 |
from scipy.io import loadmat
import pickle
mldinfo =loadmat('mldinfo.mat')["mldinfo"]
out={}
print(mldinfo)
for i in mldinfo:
line={}
line["floatNumber"] = i[0]
line["cycleNumber"] = i[26]
line["tempMLTFIT"] = i[27]
line["tempMLTFITIndex"] = i[28]
line["densityMLTFIT"] = i[30]
line["salinity... | 688 | 302 |
#!/usr/bin/env python
"""
This is a special app instance that allows us to perform database operations
without going through the app's migration_needed check. Running this script
is functionally equivalent to what `flask db` normally does. The reason we
can't continue to use that is that command is that... | 1,578 | 437 |
# -*- coding: utf-8 -*-
"""Forms to process action related fields.
ActionUpdateForm: Basic form to process the name/description of an action
ActionForm: Inherits from Basic to process name, description and type
ActionDescriptionForm: Inherits from basic but process only description (for
surveys)
FilterForm: Fo... | 4,368 | 1,248 |
#------------------------------------------------------------------------------
#
# Copyright (c) 2006, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions d... | 27,740 | 6,172 |
from django.contrib.auth.models import Group
from django.test import TestCase
from django.urls import reverse, reverse_lazy
from django_dynamic_fixture import G
from apps.authentication.models import OnlineUser
from ..constants import EventType
from ..models import Event
from .utils import (
add_event_permissions... | 3,400 | 1,126 |
from pyuvs.files import DataFilenameCollection
class L1bDataFilenameCollection:
def __init__(self, files: DataFilenameCollection):
self.__files = files
def __raise_value_error_if_not_all_l1b(self) -> None:
if not self.__files.all_l1b():
message = 'Some files are not all level 1b.'... | 359 | 110 |
# coding: utf-8
import urllib2
import message_box
from ast import literal_eval
class InfoExtractor():
""" Extractor Information class for Instagram
Instagram InfoExtractor that, given url, extract information about the
image (or images) the URL refers to. This information includes the real
image URL,... | 9,380 | 2,583 |
import sys
import os
import subprocess
import pyautogui
import time
subprocess.run("C:/Windows/system32/cmd.exe")
time.sleep(3)
pyautogui.typewrite("python")
| 195 | 92 |
#自作関数のインポート
import pip_test
if __name__ == '__main__':
pip_test.hello() | 75 | 37 |
from .main import MainPort | 26 | 7 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018, 2019 Esteban J. G. Gabancho.
#
# Invenio-S3 is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Module tests."""
from __future__ import absolute_import, print_function
from invenio_s3 imp... | 1,830 | 641 |
from textattack.constraints.pre_transformation import PreTransformationConstraint
from textattack.shared.utils import default_class_repr
class MaxWordIndexModification(PreTransformationConstraint):
"""
A constraint disallowing the modification of words which are past some maximum length limit
"""
de... | 600 | 159 |
# TODO(jonathan): try to simplify this.
def merge_kwargs(d1, d2, limit = 5):
"""Combine kwargs in a useful way.
merge_kwargs combines dictionaries by inserting keys from d2 into d1. If
the same key exists in both dictionaries:
* if the value is a scalar, d2[key] overrides d1[key].
* if the valu... | 2,012 | 610 |
# import libraries
import os, os.path
import numpy as np
import pandas as pd
# import geopandas as gpd
import sys
from IPython.display import Image
# from shapely.geometry import Point, Polygon
from math import factorial
import scipy
from statsmodels.sandbox.regression.predstd import wls_prediction_std
from sklearn.lin... | 24,083 | 8,782 |
from .AbstractFlaskTemplateFilter import AbstractFlaskTemplateFilter
#
# ...
#
class FlaskFilter_tagsToStr(AbstractFlaskTemplateFilter):
def __call__(self, tags:list):
if tags:
return ", ".join(tags)
else:
return ""
#
#
| 251 | 103 |
# 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.
def test_qisrc_foreach(qisrc_action, record_messages):
worktree = qisrc_action.worktree
worktree.create_project("not_in_git")
git_worktree... | 1,584 | 558 |
# SPDX-License-Identifier: Apache-2.0
# To register converter for libsvm operators, import associated modules here.
from . import SVMConverter
| 144 | 42 |
# for backwards compatibility with aspen-renderer modules
from .simplates.renderers import Factory, Renderer
Factory, Renderer # make pyflakes happy
import warnings
warnings.warn('aspen.renderers is deprecated and will be removed in a future version. '
'Please use aspen.simplates.renderers instead.', Fu... | 333 | 85 |
import pygame
import sys
import collections # for ordered dict
import pickle # for saving and loading highscores
from constants import (SCREEN_WIDTH, SCREEN_HEIGHT, RED, GREEN, GREY, BLACK, WHITE)
# class that shows, saves and loads highscores
class ScoreTable(pygame.sprite.Sprite):
# passing in bg so that it's ne... | 3,562 | 1,141 |
#!/usr/bin/env python2
import glob as glob
import os as os
import re
import shutil as shutil
import signal as signal
import subprocess as sp
import sys as sys
from lib import build
from lib import scripts
from lib import setup
from lib import analysis
ion_def = []
poses_list = []
poses_def = []
release_eq = []
trans... | 27,795 | 10,847 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-06-30 06:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mooringlicensing', '0183_auto_20210629_1156'),
]
operations = [
migrations... | 693 | 245 |
from pathlib import Path
from typing import Optional, Tuple
import typer
from onlinejudge import utils
from pydantic.networks import HttpUrl
from pydantic.types import DirectoryPath
from judge.schema import JudgeConfig
from judge.tools.download import DownloadArgs, LoginForm, SaveArgs
from judge.tools.download import... | 3,188 | 958 |
import re
import difflib
from ansible import errors
def diff(pre_change, post_change=''):
try:
netdiff = list(
difflib.unified_diff(
pre_change.splitlines(),
post_change.splitlines()
)
)
if netdiff:
header = ''.join(netdif... | 682 | 193 |
from django.urls import path
from .api.view import get_all_countries_view
app_name = "core"
urlpatterns = [
path('all-countries', get_all_countries_view)
]
| 161 | 58 |