text
string
size
int64
token_count
int64
# Copyright 2021 NVIDIA Corporation # # 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 wr...
2,492
1,103
# coding: utf-8 """ SQE API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: v1 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from qumra...
29,250
9,196
import numpy as np from nengo_spa.algebras.hrr_algebra import HrrAlgebra from nengo.utils.numpy import is_number class HrrAlgebra(HrrAlgebra): def fractional_bind(self, A, b): """Fractional circular convolution.""" if not is_number(b): raise ValueError("b must be a scalar.") re...
569
209
import socket from _thread import * import pickle from board import Board import time hostname = socket.gethostname() ipAddr = socket.gethostbyname(hostname) print(ipAddr) server = ipAddr port = 5556 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.bind((server, port)) except socket.error as e: ...
2,234
723
import wikihowunofficialapi as wha ra = wha.random_article() print(ra)
72
28
import numpy as np import pandas as pd from nilmtk import TimeFrame import datetime import matplotlib.pyplot as plt # transients['active transition'].cumsum().resample('2s', how='ffill').plot() class GaussianStateMachines(object): """ This class is a basic simulator, which creates sample loads by randomizing...
11,341
3,485
# Generated by Django 3.1.2 on 2020-10-14 07:15 import cloudinary.models from django.db import migrations import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('my_gallery', '0005_auto_20201013_0828'), ] operations = [ migrations.AddField( mod...
543
187
import logging from threading import RLock from typing import Callable, Tuple, TypeVar import schedule import ts3 from ts3.query import TS3ServerConnection from bot.config import Config LOG = logging.getLogger(__name__) R = TypeVar('R') def default_exception_handler(ex): """ prints the trace and returns the e...
9,713
2,552
"""Reachy submodule responsible for low-level IO.""" from .io import IO # noqa F401
87
32
import pandas as pd from context import * from cordis_search import wrapper as wr TEST_PROJECTS_FILE = pd.read_csv(RESOURCES_FOLDER+"fp7_test_projects.csv", sep=";") print(TEST_PROJECTS_FILE) def test_search(): query = "multiculturalism" selected_projects = wr.search(TEST_PROJECTS_FILE, query) assert se...
453
167
import numpy as np from dpsniper.mechanisms.abstract import Mechanism class NoisyHist1(Mechanism): """ Alg. 9 from: Zeyu Ding, YuxinWang, GuanhongWang, Danfeng Zhang, and Daniel Kifer. 2018. Detecting Violations of Differential Privacy. CCS 2018. """ def __init__(self, eps: float = 0....
1,067
426
from ..core import OrthodoxCalendar from ..registry_tools import iso_register @iso_register('GE') class Georgia(OrthodoxCalendar): 'Country of Georgia' "Sources: " "https://en.wikipedia.org/wiki/Public_holidays_in_Georgia_(country)" "https://www.officeholidays.com/countries/georgia/2021" include...
1,122
423
import os from distutils.dir_util import copy_tree from invoke import task, run import shutil class SplunkbaseReleaser: DIRS_TO_ARCHIVE = ['appserver', 'bin', 'certs', 'default', 'metadata', 'README', 'static'] APP_NAME = 'amp4e_events_input' PATH_TO_PYTHON_LIBS = '/opt/splunk/lib/python3.7/site-packages' ...
3,471
1,256
from typing import List class sort: def quick(self, nums:List[int]) -> List[int]: if len(nums) >= 2: base = nums[-1] # 选取基准值,可以为任何值 left, right = [], [] nums = nums[:-1] for num in nums: if num >= base: # 大于等于基准值的数存于right ...
2,502
980
import datetime as dt import numpy as np def calculate_ranges(dataset): arr = np.array(dataset) mean = np.mean(arr, axis=0) min = np.min(arr, axis=0) max = np.max(arr, axis=0) ranges = np.array((min, mean, max)).T return ranges class Record: def __init__(self): self.time_date =...
6,622
2,352
import FWCore.ParameterSet.Config as cms # TrackerTrajectoryBuilders from RecoTracker.CkfPattern.CkfTrajectoryBuilder_cff import * # TrajectoryCleaning from TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi import * # navigation school from RecoTracker.TkNavigation.NavigationSchoolESProducer_cff impor...
558
193
""" Task 3 Write an application that allows you to calculate the cost of a trip. Implement a function called hotel_cost that takes one argument, nights, as input. The hotel costs £70 per night – so return a suitable value. Implement a function called plane_ticket_cost that accepts a string, city, and a float...
3,639
1,267
import pandas as pd import numpy as np import cv2 import os import math import pickle from matplotlib import pyplot as plt from PIL import Image from matplotlib.pyplot import imshow # %matplotlib inline def rotate_image(img): # gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) gray = img edges = cv2.Canny(gray,50,150,ap...
7,050
3,238
multi = 0 list = (1 , 2 , 3) for i in list: multi = multi + i print (f'la multi total de 1 al 3 es {multi}')
123
54
# -*- coding: utf-8 -*- # pylint: disable=unused-import ############################################################################### # Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. # # All rights reserved. # # This file is part of t...
2,476
628
import logging from pathlib import Path from sys import argv import var import telethon.utils from telethon import TelegramClient from telethon import events,Button import os from var import Var from . import beast from telethon.tl import functions from beastx.Configs import Config from telethon.tl.functi...
5,358
1,957
import unittest from solutions.day02.solution import ship_computer from tests.helpers import Puzzle class DayTwoTests(unittest.TestCase): """Tests for my solutions to Day 1 of the Advent of Code 2019.""" def test_ship_computer_with_example_data(self): """Test the ship computer used for day 2 using t...
859
293
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import ode import FLC import pyprind from numpy.linalg import eig import pandas as pd def impulse(lenght): i = 0 Impulse = [] while i < lenght: if i == 99: Impulse.append(1) else: Impulse.append...
24,678
10,279
# pylint: disable=W0223 # Pylint cannot handle abstract subclasses of abstract base classes from abc import ABC import xarray as xr from pywatts.modules.wrappers.base_wrapper import BaseWrapper class DlWrapper(BaseWrapper, ABC): """ Super class for deep learning framework wrappers :param model: The de...
950
280
import os,sys Nthread = 1 os.environ["OMP_NUM_THREADS"] = str(Nthread) # export OMP_NUM_THREADS=1 os.environ["OPENBLAS_NUM_THREADS"] = str(Nthread) # export OPENBLAS_NUM_THREADS=1 os.environ["MKL_NUM_THREADS"] = str(Nthread) # export MKL_NUM_THREADS=1 os.environ["VECLIB_MAXIMUM_THREADS"] = str(Nthread) # export VECLIB_...
590
230
import cv2 import glob import random import numpy as np emotions = ["neutral", "anger", "disgust", "happy", "surprise"] fishface = cv2.face.FisherFaceRecognizer_create() #Initialize fisher face classifier data = {} def get_files(emotion): #Define function to get file list, randomly shuffle it and split 80/20 traini...
2,386
838
# python3 main.py import urllib.request import zipfile import os import shutil # @TODO change it # eg.: /var/www/blog OLD_WP_PATH = '' NEW_WP_PATH_TMP = '' if not (os.path.exists(OLD_WP_PATH)) or not (os.path.exists(NEW_WP_PATH_TMP)): os._exit(0) WP_URL = 'http://wordpress.org/latest.zip' EXTRACTED_NAME = 'wordpr...
1,109
469
import requests import time from multiprocessing.dummy import Pool def query(url): requests.get(url) start = time.time() for i in range(100): query('https://baidu.com') end = time.time() print(f'单线程循环访问100次百度,耗时:{end - start}') start = time.time() url_list = [] for i in range(100): url_list.append('http...
435
203
# Generated by Django 3.1.5 on 2021-01-28 11:59 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('hole', '0007_auto_20210126_2138'), ] operations = [ migrations.RemoveField( model_name='post', name='number', ...
702
221
# # Copyright (c) 2015-2016 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import abc import six @six.add_metaclass(abc.ABCMeta) class NFVINetworkAPI(object): """ Abstract NFVI Network API Class Definition """ @abc.abstractproperty def name(self): """ Returns th...
5,607
1,505
# DP; Time: O(n); Space: O(1) def max_subarray(nums): for i in range(1, len(nums)): if nums[i - 1] > 0: nums[i] += nums[i - 1] return max(nums) # Time: O(n); Space: O(1) def max_subarray2(nums): max_sum = nums[0] curr_sum = nums[0] for i in range(len(nums)): if curr_s...
750
344
# This file is part of the Trezor project. # # Copyright (C) 2012-2018 SatoshiLabs and contributors # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 # as published by the Free Software Foundation. # # This library is distrib...
4,696
1,718
#!/usr/bin/env python3 """ Create new FastQC zip directory with a new sample name for multiQC.""" import os import sys import logging import zipfile import tempfile import argparse __version__ = '1.0.0' def main(zipIn, zipOut, sample, **kwargs): with tempfile.TemporaryDirectory() as tmpDir: # Create...
2,881
874
from circuits.elements import ele_C as C from circuits.elements import ele_L as L from circuits.elements import ele_Warburg as WB from circuits.elements import ele_Q as Q """ 支惠在原始的几个电路基础上新加了很多简单的单路,之后有空再去合并 """ """ Define all the circuits used in this project Python 电路模型函数名 命名规则: ‘a’ == ‘(’; ‘b’ == ‘)’,直...
7,711
4,596
# Copyright 2013-2015 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 by applicable law or agreed to in w...
1,155
355
# LAPACK optimization strategy for LU factorization. from chill import * source('lu.c') procedure('lu') loop(0) TJ = 64 original() tile(1, 3, TJ, 1) split(1, 2, 'L1-L2>=2') #t2-t4>=2 permute(3, 2, [2,4,3]) # mini-LU permute(1, 2, [3,4,2]) # other than mini-LU split(1, 2, 'L2>=L1-1') # seperate MM by t4 >= t2-1 # no...
843
510
#!/usr/bin/env python # Copyright 2014 The University of Edinburgh # # 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 a...
2,204
725
import json import pandas as pd import numpy as np from urllib.request import Request, urlopen from onemap_converter import OneMapConverter def load_HDB_carpark(): converter = OneMapConverter('FJIANG003@e.ntu.edu.sg', 'XS4teTdcYz') # Load HDB Carpark Information url_HDB_carpark = 'https://data.gov.sg/api/...
6,803
2,635
"""SSEClient unit tests.""" import time import threading import pytest from splitio.push.sse import SSEClient, SSEEvent from tests.helpers.mockserver import SSEMockServer class SSEClientTests(object): """SSEClient test cases.""" def test_sse_client_disconnects(self): """Test correct initialization. ...
4,108
1,251
import os from mongo_config import questions_collection, client def get_relative_path(*args): return os.path.join(os.path.dirname(os.path.abspath(__file__)), *args) questions_collection.delete_many({}) # clears all questions in MongoDB question_objects = [] lines = [line[:-1] for line in open(get_relative_path(...
859
269
import numpy as np import random from plyfile import PlyData, PlyElement import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from pyntcloud import PyntCloud import os import sys import re def shuffle_data(training_data): np.random.shuffle(training_data) return training_data def save_poin...
2,429
865
"""Encoder-decoder model.""" from typing import List, Tuple, Union import torch import torch.nn as nn from encoder import Encoder, VanillaEncoder from decoder import Decoder, VanillaDecoder T = torch.Tensor def compute_attention_entropy( att_matrix: T, query_mask: T) -> float: # att matrix is: batch ...
7,474
2,331
#!/usr/bin/env python # # Copyright 2019 Rickard Armiento # # This file is part of a Python candidate reference implementation of # the optimade API [https://www.optimade.org/] # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "...
2,638
826
import functools import json as json_pkg # avoid conflict name with json argument employed for some function import os from distutils.version import LooseVersion from typing import TYPE_CHECKING from urllib.parse import urlparse import mock import requests import requests.exceptions from pyramid.httpexceptions import...
29,288
8,395
from django.utils import timezone from django_extensions.management.jobs import BaseJob from ..models import Player, Guild def update_guild(ally_code): should_execute = False try: player = Player.objects.get(ally_code=ally_code) guild = player.guild; since_last_update = timezone.now()...
764
259
import logging import secrets import string from typing import Awaitable, Callable, List from saleor_app.conf import get_settings from saleor_app.errors import InstallAppError from saleor_app.graphql import GraphQLError, get_executor, get_saleor_api_url from saleor_app.mutations import CREATE_WEBHOOK from saleor_app.s...
1,907
585
# 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...
64,465
19,502
#!/usr/bin/env python3 import random import time from scapy.all import IP, TCP, send from threading import Thread # Import modules for SYN flood import tools.randomData as randomData def SYN_ATTACK(threads, attack_time, target): # Finish global FINISH FINISH = False target_ip = target.split(":")[0] target_port ...
1,410
657
import time import datetime as dt from pathlib import Path from tkinter import messagebox import re import niq_misc import math import traceback from niq_misc import replace_entry def check_valid_vertex_file(gui): """ Checks user-provided vertex selection file (HTML) for issues that could cause errors wi...
19,405
5,289
if __name__ == '__main__': def _xrobot_get_connection_filename(): import argparse parser = argparse.ArgumentParser() parser.add_argument('-f', help='Jupyter kernel connection filename') args, unknown = parser.parse_known_args() return args.f from xrobot import launch as ...
395
118
import itertools import numpy as np from . import common class Interpolator: def __init__(self, resolution=1024, width=128): self.width = width self.resolution = resolution N = resolution * width u = np.arange(-N, N, dtype=float) window = np.cos(0.5 * np.pi * u / N) **...
2,977
903
import os import json import datetime from easydict import EasyDict as edict from django.conf import settings from rando import logger from rando.core import classproperty class JSONManager(object): def __init__(self, klass=object, filepath='', language=None, use_tmp=False): self.klass = klass s...
2,913
864
''' Dungeon object class created 2019-03-19 by NGnius ''' # import math import random DEFAULT_SIZE = 16 WIDTH = 42 ANIMATION_CHAR = '*' BLANK_CHAR = '.' PORTAL_CHAR = '0' class Dungeon(): def __init__(self, size=DEFAULT_SIZE, level=1): self.WIDTH = WIDTH self.size = size self.level = leve...
3,741
1,226
# coding: utf-8 f = open("test.txt", mode="r+") f.write("hello world") f.flush() f.truncate(f.tell()) f.close()
113
53
# -*- coding: utf-8 -*- import unicodedata import json import arrow import scrapy from scrapyproject.showingspiders.showing_spider import ShowingSpider from scrapyproject.items import (ShowingLoader, init_show_booking_loader) from scrapyproject.utils import TohoUtil class TohoV2Spider(ShowingSpider): """ Toho...
10,917
3,671
from invoke import task @task() def clean(ctx): """ Delete 'build' folder. """ print("Cleaning!") ctx.run("rm -Rf build") @task( help = { 'cclean': "Call Clean task (Delete 'build' folder) before build again." } ) def build(ctx, cclean=False): """ Build Fortran95 code. """ if cclean: ...
947
417
from aristotle_mdr.apps import AristotleExtensionBaseConfig class AristotleJSONEditorConfig(AristotleExtensionBaseConfig): name = 'aristotle_json_editor' verbose_name = "Aristotle JSON Editor"
203
65
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from .exponentiated_gradient import ExponentiatedGradient # noqa: F401 from .exponentiated_gradient import ExponentiatedGradientResult # noqa: F401 __all__ = [ "ExponentiatedGradient", "ExponentiatedGradientResult"...
323
107
# -*- coding: utf-8 -*- from akagi.contents import s3_content from akagi.contents import local_file_content from akagi.contents import spreadsheet_content from akagi.contents import url_content from akagi.contents.s3_content import S3Content from akagi.contents.local_file_content import LocalFileContent from akagi.co...
423
119
from collections import defaultdict from collections import deque from typing import Deque from typing import Dict from typing import Iterable from typing import List from advent.load import read_input def op(code: int, size: int, write=False): def wrapper(f): f.op = code f.size = size f....
4,313
1,415
num = int(input('Escreva um digito:')) soma=0 while num > 0 digito = num%10 # obtem algarismo unidades num = num // 10 # remove algarismo unidades if digito % 2 == 0: #par soma = soma + digito print(soma)
225
90
class ULeagueRequestError(Exception): """ Basic exception for all requests """ def __init__(self, message): self.message = message super().__init__(self.message) def __str__(self): return "Произошла ошибка во время выполнения запроса на ULeague --> {}".format( s...
342
97
from django.db import models # Create your models here. class Story(models.Model): user_input = models.CharField(max_length=600) api_response = models.CharField(max_length=2000, null=True, blank=True) #timestamp=models.DateTimeField created_at = models.DateTimeField(auto_now_add=True) username = mo...
644
210
#!/usr/bin/env python3 import os import sys import argparse import re import shutil import numpy as np from netCDF4 import Dataset """This script is useful for finding the best find from the `optimize.log` file, the getting the parameters for this fit from logged results""" # Parse the input arguments parser = argpar...
3,123
1,059
import spotipy_twisted birdy_uri = 'spotify:artist:2WX2uTcsvV5OnS0inACecP' spotify = spotipy_twisted.Spotify() results = spotify.artist_albums(birdy_uri, album_type='album') albums = results['items'] while results['next']: results = spotify.next(results) albums.extend(results['items']) for album in albums:...
347
133
# # PySNMP MIB module CISCO-ATM-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ATM-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:50:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
21,737
9,305
# ckwg +28 # Copyright 2018 by Kitware, 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: # # * Redistributions of source code must retain the above copyright notice, # this list of conditi...
4,905
1,883
import math import numpy as np import scipy.constants as sp import copy import time X = 0 # Cartesian indices Y = 1 L = 0 # Lower U = 1 # Upper def gaussian(x, delay, spread): return np.exp( - ((x-delay)**2 / (2*spread**2)) ) def subsId(id): if id is None: return -1 else: return id-1 cl...
6,421
2,180
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys, traceback import threading import time from PyQt4 import QtGui,QtCore from boardlet import Boardlet from modellet import Modellet class MyTicker(Boardlet): def __init__(self, parent, getbidobj, getaskobj): super(MyTicker, self).__init__(parent) ...
2,505
1,006
# # PySNMP MIB module ASSETMANAGEMENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASSETMANAGEMENT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:29:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
62,005
21,879
# Import the Secret Manager client library. from google.cloud import secretmanager # Create the Secret Manager client. secretmanager_client = secretmanager.SecretManagerServiceClient() def get_discord_token(project_id,secret_id): latest_secret_version=secretmanager_client.access_secret_version( name=f'pro...
487
140
from imports import * ban_plugin = lightbulb.Plugin("moderation.ban") ban_plugin.add_checks( lightbulb.checks.guild_only, lightbulb.checks.bot_has_guild_permissions(hikari.Permissions.BAN_MEMBERS), lightbulb.checks.has_guild_permissions(hikari.Permissions.BAN_MEMBERS), ) @ban_plugin.command() @lightbulb...
1,663
586
import unittest from trend_analyze.config import * from trend_analyze.src.model import * from trend_analyze.src.fetch_data_from_api import ApiTwitterFetcher class TestFetchDataFromApi(unittest.TestCase): """ test class for fetch_data_from_api.py """ def __init__(self, *args, **kwargs): super...
2,043
724
# https://leetcode.com/problems/compare-version-numbers/ # # Compare two version numbers version1 and version2. # If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. # # You may assume that the version strings are non-empty and contain only digits and the . character. # The . characte...
1,779
549
from datetime import datetime from config import CIDR_MAX_SUBNETS class IPRange(object): def __init__(self, data): self.range_start = data[0] self.range_end = data[1] self.total_ips = int(data[2]) self.assign_date = datetime.strptime(data[3], '%d/%m/%y') self.owner = data[...
710
251
"""Main module.""" from config import * import os import re from threading import Thread import requests from urllib.parse import unquote from bs4 import BeautifulSoup from m3u8downloader.main import M3u8Downloader from selenium import webdriver from selenium.webdriver.chrome.options import Options VIDEO_DICT = {}...
4,897
1,712
# -*- coding: utf-8 -*- """ This module allows Python's logging module and Esri's ArcMap tools to play nicely together. Everything here works with the root logger, there is currently no functionality to work with multiple loggers. The standard logging.basicConfig() doesn't work out of the box in ArcMap tools, b...
7,305
2,161
import os import re import discord from dotenv import load_dotenv load_dotenv() TOKEN = os.getenv("DISCORD_TOKEN") RENAME_REGEX = re.compile(r"^[Ii]'m (\w+)$") if TOKEN is None: raise RuntimeError("Bot TOKEN not set") client = discord.Client() @client.event async def on_ready(): print("We have logged in ...
892
305
from datetime import datetime from decimal import Decimal from django.conf import settings from django.contrib.auth import get_user_model from django.shortcuts import render, redirect from django.http import HttpResponseRedirect, HttpResponse from django.views.generic import View, ListView from django.urls import reve...
8,035
2,128
# coding=utf8 import os from tkinter import messagebox from tkinter import ttk from tkinter import * import tkinter as tk import database from tkinter import filedialog databaseName = 'dataBase.db' who = 0 currentUserID = 0 currentTable = 0 root = tk.Tk() root.title("Библиотека") root.geometry("1750x500") root.resizab...
21,478
7,669
from datetime import datetime import numpy as np def add_basis_element(W): """ Given a D x d orthonormal matrix W (with d << D), it computes a new vector v that is orthogonal to all d columns of W and add it as an additional column. Return : D x (d+1) orthonormal matrix [W v] """ dim = W.shape[1] d = W.sha...
621
275
import numpy as np import pandas as pd ######################################################################################################################## # Load data ######################################################################################################################## print("Adapt TCGA: Loadin...
4,049
1,490
import pytest from app.share_resources.master_data.models import * # test company_type_category @pytest.mark.django_db class TestCompanyTypeCategory: def test_create(self, create_company_type_category): assert CompanyTypeCategory.objects.count() == 1 def test_update(self, create_company_type_categor...
6,924
2,100
'''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GL import _types as _cs # End users want this... from OpenGL.raw.GL._types import * from OpenGL.raw.GL import _errors from OpenGL.constant import Constant as _C import ctypes _...
1,192
499
from os import path data_path = path.join(path.dirname(__file__), 'data') default_words = path.join(data_path, 'words.dat') default_verbs = path.join(data_path, 'verbs.dat')
176
66
import os from typing import Any, Optional import torch from parseridge.parser.modules.data_parallel import Module from parseridge.parser.training.callbacks.base_callback import Callback class SaveModelCallback(Callback): _order = 5 def __init__(self, folder_path: Optional[str] = None): self.folder...
629
196
import massmodel,pylens,MassModels
35
13
from contextlib import closing from tarfile import open as taropen from urllib2 import urlopen from conans import ConanFile class lestConan(ConanFile): name = "lest" version = "1.26.0" url = "https://github.com/martinmoene/lest-conan-package" license = "Boost 1.0" author = "Martin Moene (martin.m...
1,083
370
# Generated by Django 3.1.1 on 2020-09-22 06:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('erp', '0092_merge_20200916_1733'), ] operations = [ migrations.AlterField( model_name='accessibilite', name='chemine...
555
203
import asyncio import sys from typing import Any, Callable, List, Optional, Union from .commands import Command from .commands import CommandGroup as Group from .errors import * class CLI: """ The CLI class it self, this will represent your cli. Parameters ----------- name: :class:`str` ...
8,290
2,078
from propertiesTemplate.Fields.BasicField import BasicField from propertiesTemplate.Fields.ConstField import ConstField def get_field(value): if value[0] == '@': return BasicField(value) return ConstField(value)
230
61
class SelectionSort: def __init__(self,array): self.array = array def result(self): n = len(self.array) for i in range(n): minimum = i for j in range(i+1,n): if self.array[minimum] > self.array[j]: minimum = j self.a...
494
156
from flask import Flask from flask_sqlalchemy import SQLAlchemy import openaq import requests # connects to the api api = openaq.OpenAQ() # initialize the app APP = Flask(__name__) # configure the database APP.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3' DB = SQLAlchemy(APP) # define a fu...
1,521
525
import copy import errno import os import signal import time from psutil import STATUS_ZOMBIE, STATUS_DEAD, NoSuchProcess from zmq.utils.jsonapi import jsonmod as json from circus.process import Process, DEAD_OR_ZOMBIE, UNEXISTING from circus import logger from circus import util from circus.stream import get_pipe_re...
21,273
6,075
# Faça um programa em Python que abra e reproduza o áudio de um arquivo MP3. from pygame import mixer mixer.init() mixer.music.load('ex021.mp3') mixer.music.play() input('Agora vc escuta?')
192
74
from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import render_to_response from django.core.context_processors import csrf from admin_forms import * from django.template import loader,RequestContext from django.contrib.admin.views.decorators import staff_member_required from Human.mode...
15,171
4,897
import urllib, json baseurl = 'https://query.yahooapis.com/v1/public/yql?' yql_query = "select item.condition from weather.forecast where woeid=9807" yql_url = baseurl + urllib.urlencode({'q':yql_query}) + "&format=json" result = urllib.urlopen(yql_url).read() data = json.loads(result) print data['query']['results']
320
122
"""This module provides mechanisms to use signal handlers in Python. Functions: alarm() -- cause SIGALRM after a specified time [Unix only] setitimer() -- cause a signal (described below) after a specified float time and the timer may restart then [Unix only] getitimer() -- get current value of ...
1,697
541
# flake8: noqa """Module implementing the clients for services.""" from npc_engine.service_clients.text_generation_client import TextGenerationClient from npc_engine.service_clients.control_client import ControlClient from npc_engine.service_clients.sequence_classifier_client import ( SequenceClassifierClient,...
400
117
try: from setuptools import setup except ImportError: from distutils.core import setup config = { 'description': 'A program does that is a DJ by using feedback provided by the dancers.', 'author': 'Thomas Schaper', 'url': 'https://gitlab.com/SilentDiscoAsAService/DJFeet', 'download_url': 'https...
661
234