text
string
size
int64
token_count
int64
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import sys import json import urllib2 import codecs BASE_DIR = os.path.dirname(__file__) BASE_URL = 'https://www.googleapis.com/youtube/v3/' API_CHANNELS = 'channels' API_PLAYLIST = 'playlistItems' API_KEY = 'YOUR KEY' CHANNELS = [ 'videos...
4,367
1,477
#!/usr/bin/env python3 from sklearn.tree import DecisionTreeClassifier import pickle import numpy as np no = [b'runc:[2:INIT]', b'containerssh-ag', b'apt',b'dpkg'] class model: def __init__(self): self.d = DecisionTreeClassifier() def load(self, filename = 'model.p'): try: f = open(filename, 'rb') self...
2,744
1,290
import os import numpy as np from scipy.io import loadmat data = loadmat("data/hipp_2dtrack_a/smJun03p2.dat") N = 49 data = reshape(data, 3, length(data)/3); data = data'; size(data) % 43799-by-3 fclose(fid); % sampling time Ts = 0.0333; duration = size(data,1) * Ts; % in second Tmax = data(end, 3); Tmin = d...
1,318
585
# Copyright 2017 Netflix, 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...
9,455
3,195
import rospy from sensor_msgs.msg import Image from std_msgs.msg import String from cv_bridge import CvBridge import cv2 import numpy as np import tensorflow as tf import classify_image class RosTensorFlow(): def __init__(self): classify_image.maybe_download_and_extract() self._session = tf.Sessio...
1,838
610
# Copyright (C) 2020-2021 by TeamSpeedo@Github, < https://github.com/TeamSpeedo >. # # This file is part of < https://github.com/TeamSpeedo/FridayUserBot > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/TeamSpeedo/blob/master/LICENSE > # # All rights reserved. imp...
21,202
7,336
""" FEEDS Handles YouTube and Twitch feed notifications. """ import datetime as dt import discord import feedparser from apscheduler.triggers.cron import CronTrigger from discord.ext import commands from carberretta import Config from carberretta.utils import DEFAULT_EMBED_COLOUR, chron LIVE_EMBED_COLOUR = 0x9146FF...
16,809
4,680
"""Provides a GDB logging proxy. See https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html See https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html """ from __future__ import annotations import logging import socket from typing import Optional from typing import Tuple from .pa...
5,676
1,730
from openems.openems import * # A simple simulation # # FDTD Simulation Setting # F = FDTD() F.add(Exc(typ='Sinus',f0=100000)) F.add(BoundaryCond(['PMC','PMC','PEC','PEC','MUR','MUR'])) # # CSX (Geometry setting) # C = CSX() # The Box is added as a property C.add(Excitation('excitation'),p=Box(P1=[-10,-10,0],P2=...
1,373
779
import numpy as np def segment_Y(Y, **params): Y_segments = params.get("Y_segments") Y_quantile = params.get("Y_quantile") print("segmenting Y") Y = Y.values.reshape(-1) Y_quantile = np.quantile(Y, Y_quantile, axis = 0) bigger_mask = (Y > Y_quantile).copy() smaller_mask = (Y <= Y_quantile).copy() Y[bigger_...
381
173
import mysql.connector import random from voice import synthetize_voice, delete_wav def AllQuestionAI(id_theme): i = 0 #CONNEXION A LA BDD conn = mysql.connector.connect(host="localhost", user="phpmyadmin", password="Vince@Mysql1997", ...
3,868
1,134
import numpy def lax_friedrichs(cons_minus, cons_plus, simulation, tl): alpha = tl.grid.dx / tl.dt flux = numpy.zeros_like(cons_minus) prim_minus, aux_minus = simulation.model.cons2all(cons_minus, tl.prim) prim_plus, aux_plus = simulation.model.cons2all(cons_plus , tl.prim) f_minus = simulation.m...
875
327
import re import json import base64 import codecs import os.path import asyncio import subprocess _PREFIX = 'docker-credential-' def read_config(): path = os.path.expanduser('~/.docker/config.json') if not os.path.exists(path): return {} with codecs.open(path, encoding='utf-8') as f: jso...
2,084
679
""" Transform the data into a form that works with the WELL_REGISTRY_STG table. """ import re def mapping_factory(mapping): def map_func(key): if key is not None: ora_val = mapping.get(key.lower()) else: ora_val = None return ora_val return map_func WELL_TYPES...
5,199
2,107
# Created by shamilsakib at 04/10/20 BASE_MODEL = None
55
27
__author__ = "Zafar Ahmad, Mohammad Mahdi Javanmard" __copyright__ = "Copyright (c) 2019 Tealab@SBU" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Zafar Ahmad" __email__ = "zafahmad@cs.stonybrook.edu" __status__ = "Development" import numpy as np import numba as nb ''' Iterative kernels ''' def up...
1,543
657
from terra_sdk.exceptions import LCDResponseError from terrakg import logger # Logging from terrakg.client import ClientContainer logger = logger.get_logger(__name__) class Rates: """ Access the most recent rates. """ def __init__(self, client: ClientContainer): self.client = client de...
1,343
376
import bpy import os, glob from pathlib import Path from enum import Enum from abc import ABC, abstractmethod import csv from . import keying_module def export_tracking_data(self, context): clip = context.space_data.clip clip_name = os.path.splitext(clip.name)[0] tracker_name = context.scene.tracking_loca...
2,868
916
import clr clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * def GetViewTemplate(view): if not view: return None elif hasattr(view, "ViewTemplateId"): if view.ViewTemplateId.IntegerValue == -1: return None else: return view.Document.GetElement(view.ViewTemplateId) else: return None views = UnwrapEle...
437
152
#!/usr/bin/python # ***************************************************************************** # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The A...
8,267
2,605
test = """forward 5 down 5 forward 8 up 3 down 8 forward 2 """ def part1(lines): h = 0 d = 0 for line in lines: direction, delta = line.split() delta = int(delta) if direction == 'forward': h += delta elif direction == 'down': d += delta elif...
931
306
# Generated by Django 3.1.3 on 2020-11-09 08:56 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Associations', fields=[ ('id', models.AutoF...
693
210
"""Test PDS times modules.""" from datetime import datetime as dt from pyvims.pds.times import (cassini2utc, cassini_time, dt_date, dt_doy, dt_iso, dyear, pds_folder, pds_time, utc2cassini) from pytest import approx, raises def test_dt_iso(): """Test parsing ISO time pattern.""" ...
4,631
2,795
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('mail', '0108_auto_20171130_1004'), ] operations = [ migrations.AlterModelOptions( name='relaysenderwhitelist', ...
626
277
#!/usr/bin/env python """Schema validation of ansible-core's ansible_builtin_runtime.yml and collection's meta/runtime.yml""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type import datetime import os import re import sys from distutils.version import StrictVersion, LooseVersion ...
11,168
3,221
#!/usr/bin/env python from flexbe_core import EventState, Logger from flexbe_core.proxy import ProxyActionClient # example import of required action from o2ac_msgs.msg import AlignBearingHolesAction, AlignBearingHolesGoal class AlignBearingHolesActionState(EventState): ''' Actionlib for aligning the bearing ...
2,160
604
#!/usr/bin/env python3 """Find unicode control characters in source files By default the script takes one or more files or directories and looks for unicode control characters in all text files. To narrow down the files, provide a config file with the -c command line, defining a scan_exclude list, which should be a l...
6,710
2,101
import numpy as np from igibson.external.pybullet_tools.utils import aabb_union, get_aabb, get_all_links from igibson.object_states.object_state_base import CachingEnabledObjectState class AABB(CachingEnabledObjectState): def _compute_value(self): body_id = self.obj.get_body_id() all_links = get_...
1,529
516
# (C) Datadog, Inc. 2010-2017 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) from __future__ import unicode_literals import time from datetime import datetime import mock import pytest from mock import MagicMock from pyVmomi import vim from datadog_checks.vsphere import VSphereCheck from...
34,187
10,647
MANDRILL_API_KEY = 'MANDRILL_API_KEY' UNSET_MANDRILL_API_KEY_MSG = f"Mandrill API key not set in environment variable {MANDRILL_API_KEY}" CONTACT_LIST_QUERY = """ SELECT * FROM `{{project}}.{{dataset}}.{{contact_table}}` """ EHR_OPERATIONS = 'EHR Ops' EHR_OPS_ZENDESK = 'support@aou-ehr-ops.zendesk.com' DATA_CURATION_...
2,147
791
import os import argparse from pathlib import Path CLIP_FILE = os.path.join(Path.home(), '.clip') TEMP_FILE = '.TEMP_FILE' def add_text(key, text): if os.path.exists(CLIP_FILE): open_mode = 'a' else: open_mode = 'w+' with open(CLIP_FILE, open_mode) as clip_file: clip_file.write(ke...
2,110
717
from typing import List, Tuple from gama.genetic_programming.nsga2 import ( NSGAMeta, fast_non_dominated_sort, crowding_distance_assignment, ) def _tuples_to_NSGAMeta(tuples: List[Tuple]) -> List[NSGAMeta]: """ Converts a list of tuples to NSGAMeta objects. """ # Can't declare it directly in a loo...
2,383
905
# File taken from https://github.com/Ouranosinc/pavics-vdb/blob/master/catalog/tds.py """Utility function to parse metadata from a THREDDS Data Server catalog.""" def walk(cat, depth=1): """Return a generator walking a THREDDS data catalog for datasets. Parameters ---------- cat : TDSCatalog T...
2,738
878
# -*- coding: utf-8 -*- """ Module containing miscellaneous utility functions. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import collections import itertools import numpy as np class BinaryTree(object): def __init__(self): self.left...
4,484
1,304
import numpy as np import random from collections import namedtuple def generate_prob_matrix(n): matrix = np.random.rand(n, n) for i in range(n): matrix[i][i] = 0 for i in range(n): matrix[i] = (1/np.sum(matrix[i]))*matrix[i] return matrix def categorical(p): return np.random...
3,893
1,331
# Copyright 2022 The Orbit 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 applicable l...
1,325
393
#!/usr/bin/python ################################################################################ # DOCUMENTS # # Justin Dierking # justin.l.dierking.civ@mail.mil # 614 692 2050 # # 04/22/2018 Original Construction ################################################################################ import traceback impor...
880
252
import vigra import numpy import pylab from seglib import cgp2d from seglib.preprocessing import norm01 import seglib.edge_detectors.pixel as edp import seglib.region_descriptors.pixel as rdp from seglib.preprocessing import norm01 from seglib.histogram import jointHistogram,histogram from seglib.region_descriptors.p...
1,932
805
from datetime import date from django.conf import settings from django.db import models # Create your models here. def user_directory_path(instance, filename): # file will be uploaded to MEDIA_ROOT/user_<id>/<filename> today = date.today() return '{0}/{2}/{1}'.format(instance.user.username, filename, toda...
748
247
#-*- coding:utf-8 -*- # &Author AnFany # 引入方法 import Kmeans_AnFany as K_Af # AnFany import Kmeans_Sklearn as K_Sk # Sklearn import matplotlib.pyplot as plt from pylab import mpl # 作图显示中文 mpl.rcParams['font.sans-serif'] = ['FangSong'] # 设置中文字体新宋体 mpl.rcParams['axes.unicode_minus'] = False import numpy as...
2,713
1,440
#!/usr/bin/env python """ Control panel file """ import pddl_solver as pddl import ik import rospy from get_object_position import get_object_position import time from constants import * from spawn_models import reset_model_position, reset_all, spawn_model, spawn_all_models from delete_models import delete_all, de...
5,544
1,794
from Enigma.Rotor import Rotor from Enigma.Reflector import Reflector from Enigma.Plugboard import Plugboard class Enigma: def __init__(self , rotors = [ Rotor(0,"IC") , Rotor(0,"IIC") , Rotor(0,"IIIC") ] , plugboard = Plugboard() , reflector = Reflector("A")): self.rotors = rotors for i in r...
1,427
447
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Exiv2(CMakePackage): """Exiv2 is a Cross-platform C++ library and a command line utility ...
647
280
import math from django.contrib.auth import get_user_model from django.contrib.sites.shortcuts import get_current_site from django.core.mail import send_mail from django.template import loader from magicauth import settings as magicauth_settings from django.conf import settings as django_settings from magicauth.model...
2,711
809
import os import sys ## {{{ http://code.activestate.com/recipes/52224/ (r1) def search_file(filename, search_path): """Given an os.pathsep divided `search_path`, find first occurrence of `filename`. Returns full path to file if found or None if unfound. """ file_found = False paths = search_path....
2,148
665
import pytest import tensorflow as tf from deepctr.estimator import DCNEstimator from deepctr.models import DCN from ..utils import check_model, get_test_data, SAMPLE_SIZE, get_test_data_estimator, check_estimator, \ Estimator_TEST_TF1 @pytest.mark.parametrize( 'cross_num,hidden_size,sparse_feature_num,cross...
2,380
853
import os import subprocess import backoff class GSUtilResumableUploadException(Exception): pass def _decode_to_str_if_bytes(s, encoding="utf-8"): if isinstance(s, bytes): return s.decode(encoding) else: return s def authenticate(): try: credentials = os.environ["GOOGLE_AP...
1,309
425
import argparse from deploy_tix.bugzilla_rest_client import BugzillaRESTClient from deploy_tix.release_notes import ReleaseNotes from output_helper import OutputHelper def main(args=None): parser = argparse.ArgumentParser( description='Scripts for creating / updating deployment tickets in \ Bugzi...
3,012
875
from visual import * print(""" Click to place spheres under falling string. Right button drag or Ctrl-drag to rotate view. Middle button drag or Alt-drag to zoom in or out. On a two-button mouse, middle is left + right. """) # David Scherer scene.title = "Drape" restlength = 0.02 m = 0.010 * restlengt...
2,583
1,116
# ***************************************************************************** # Copyright (c) 2020, Intel Corporation All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of sou...
8,921
2,752
from math import sqrt # Naive method: Loop through N and check if every number is prime or not. If prime add to sum. Time complexity is O(√n). Time of execution ~ 8sec for n = 1000000 def prime(n): yield 2 yield 3 for p in range(5, n+1, 2): if p % 3 == 0: continue else: ...
1,074
447
import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester l1EmulatorErrorFlagClient = DQMEDHarvester("L1EmulatorErrorFlagClient", # # for each L1 system, give: # - SystemLabel: system label # - HwValLabel: system label as used in hardware validation ...
3,891
1,023
""" The SQLAlchemy table objects for the CodaLab bundle system tables. """ # TODO: Replace String and Text columns with Unicode and UnicodeText as appropriate # This way, SQLAlchemy will automatically perform conversions to and from UTF-8 # encoding, or use appropriate database engine-specific data types for Unicode # ...
17,382
5,375
# (c) 2020 Nokia # # Licensed under the BSD 3 Clause license # SPDX-License-Identifier: BSD-3-Clause # from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = """ --- author: - "Hans Thienpondt (@HansThienpondt)" - "Sven Wisotzky (@wisotzky)" connection: gnmi short_...
31,403
8,358
#!/usr/bin/python # Software License Agreement (BSD License) # # Copyright (c) 2009-2011, Eucalyptus Systems, Inc. # All rights reserved. # # Redistribution and use of this software in source and binary forms, with or # without modification, are permitted provided that the following conditions # are met: # # Redistri...
4,056
1,281
MAP = 1 SPEED = 1.5 VELOCITYRESET = 6 WIDTH = 1280 HEIGHT = 720 X = WIDTH / 2 - 50 Y = HEIGHT / 2 - 50 MOUSER = 325 TICKRATES = 120 nfc = False raspberry = False
173
108
# This problem was asked by Facebook. # # A builder is looking to build a row of N houses that can be of K different colors. # He has a goal of minimizing cost while ensuring that no two neighboring houses are of the same color. # # Given an N by K matrix where the nth row and kth column represents the cost to build th...
401
104
import argparse import numpy as np import os import sys import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) from saliency.visualizer.smiles_visualizer import SmilesVisualizer def visualize(dir_path): ...
4,521
1,671
# # jQuery File Tree # Python/Django connector script # By Martin Skou # import os import urllib def dirlist(request): r=['<ul class="jqueryFileTree" style="display: none;">'] try: r=['<ul class="jqueryFileTree" style="display: none;">'] d=urllib.unquote(request.POST.get('dir','c:\\temp')) f...
853
307
#!/usr/bin/env python3 import torch from .lazy_tensor import LazyTensor from .root_lazy_tensor import RootLazyTensor from .. import settings class CholLazyTensor(RootLazyTensor): def __init__(self, chol): if isinstance(chol, LazyTensor): # Probably is an instance of NonLazyTensor chol = cho...
1,639
568
# File: A (Python 2.4) from pandac.PandaModules import AudioSound from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import LerpFunc, Sequence from direct.showbase.DirectObject import DirectObject class AmbientSound: notify = DirectNotifyGlobal.directNotify.newCategory('Ambient...
5,765
1,699
import import_target print import_target.x import import_target import_target.foo() c = import_target.C() print import_target.import_nested_target.y import_target.import_nested_target.bar() d = import_target.import_nested_target.D() print "testing importfrom:" from import_target import x as z print z import_nested...
890
284
import numpy as np from PySide2.QtCore import QSignalBlocker, Signal from PySide2.QtWidgets import QGridLayout, QWidget from hexrd.ui.scientificspinbox import ScientificDoubleSpinBox DEFAULT_ENABLED_STYLE_SHEET = 'background-color: white' DEFAULT_DISABLED_STYLE_SHEET = 'background-color: #F0F0F0' INVALID_MATRIX_STY...
6,801
2,148
from django.conf.urls.defaults import * urlpatterns = patterns('pytorque.views', (r'^$', 'central_dispatch_view'), (r'^browse$', 'central_dispatch_view'), (r'^monitor$', 'central_dispatch_view'), (r'^submit$', 'central_dispatch_view'), (r'^stat$', 'central_dispatch_view'), (r'^login/$', 'login...
674
292
from typing import Tuple, Union, Any, Sequence from collections import deque, defaultdict, OrderedDict from ...validators.one import JustLen from ...functional.mixins import CompositionClassMixin from ..one import Just dict_keys = type({}.keys()) odict_keys = type(OrderedDict({}).keys()) dict_values = type({}.values()...
3,616
1,045
# Copyright (C) 2014-2016 Cuckoo Foundation. # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org # See the file 'docs/LICENSE' for copying permission. from lib.api.process import Process from lib.exceptions.exceptions import CuckooPackageError class Package(object): """Base abstract analysis pack...
2,019
566
from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class OptionsConfig(AppConfig): name = 'rdmo.options' verbose_name = _('Options')
182
56
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from main import models class Admin(UserAdmin): list_display = ("id", "username", "email", "date_joined", "last_login") admin.site.register(models.User, Admin) class DocumentAdmin(admin.ModelAdmin): list_display = ("id", "ti...
380
116
#!/usr/bin/python # -*- coding: utf-8 -*- import sys from abc import ABCMeta, abstractmethod from collections import defaultdict from cloudshell.cli.factory.session_factory import ( CloudInfoAccessKeySessionFactory, GenericSessionFactory, SessionFactory, ) from cloudshell.cli.service.cli import CLI from cl...
3,501
986
def main(): n = 111 gen = (n * 7 for x in range(10)) if 777 in gen: print("Yes!") if __name__ == '__main__': main()
142
64
import json import logging import joblib import pandas as pd from flask import Flask, jsonify, request from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app) @app.route("/api/machinePrediction", methods=['GET']) def home(): incomingMachineId = request.args.get('machineId') modelPath = requ...
1,090
356
import pytest from PySide2.QtGui import QVector3D from nexus_constructor.model.component import Component from nexus_constructor.model.dataset import Dataset from nexus_constructor.model.instrument import Instrument from nexus_constructor.model.value_type import ValueTypes values = Dataset( name="scalar_value", ...
4,411
1,542
#!/usr/bin/env python import argparse import os.path as osp import logging import time import sys sys.path.insert(0, osp.dirname(__file__) + '/..') import torch import torch.nn as nn from fastmvsnet.config import load_cfg_from_file from fastmvsnet.utils.io import mkdir from fastmvsnet.utils.logger import setup_logger...
11,013
3,295
# Estrutura básica para projetos de Machine Learning e Deep Learning # Por Adriano Santos. from torch import nn, relu import torch.nn.functional as F import torch.optim as optim import torch from torchvision import models class ResNet(nn.Module): def __init__(self, saida, pretreinado=True): super(ResNet,...
857
314
#!/usr/bin/env python # Copyright (c) 2017, Simon Brodeur # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, th...
3,231
985
import pygame from loguru import logger from somegame.osd import OSD class FpsOSD(OSD): def __init__(self, game): super().__init__(game) logger.info('Loading font') self.font = pygame.font.Font(pygame.font.get_default_font(), 32) def draw(self, surface): fps = self.game.get_a...
530
203
# # Copyright 2016 The BigDL Authors. # # 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 ...
11,846
3,747
import json import tornado.gen import traceback from base64 import b64encode from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPError from settings import Settings from mongo_db_controller import ZoomUserDB @tornado.gen.coroutine def zoomRefresh(zoom_user): url = "https://zoom.us/oauth/token" p...
2,603
815
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from crypten.mpc import primitives # noqa: F401 from crypten.mpc import provider # noqa: F40 from .conte...
1,484
479
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from pyflakes.checke...
2,011
710
from django.db import models from django.contrib.auth.models import User from django.contrib import admin from django.utils.translation import ugettext_lazy as _ class Forum(models.Model): title = models.CharField(max_length=60) description = models.TextField(blank=True, default='') updated = models.DateTi...
2,426
784
import time from fabric.api import run, env, task, put, cd, local, sudo env.use_ssh_config = True env.hosts = ['iota_node'] @task(default=True) def iri(): run('mkdir -p /srv/private-tangle/') with cd('/srv/private-tangle'): put('.', '.') run('docker-compose --project-name private-tangle pull'...
1,744
581
import sqlite3 from random import randint, choice import numpy as np conn = sqlite3.connect('ej.db') c = conn.cursor() #OBTENIENDO TAMAnOS MAXIMOS MINIMOS Y PROMEDIO# c.execute('SELECT MAX(alto) FROM features') resultado = c.fetchone() if resultado: altoMax = resultado[0] c.execute('SELECT MIN(alto) FROM featu...
1,763
689
from pylab import * import cython import time, timeit from brian2.codegen.runtime.cython_rt.modified_inline import modified_cython_inline import numpy from scipy import weave import numexpr import theano from theano import tensor as tt tau = 20 * 0.001 N = 1000000 b = 1.2 # constant current mean, the modul...
5,503
2,495
from .banks import callback_view, go_to_bank_gateway from .samples import sample_payment_view, sample_result_view
114
35
#!/usr/bin/env python # encoding: utf-8 """ update.py Created by Thomas Mangin on 2009-09-06. Copyright (c) 2009-2013 Exa Networks. All rights reserved. """ import unittest from exabgp.configuration.environment import environment env = environment.setup('') from exabgp.bgp.message.update.update import * from exabgp...
3,254
1,833
# nuScenes dev-kit. # Code written by Holger Caesar & Oscar Beijbom, 2018. # Licensed under the Creative Commons [see licence.txt] import argparse import json import os import random import time from typing import Tuple, Dict, Any import numpy as np from nuscenes import NuScenes from nuscenes.eval.detection.algo imp...
12,082
3,632
import unittest from onlinejudge_api.main import main class DownloadAtCoderTest(unittest.TestCase): def test_icpc2013spring_a(self): """This problem contains both words `Input` and `Output` for the headings for sample outputs. """ url = 'http://jag2013spring.contest.atcoder.jp/tasks/icpc...
9,520
3,297
#!/usr/bin/env python3 # This file is part of ODM and distributed under the terms of the # MIT license. See COPYING. import json import sys import odm.cli def main(): cli = odm.cli.CLI(['action']) client = cli.client if cli.args.action == 'list-users': print(json.dumps(client.list_users(), ind...
681
237
# Copyright (c) 2014 Ahmed H. Ismail # 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...
17,182
6,229
# Standard library imports from subprocess import call as subprocess_call from utility import fileexists from time import sleep as time_sleep from datetime import datetime mount_try = 1 not_yet = True done = False start_time = datetime.now() if fileexists("/home/rpi4-sftp/usb/drive_present.txt"): when_usba...
2,024
814
from django.http.response import HttpResponse from django.shortcuts import render from django.shortcuts import redirect, render from cryptography.fernet import Fernet from .models import Book, UserDetails from .models import Contact from .models import Book from .models import Report from .models import Diagnostic from...
5,639
1,521
class BaseStorageManager(object): def __init__(self, adpter): self.adapter = adpter def put(self, options): try: return self.adapter.put(options) except Exception: raise Exception('Failed to write data to storage') def get(self, options): try: ...
1,028
254
from __future__ import with_statement import os import sys from mock import Mock from django.template import Template, Context, TemplateSyntaxError from django.test import TestCase from compressor.conf import settings from compressor.signals import post_compress from compressor.tests.base import css_tag, test_dir ...
9,892
3,103
from ...address_translator import AT from ...errors import CLEOperationError from . import Relocation import struct import logging l = logging.getLogger('cle.relocations.generic') class GenericAbsoluteReloc(Relocation): @property def value(self): return self.resolvedby.rebased_addr class GenericAbsol...
3,324
1,020
# Copyright (c) 2010-2014 openpyxl import pytest from openpyxl.styles.borders import Border, Side from openpyxl.styles.fills import GradientFill from openpyxl.styles.colors import Color from openpyxl.writer.styles import StyleWriter from openpyxl.tests.helper import get_xml, compare_xml class DummyWorkbook: st...
1,438
483
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('ringapp', '0008_auto_20150116_1755'), ] operations = [ migrations.AlterModelTable( name='invariance', ...
477
154
from unittest import TestCase from io import StringIO import json class TestDump(TestCase): def test_dump(self): sio = StringIO() json.dump({}, sio) self.assertEquals(sio.getvalue(), '{}') def test_dumps(self): self.assertEquals(json.dumps({}), '{}') def test_encode_truef...
654
231
import sys class RPCType(object): CloseRPC = 0 DetachRPC = 1 AddWindowRPC = 2 DeleteWindowRPC = 3 SetWindowLayoutRPC = 4 SetActiveWindowRPC = 5 ClearWindowRPC = 6 ClearAllWindowsRPC = 7 OpenDatabaseRPC = 8 CloseDatabaseRPC = 9 Acti...
7,069
2,511
# -*- coding: utf-8 -*- # # Tencent is pleased to support the open source community by making QT4C available. # Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. # QT4C is licensed under the BSD 3-Clause License, except for the third-party components listed below. # A copy of the BSD 3-Cla...
774
272