text
string
size
int64
token_count
int64
import os import time import datetime import ref import torch import torch.utils.data from opts import opts from model.Pose3D import Pose3D from datahelpers.dataloaders.fusedDataLoader import FusionDataset from datahelpers.dataloaders.h36mLoader import h36m from datahelpers.dataloaders.mpiiLoader import mpii from dat...
4,492
1,941
#----------------------------------------------------------------------------- # # Paper: When Crowdsourcing Fails: A Study of Expertise on Crowdsourced # Design Evaluation # Author: Alex Burnap - aburnap@umich.edu # Date: October 10, 2014 # License: Apache v2 # Descrip...
4,129
1,371
# This script will accept a filename from the user and print the extension of that. # If the script doesn't find a period in filename, then it'll display result accordingly. # "not in" or "in" membership operator can be used with strings as well along with list, tuples. # Need to check which additional other places can...
1,053
298
__copyright__ = """This code is licensed under the 3-clause BSD license. Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group. See LICENSE.txt for details. """ import os import scine_utilities as utils from distutils import ccompiler manager = utils.core.ModuleManager() if not manager.module_loaded('X...
1,279
381
# -*- coding: utf-8 -*- # Copyright 2016 Open Permissions Platform Coalition # 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 appl...
5,062
1,580
"""ScrollList Component Test""" import curses from source.controls import Window from source.controls import ScrollList as Scroller __author__ = "Samuel Whang" def view(screen): pass
189
53
import os from collections import deque from glycan_profiling.task import TaskBase debug_mode = bool(os.environ.get("GLYCRESOFTDEBUG")) class StructureSpectrumSpecificationBuilder(object): """Base class for building structure hit by spectrum specification """ def build_work_order(self, hit_id, hit_map...
9,060
2,598
# @generated AUTOGENERATED file. Do not Change! # flake8: noqa # fmt: off # isort: skip_file import typing from gql import gql, Client Episode = typing.Literal["NEWHOPE", "EMPIRE", "JEDI"] GetRecursive__hero__Droid__friends__Droid__friends = typing.TypedDict("GetRecursive__hero__Droid__friends__Droid__friends", {"na...
4,420
1,411
# -*- coding: utf-8 -*- """ Created on Wed May 16 09:32:56 2018 @author: gamer """ import pygame as pg import numpy as np import skimage.transform as transform class Render(object): def __init__(self, window_size=(360,480)): pg.init() self.h,self.w = window_size self.dis...
795
294
import pygame import sys def setup(w,h,r): surf = pygame.Surface((w,h)) fract_circle(w/2, h/2, r, surf) pygame.image.save(surf, str(r)+"_radius.png") # branching recursion def fract_circle(x,y, radius, surface): if radius > 1: pygame.draw.circle(surface, (0,0,255), (int(x),int(y)), int(radius), 1) if radius ...
660
292
from hmc5883l import HMC5883L sensor = HMC5883L(scl=5, sda=4) valmin=[0,0,0] valmax=[0,0,0] valscaled=[0,0,0] def convert(x, in_min, in_max, out_min, out_max): return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min f=open("cal.csv",'w') for count in range(3000): valread = sensor.read() ...
684
332
# This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.8 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (2, 6, 0): def swig_import_helper(): from os.path imp...
16,554
5,253
"""Mean covariance estimation.""" from copy import deepcopy import numpy as np from .base import sqrtm, invsqrtm, logm, expm from .ajd import ajd_pham from .distance import distance_riemann from .geodesic import geodesic_riemann def _get_sample_weight(sample_weight, data): """Get the sample weights. If none...
13,774
4,807
#!/usr/bin/env python from fabric.api import * import app import app_config """ Environments Changing environment requires a full-stack test. An environment points to both a server and an S3 bucket. """ def production(): env.settings = 'production' env.s3_buckets = app_config.PRODUCTION_S3_BUCKETS def stag...
3,578
1,187
from PIL import Image from openpyxl import Workbook from openpyxl.styles import PatternFill from openpyxl.utils import get_column_letter from functools import partial import sys import argparse def rgb_to_xls_hex(rgb_tuple, image_mode='RGB'): if image_mode == 'RGB': r, g, b = rgb_tuple elif ...
2,531
859
from unittest import TestCase from dat_analysis.dat_object.dat_hdf import DatHDF from dat_analysis.hdf_file_handler import HDFFileHandler from dat_analysis.dat_object.make_dat import get_dat, get_dats, DatHandler from tests.helpers import get_testing_Exp2HDF from dat_analysis.data_standardize.exp_specific.Feb21 import ...
7,502
2,623
import myshop def movie(name): two = round((9.99 * 1.07), 2) print("Here is your Ticket and movie receipt.\n[Ticket for", name, " - $" + str(two) + "]\nEnjoy the film!") def concession(): print(" Refreshments:\n" "Popcorn - $5.05\n" "Coke - $2.19\n" "Cookies -...
2,721
840
#!/usr/bin/env python # CREATED BY CHRISTOPHER LAVENDER # BASED ON WORK BY ADAM BURKHOLDER # INTEGRATIVE BIOINFORMATICS, NIEHS # WORKING OBJECT ORIENTED VERSION import os import math import argparse import sys from operator import itemgetter def writeBedHeader(file_name, description, OUTPUT): OUTPUT.write('trac...
43,469
12,224
import cv2 import numpy as np img = cv2.imread('lena.jpg', cv2.IMREAD_GRAYSCALE) thresh = 127 im_bw = cv2.threshold(img, thresh, 255, cv2.THRESH_BINARY)[1] cv2.imshow('image', im_bw) cv2.waitKey(0) cv2.destroyAllWindows()
234
119
#!/usr/bin/env python """ Introduces the "argparse" module, which is used to parse more complex argument strings eg: ./006-argparse.py --name Jeff mauve """ import argparse # http://docs.python.org/2/library/argparse.html#module-argparse import subprocess def main(): parser = argparse.ArgumentParser(description='...
652
233
""" This is the IOC source code for the unique AT2L0, with its 18 in-out filters. """ from typing import List from caproto.server import SubGroup, expand_macros from caproto.server.autosave import RotatingFileManager from .. import calculator, util from ..filters import InOutFilterGroup from ..ioc import IOCBase from...
4,573
1,317
"""mysite URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
4,530
1,535
from flask_wtf import Form from wtforms import StringField, PasswordField, SubmitField from wtforms.validators import DataRequired class LoginForm(Form): ''' Form used to perform a user login ''' username = StringField('Username', validators=[DataRequired()]) password = PasswordField('Password', validators=[Data...
396
111
from django.contrib import admin from budgetcalc.models import Category, Optiongroup, Option, Submission class CategoryAdmin(admin.ModelAdmin): list_display = ('pk','title', 'cat_type', 'order',) list_editable = ('title', 'cat_type', 'order',) class OptiongroupAdmin(admin.ModelAdmin): list_display = ('...
880
270
num = int(input("Digite um numero: ")) if(num % 5 == 0 and num % 3 == 0): print("FizzBuzz") else: print(num)
117
52
def test_compile(ape_cli, runner, project): if not (project.path / "contracts").exists(): result = runner.invoke(ape_cli, ["compile"]) assert result.exit_code == 0 assert "WARNING" in result.output assert "No 'contracts/' directory detected" in result.output return # Nothing...
1,777
508
# GPG Reaper # # MIT License # # Copyright (c) 2018 Kacper Szurek # https://security.szurek.pl/ from pgpy.packet.fields import MPI, RSAPriv from pgpy.constants import PubKeyAlgorithm, KeyFlags, HashAlgorithm, SymmetricKeyAlgorithm, CompressionAlgorithm from pgpy import PGPKey from pgpy.packet.packets import PrivKeyV4 ...
3,720
1,229
from app import app from flask_sqlalchemy import SQLAlchemy from os import getenv app.config["SQLALCHEMY_DATABASE_URI"] = getenv("DATABASE_URL") app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False db = SQLAlchemy(app)
221
84
import torch from os.path import join from fvcore.common.registry import Registry ARCHITECTURE_REGISTRY = Registry("ARCHITECTURE") def build_model(cfg): arch = cfg.MODEL.ARCHITECTURE model = ARCHITECTURE_REGISTRY.get(arch)(cfg) if cfg.SAVE.MODELPATH and cfg.MODEL.LOADPREV: model.load_state_dict(...
399
160
#%% import base64 import matplotlib.pyplot as plt import numpy as np import json from ast import literal_eval data1encoded = 'eyJkZGFFbmFibGVkIjpmYWxzZSwiZGF0YSI6W3sic3RhcnRUaW1lIjoxNjE5MTM3MjUxMzg1LCJkdXJhdGlvbiI6NjQ1Miwic2NvcmUiOjAsImdyYXZpdHkiOjAuMjUsInBpcGVJbnRlcnZhbCI6MTQwMCwicGlwZWhlaWdodCI6OTAsImNvbGxpc2lvblBvc...
14,034
8,315
# -*- coding: utf-8 -*- """ Created on Wed Nov 30 16:08:04 2016 @author: Manuel """ from C45Tree_own import split import pandas as pa def apply(X, tree): results = [] for x in range(0,len(X.index)): temp_tree = tree.copy() example = X.loc[x,:] while(True == True): ...
2,870
840
# Generated by Django 2.2.16 on 2020-10-28 06:58 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("application_form", "0004_add_apartment"), ] operations = [ migrations.AlterModelOptions( name="hasoapartmentpriority", ...
1,545
388
""" Sample Example """ from goibibo import goibiboAPI GO = goibiboAPI("ae51f09b", "da2d83a905110d15a51795b018605026") print GO.FlightSearch("BLR", "HYD", 20141028) print GO.MinimumFare("BLR", "HYD", 20141028) print GO.BusSearch("bangalore", "hyderabad", 20141028) print GO.BusSeatMap("vJ52KC0ymd0635qTD9bDDy9GHBkGl5FJM...
579
369
from datetime import datetime from dateutil.tz import tzutc from aiogithub.objects.response import BaseResponseObject from aiogithub.utils import return_key class RateLimitDetail(BaseResponseObject): def _normalise_key(self, document, key): if key == 'reset' and not isinstance(document['reset'], datetim...
1,237
350
#!/usr/bin/python """how to user basic math operations in python """ def math_operations(): a = 5 + 3 assert a == 8 b = 5 - 3 assert b == 2 c = 5 * 3 assert c == 15 assert isinstance(c, int) assert 5 / 3 == 1.666666666666666666666667 assert 8 / 2 == 4 assert 5 % 3 == 2 ...
736
322
# RT - Original Command from __future__ import annotations from discord.ext import commands import discord from aiomysql import Pool, Cursor from rtutil import DatabaseManager class DataManager(DatabaseManager): TABLE = "OriginalCommand" def __init__(self, pool: Pool): self.pool = pool asyn...
8,204
2,683
import re import requests import sys sys.path.append('cli_stats') from directory import Directory from pprint import pprint from storage_config import StorageConfig from tqdm import tqdm session = requests.Session() #TODO """ *Program is not scaling well """ """***HOW TO USE*** 1. Create an instance of Foot...
12,626
3,946
from django.db import models from django.contrib.auth import get_user_model from django_countries import countries COUNTRY_CHOICES = tuple(countries) User = get_user_model() # Create your models here. class Checkout(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) name = models.CharFi...
826
275
import numpy as np def least_squares_BCES(Y1, Y2, V11, V22, V12=0, origin=False): """ Make a least-squares fit for non-NaN values taking into account the errors in both rho and J variables. This implementation is based on Akritas1996 article. It is a generalization of the least-squares method. The variance o...
1,787
688
from ErnosCube.face_enum import FaceEnum from ErnosCube.orient_enum import OrientEnum from ErnosCube.sticker import Sticker from ErnosCube.face import Face from ErnosCube.face import RowFaceSlice, ColFaceSlice from plane_rotatable_tests import PlaneRotatableTests from hypothesis import given from strategies import sti...
7,696
3,080
from unittest.case import TestCase from django.core.exceptions import ImproperlyConfigured from django.test.utils import override_settings from djangoes import (ConnectionHandler, IndexDoesNotExist, ConnectionDoesNotExist, load_backend) from djangoes.b...
19,752
5,181
#!/usr/bin/env python """ Copyright 2014 Novartis Institutes for Biomedical Research 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 ...
8,497
2,207
def get_permutations(sequence): ''' Enumerate all permutations of a given string sequence (string): an arbitrary string to permute. Assume that it is a non-empty string. You MUST use recursion for this part. Non-recursive solutions will not be accepted. Returns: a list of all pe...
1,148
382
all_tests = [ { "name" : "wc-fast", "exec" : "./test-wc.bin", "records" : 1000 * 1000, # records per epoch "record_size" : 100, "target_ms" : 1000, "input_file" : "/ssd/1g.txt", # --- optional: soft delay --- # #"softdelay_maxbad_ratio" : 0.1, # okay if aonmaly delay % is less than this in a windo...
3,246
1,492
# Time: O(n) # Space: O(1) class Solution(object): def countVowels(self, word): """ :type word: str :rtype: int """ VOWELS = set("aeiou") return sum((i-0+1) * ((len(word)-1)-i+1) for i, c in enumerate(word) if c in VOWELS)
277
110
''' Created on Jan 16, 2016 @author: enikher ''' import logging import datetime LOG = logging.getLogger(__name__) LOG_LEVEL = logging.DEBUG LOG_PATH = "./dlService.log" logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', filename=LOG_PATH, datefmt='%Y-%m-%dT:%H...
1,350
438
from .appifaceprog import api from .database import db
54
15
from EasyPortfolioExplorer.app.easy.base import EasyBase class ResourceLoader(EasyBase): """ Class for adding external resources such as css and js file. The current version is based on boostrap 3.3.7. """ def __init__(self, **kwargs): super(ResourceLoader, self).__init__(**kw...
1,061
362
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...
11,884
3,986
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: The root of the binary search tree. @param node: insert this node into the binary search tree. @return: The root of the new bina...
1,275
335
"""This program takes a matrix of size mxn as input, and prints the matrix in a spiral format for example: input ->> [[1,2,3], [4,5,6], [7,8,9], [10,11,12]] output ->> 1 2 3 6 9 12 11 10 7 4 5 8""" class Solution: def matrix_spir...
1,268
397
import abc import numpy as np import torch import torch.nn as nn class AbstractSDE(abc.ABC): def __init__(self): super().__init__() self.N = 1000 @property @abc.abstractmethod def T(self): """End time of the SDE.""" raise NotImplementedError @abc.abstractmethod ...
4,694
1,661
import os os.system('./build.sh') os.system('g++ parser_sha_data_parallel.cpp -o psdp -O3') os.system('./psdp lanczos2_16.pws lanczos2_16_112_N=16_rdl.pws lanczos2_112_N=16_circuit.txt lanczos2_112_N=16_meta.txt') os.system('./psdp lanczos2_16.pws lanczos2_16_176_N=64_rdl.pws lanczos2_176_N=64_circuit.txt lanczos2_176...
799
471
import pandas as pd import matplotlib.pyplot as plt from diagrams.base import * DATASET = DATASET_FOLDER + "ama0302.csv" def tabulize_data(data_path, output_path): data = pd.read_csv(data_path) fix_count(data) fix_neg(data, "copy") data["total_time"] = data["End"] - data["Start"] grouped = data.groupby(...
1,166
437
# Run training with PointRend head # uses default configuration from detectron2 # The model is initialized via pre-trained coco models from detectron2 model zoo # # Fatemeh Saleh <fatemehsadat.saleh@anu.edu.au> import os from detectron2.config import get_cfg from detectron2.data.datasets import register_coco_instances...
1,513
638
import re, os, sys isBeingDebugged = False if (not os.environ.has_key('WINGDB_ACTIVE')) else int(os.environ['WINGDB_ACTIVE']) == 1 __re__ = re.compile("(?P<commented>(#|))cfg_file=(?P<cfg_file>.*)", re.DOTALL | re.MULTILINE) def find_nagios_cfg(top,target): print 'DEBUG: top=%s, target=%s' % (top,target) ...
3,991
1,382
import urllib2 from sqlalchemy import func, distinct, asc, desc, and_, or_ from flask import Blueprint, request, jsonify, abort, g, render_template, make_response, redirect, url_for, flash from dataviva import db, __latest_year__ from dataviva.attrs.models import Bra, Wld, Hs, Isic, Cbo, Yb from dataviva.secex.models...
11,775
4,037
""" Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A. You may return any answer array that satisfies this condition. Example 1: Input: [3,1,2,4] Output: [2,4,3,1] The outputs [4,2,3,1], [2,4,1,3], and [4,2,1,3] would also be a...
701
257
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 """ <img src="https://meerschaum.io/assets/banner_1920x320.png" alt="Meerschaum banner"> | PyPI | GitHub | License ...
2,922
893
from insights.parsers import kpatch_patches from insights.tests import context_wrap from insights.core.plugins import ContentException import pytest ASSORTED_KPATCHES = """ asdfasdfasdf_asdfasdfasdf-asdfasdfasdf_asdfasdfasdf.ko asdfasdfasdf_asdfasdfasdf-asdfasdfasdf_asdfasdfasdf.ko.xz foo-bar.ko foo-bar.ko.xz foo.ko ...
1,065
418
from pybricks.hubs import EV3Brick ev3 = EV3Brick() print(ev3.battery.voltage()) # 7400 print(ev3.battery.current()) # 180
127
66
# -*- coding: utf-8 -*- import copy import logging from operator import attrgetter from typing import Dict from app.service.messages.handler import Handler logger = logging.getLogger(__name__) class Dispatcher(object): """ 消息分派器,暂时忽略 Notice platform: 平台,目前只有 qq,未来可能会添加 telegtram、wechat group_id: 群...
3,878
1,376
class Choices: DEVICE_TYPE_BAROMETER = 1 DEVICE_TYPE_LED_STRIP = 2 DEVICE_TYPE_CHOICES = [ (DEVICE_TYPE_BAROMETER, 'Barometer'), (DEVICE_TYPE_LED_STRIP, 'LED Strip'), ] DEVICE_SUB_TYPE_BME280 = 1 DEVICE_SUB_TYPE_RGB_STRIP_WITH_ALARM = 2 DEVICE_SUB_TYPE_CHOICES = [ (D...
1,247
595
import matplotlib.pyplot as plt import tensorflow as tf import tensorflow_hub as hub import numpy as np from pytube import YouTube import os import cv2 from PIL import Image import shutil import glob import ffmpy def transfer(content_img_path, style_img_path, tfhub_module='https://tfhub.dev/google/magenta/arbitrary-im...
1,647
632
from collections import OrderedDict from zeep import Client from zeep import xsd import zeep.helpers import zeep.exceptions import logging.config import re from .constants import methods class Bfs: client = None factory = None credentials = None identifier = None methods = methods def __init...
15,493
4,093
"""booking_status Revision ID: 7eb209b7ab1e Revises: 0a95c6679356 Create Date: 2021-02-22 01:19:10.744915 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql from booking_microservice.constants import BookingStatus # revision identifiers, used by Alembic. revision = '7eb209...
1,370
473
records = [('foo', 1, 2), ('bar', 'hello'), ('foo', 3, 4)] def do_foo(x, y): print('foo', x, y) def do_bar(s): print('bar', s) for tag, *args in records: if tag == 'foo': do_foo(*args) elif tag == 'bar': do_bar(*args)#该例子没看懂 line = 'nobody:*:-2:-2:Unprivileged User:/var/empty:/user/b...
669
313
""" Configurations shared between PyTorch and Keras. """ CONFIG = { "large": [ # in_ch, exp, out_ch, ks, stride, dilation, se, activation [16, 16, 16, 3, 1, 1, None, "relu"], [16, 64, 24, 3, 2, 1, None, "relu"], [24, 72, 24, 3, 1, 1, None, "relu"], [24, 72, 40, 5, 2, 1, 0.25...
4,577
2,867
import base64 import hashlib import hmac import json import logging import time from json.decoder import JSONDecodeError from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple from urllib.parse import urlencode import requests from rotkehlchen.accounting.ledger_actions import LedgerAction from ro...
14,288
4,026
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # parts of this were originally generated by sphinx-quickstart on Thu Aug 31 17:31:36 2017. import os.path import sys sys.path.append(os.path.abspath('..')) project = 'CLI' copyright = '2021 rerobots, Inc | <a href="https://github.com/rerobots/cli">source code</a>' au...
1,010
389
import time from lltm.lltm import LLTM import torch batch_size = 16 input_features = 32 state_size = 128 X = torch.randn(batch_size, input_features) h = torch.randn(batch_size, state_size) C = torch.randn(batch_size, state_size) rnn = LLTM(input_features, state_size)#net init forward = 0 backward = 0 for _ in range...
620
265
# Licensed under Apache License Version 2.0 - see LICENSE """This is a helper that prints the content of the function overview tables . - docs/index.rst - README.rst Both contain a table of functions defined in iteration_utilities and manually updating them is a pain. Therefore this file can be executed and the conte...
1,980
622
# Given the tuple below that represents the Imelda May album "More Mayhem", write # code to print the album details, followed by a listing of all the tracks in the album. # # Indent the tracks by a single tab stop when printing them (remember that you can pass # more than one item to the print function, separating them...
1,092
393
import sys import os from PyQt4 import QtGui, QtCore class TestListView(QtGui.QListWidget): def __init__(self, type, parent=None): super(TestListView, self).__init__(parent) self.setAcceptDrops(True) self.setIconSize(QtCore.QSize(72, 72)) def dragEnterEvent(self, event): if eve...
1,785
561
import os from .. import constants from . import application class NDN_DemoAppsWLDR(application.Application): def __init__(self, server, clients, gateways, start, duration, server_params, client_params, routingcmds): self.server = server self.clients = clients self.gateways = gateways ...
3,392
1,135
######################################################################### # Copyright 2011 Cloud Sidekick # # 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...
1,918
506
import pybullet as p import numpy as np from icecream import ic from scipy.spatial.transform import Rotation as R from highlevel_planning_py.tools.util import ( homogenous_trafo, invert_hom_trafo, pos_and_orient_from_hom_trafo, SkillExecutionError, ) class SkillNavigate: def __init__(self, scene, ...
7,589
2,462
# coding: utf-8 """Actions package"""
39
16
import argparse import httplib import json import numpy import re import time class RequestInfo: def __init__(self, req, filtered=[]): self.key = req['key'] self.timestamp = req['request_timestamp']['value_as_string'] self.api_calls = req['doc_count'] self.service_times = {} ...
5,844
1,904
from django.db import models from products.models import Product from account.models import Account class FavouriteProduct(models.Model): user = models.ForeignKey(Account, on_delete=models.CASCADE, related_name="user") product = models.ForeignKey( Product, on_delete=models.CASCADE, related_name="prod...
523
158
from gmocoin.common.const import ConstMeta class TestConst(metaclass=ConstMeta): API_CALL_INTERVAL = 0.5 ORDER_PRICE = 2000000 ORDER_LOSSCUT_PRICE = 1500000
171
77
# Generated by Django 2.2.5 on 2019-09-30 12:15 import logging from django.db import migrations from django.db.models import Q log = logging.getLogger('nomination_migration') def migrate_nominations_to_new_model(apps, schema_editor): """ Migrations nominations from the infraction model to the nomination mod...
2,443
695
#!/usr/bin/python import datetime x = datetime.datetime.now() print(x) # current date and time print(x.year) # current year print(x.strftime("%A")) # current day y = datetime.datetime(2020, 5, 17) # set date print(y) print(y.strftime("%B")) # Month name, full version
276
106
class Node: def __init__(self, parent): if parent is None: self.isRoot = True else: self.isRoot = False self.parent = parent self.parent.add_child(self) self.children = [] def __str__(self): return 'Node' def add_child(self, child): self.children.append(child) def print_tree_below(self, ta...
587
263
# -*- coding: utf-8 -*- """Unit test package for pyrmx."""
60
27
from weakest_link.util import wait_for_choice, green, red, dollars, get_random_mean_word, starts_with_vowel, format_time class WeakestLinkGame : def __init__(self, players, rounds, final_round) : self.players = players self.rounds = rounds self.final_round = final_round self.total_...
5,151
1,569
import typing as t import infiltrate.browsers as browsers import infiltrate.eternal_warcy_cards_browser as ew_cards import infiltrate.models.card as card_mod from infiltrate import db def update_is_in_expedition(): """Sets the is_in_expedition column of the cards table to match Eternal Warcry readings.""" ...
1,338
483
from collections import namedtuple from math import ceil from typing import Tuple, Dict, Union, List, Counter import numpy as np import pandas as pd from classifiers.config import Config from data_loading.PathMinerDataset import PathMinerDataset from data_loading.PathMinerLoader import PathMinerLoader from data_loadi...
8,373
2,443
# pylint: disable=C0301 from .annotations.annotation_tools import AnnotationToolViewSet from .annotations.annotation_votes import AnnotationVoteViewSet from .annotations.annotations import AnnotationViewSet from .data_collections.collection_devices import CollectionDeviceViewSet from .data_collections.collection_sites ...
4,965
1,372
from datetime import datetime, timezone import udi_interface import requests import json from enums import BatteryLevel, DeviceStatus from nodes import AcuriteDeviceNode LOGGER = udi_interface.LOGGER Custom = udi_interface.Custom class AcuriteManager(): def __init__(self, user, password): self.user = ...
2,765
794
ErrorMsg = {'BadZipFile' : 'Uploaded zip file is bad', 'EmptyZipFile' : 'Uploaded zip file is empty',}
115
36
from DTL.qt import QtCore, QtGui from DTL.qt.QtCore import Qt #------------------------------------------------------------ #------------------------------------------------------------ class GraphicsItemModel(QtGui.QGraphicsItem): unselected_color = QtGui.QColor(100,100,100) selected_color = QtGui.QColor(100,...
5,650
1,378
import unittest from mock import mock_open, patch from rest_framework.generics import ListAPIView from rest_framework_ccbv.renderers import ( BasePageRenderer, IndexPageRenderer, LandPageRenderer, ErrorPageRenderer, SitemapRenderer, DetailPageRenderer, ) from rest_framework_ccbv.config import VERSION from res...
4,461
1,383
import pytest from django.conf.urls import include, url from django.test import Client, override_settings from .util import all_template_engines from .test_sendable_email import MY_SENDABLE_EMAIL urlpatterns = [ url(r'^examples/', include('emailpal.urls')), ] @pytest.fixture def client(): with override_setti...
1,320
424
from common.utils import crypt_utils from bright import settings row_data = [ { 'username': 'admin', 'password': crypt_utils.md5('admin', settings.APP_SALT), 'cellphone': '13966660426', 'email': 'admin@wesoft.com' } ]
259
93
import os from flask import Flask, request, jsonify from flask_restful import Api from resources.company import Company, Companylist from resources.employee import Employee, EmployeeList from db import db from resources.user import UserRegister, UserLogin, UserLogout app = Flask(__name__) app.config['SQLALCHEMY_DATABA...
2,328
760
# encoding: utf-8 from django.db import models from django.conf import settings class DisallowedHost(models.Model): created_at = models.DateTimeField("Créé le", auto_now_add=True) updated_at = models.DateTimeField("Modifié le", auto_now=True, db_index=True) http_host = models.CharField(u"HTTP_HOST", max...
1,381
491
class Solution: def nextPermutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ lenNums = len(nums) if lenNums == 1: return maxFromTail = -1 for i in range(lenNums - 2, -1, -1): maxFro...
1,234
369
# Generated by Django 4.0 on 2022-02-06 09:46 from django.db import migrations, models import leads.models import rizcrm.storage_backends class Migration(migrations.Migration): dependencies = [ ('leads', '0008_user_profile_picture'), ] operations = [ migrations.AlterField( m...
2,412
717
#!/usr/bin/python3 # MIT License # Copyright (c) 2017 Aleksey Vilezhaninov # 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 # t...
28,338
8,324