text
string
size
int64
token_count
int64
from tests.primitives.flow import probe_tcpip_extended_biflow_test from netexp.primitives.flow import TCPIPFlowExtendedUniBiFlowInfo from netexp.common import naming class TestTCPIPExtendedUniBiFlow(probe_tcpip_extended_biflow_test.TestTCPIPExtendedBiFlow): flow_class = TCPIPFlowExtendedUniBiFlowInfo def t...
2,026
1,053
import time import mysql.connector from optionstrader.customlogging import CustomLog from optionstrader.parser import Parser MYSQL_IP_ADDR = '192.168.1.10' # Used to debug via logs DEBUG = False class Database: def __init__(self): """ There's some confusion with database vs table. We wil...
19,816
5,431
# Generated by Django 3.2.9 on 2021-11-24 02:52 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Symbol', fields=[ ...
10,254
2,660
from unittest import TestCase from CTCI.Ch2_Linked_Lists.common.SinglyLinkedList import Empty, Node from CTCI.Ch2_Linked_Lists.exercises.CTCI_Ch2_Ex6 import PalindromeSinglyLinkedList, is_palindrome_brute_force from CTCI.Ch2_Linked_Lists.exercises.CTCI_Ch2_Ex6 import is_palindrome_reverse class TestPalindromeSinglyLi...
3,713
1,391
# utils for working with 3d-protein structures import os import numpy as np import torch from functools import wraps from einops import rearrange, repeat # import torch_sparse # only needed for sparse nth_deg adj calculation # bio from Bio import SeqIO import itertools import string # sidechainnet from sidechainnet...
49,917
17,612
__author__ = 'walthermaciel' import pandas as pd import numpy as np def load_csv(path): # Load print 'Loading', path df = pd.read_csv(path) # Remove unwanted columns print 'Dropping unwanted columns' df = df[['PID', 'TAX_ASSESSMENT_YEAR', 'CURRENT_LAND_VALUE', 'STREET_NAME', 'TO_CIVIC_NUMBER'...
1,151
433
""" Interfaces with Verisure sensors. For more details about this platform, please refer to the documentation at documentation at https://home-assistant.io/components/verisure/ """ import logging from homeassistant.components.verisure import HUB as hub from homeassistant.const import TEMP_CELSIUS from homeassistant.h...
4,040
1,179
import factory from factory.django import DjangoModelFactory as Factory from django.contrib.auth.models import Permission from ..models import Blog from articles.users.tests.factories import UserFactory class Blogfactory(Factory): user = user = factory.SubFactory(UserFactory) title = factory.Faker('sentence...
1,135
377
from datetime import datetime from django.urls import reverse from rest_framework import serializers from .view_helpers import description_from_notes class ExternalIdentifierSerializer(serializers.Serializer): identifier = serializers.CharField() source = serializers.CharField() class DateSerializer(seria...
8,847
2,443
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-09-23 19:58 from __future__ import unicode_literals import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('cms_news', '0003_auto_20160923_1956'), ...
828
294
from mopidy import httpclient from mopidy.internal.gi import Gst def calculate_duration(num_samples, sample_rate): """Determine duration of samples using GStreamer helper for precise math.""" return Gst.util_uint64_scale(num_samples, Gst.SECOND, sample_rate) def create_buffer(data, timestamp=None, durat...
3,252
930
#!/usr/bin/env python3 import re with open("input.txt") as f: content = f.read().strip() ans = "" i = 0 while i < len(content): if content[i] == "(": end = content[i:].find(")") + i instr = content[i+1:end] chars, times = map(int, content[i+1:end].split("x")) to_copy = conten...
467
178
# ---------------------------------------------------------------------- # Alcatel.AOS.get_inventory # ---------------------------------------------------------------------- # Copyright (C) 2007-2014 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # Py...
2,825
880
import sqlite3 class Database: # create book always if not exists def __init__(self,db): self.conn = sqlite3.connect(db) self.cur = self.conn.execute("CREATE TABLE IF NOT EXISTS book (id INTEGER PRIMARY KEY, " + "title TEXT, author TEXT, year INTEGER, isbn INTEGER)"...
1,276
405
#!/usr/bin/env python # ---------------------------------------------------------------------------- # Copyright 2018 ARM Ltd. # # SPDX-License-Identifier: Apache-2.0 # # 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 ...
5,286
1,747
# -*- coding: utf-8 -*- # Copyright 2019 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 ...
3,012
960
from utils import database class Config: config = None def __init__(self, users, posts, comments): self.users = users self.posts = posts self.comments = comments Config.config = self @staticmethod def update(): database["concept", True]["config", "WHERE id=1"] ...
1,869
544
from .test_db import TestDal
29
11
from django.db import models # Create your models here. class Owner(models.Model): Owner_id = models.AutoField Owner_firstname = models.CharField(max_length=60) Owner_lastname = models.CharField(max_length=60) Owner_address = models.CharField(max_length=600) Owner_email = models.CharField(max_lengt...
971
337
import numpy as np import tectosaur.util.gpu as gpu from tectosaur.fmm.c2e import build_c2e import logging logger = logging.getLogger(__name__) def make_tree(m, cfg, max_pts_per_cell): tri_pts = m[0][m[1]] centers = np.mean(tri_pts, axis = 1) pt_dist = tri_pts - centers[:,np.newaxis,:] Rs = np.max(np...
6,548
2,662
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Project: Fable Input Output # https://github.com/silx-kit/fabio # # Copyright (C) European Synchrotron Radiation Facility, Grenoble, France # # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu) # # This program is free software: you...
2,553
858
# -*- coding: utf-8 -*- import scrapy import codecs import sys #리눅스상에서 utf-8 로 파일에 내용을 기록하려면 시스템 기본 인코딩으 ㄹutf-8 로 설정해야함 reload(sys) sys.setdefaultencoding('utf8') # scrapy 에서 spider 는 crawling/scrapping을 담당하는 핵심부분 #crawling/scrapping 절차에 대한 정의를 하는 부분 class CurrSpider(scrapy.Spider): name = 'currSpider' start_...
1,064
479
import numpy as np import pandas as pd from feature_engine.sanity_check import SimilarColumns def test_similar_columns_when_more_columns_in_train_than_test( df_vartypes, df_na ): # When columns are the same train = df_na.copy() test = df_vartypes.copy() similar_columns = SimilarColumns() si...
1,812
653
import __init__ import os #os.environ['LD_LIBRARY_PATH'] += ':/usr/local/cuda-11.1/bin64:/usr/local/cuda-11.2/bin64' import numpy as np import torch import torch.multiprocessing as mp import torch_geometric.datasets as GeoData from torch_geometric.loader import DenseDataLoader import torch_geometric.transforms as T...
6,780
2,341
import tkinter as tk from tkinter import ttk win = tk.Tk() win.title("Python GUI") win.resizable(False, False) win.configure(background = "grey94") a_label = ttk.Label(win, text = "Gib Deinen Namen ein:") a_label.grid(column = 0, row = 0) a_label.grid_configure(padx = 8, pady = 8) def clickMe(): action.configure...
707
287
""" Initialise the Celery instance to be used by the application This is largely just boiler plate, and we could probably look at coming back to it and cleaning it up a bit in the future. """ from __future__ import absolute_import from celery import Celery celery = Celery() from openarticlegauge import celeryconfi...
528
169
#! /usr/bin/env python # call roscore # $ roscore # # If start in manual # $ rosrun cbf_ros cbf_controller.py import rospy import sys import argparse import re import numpy as np from scipy.integrate import odeint from sympy import symbols, Matrix, sin, cos, lambdify, exp, sqrt, log import matplotlib.pyplot as plt im...
28,061
9,957
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'src/gui/ui_paste_dialog.ui' # # Created by: PyQt5 UI code generator 5.11.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_PasteDialog(object): def setupUi(self, PasteDialog)...
5,250
1,586
__all__ = ['a_star', 'best_first', 'bi_a_star', 'breadth_first', 'dijkstra', 'finder', 'ida_star']
110
46
#Uche's test from Sun's SVG slide publisher import os from Xml.Xslt import test_harness #From Sun's toolkit sheet_1_uri = "Xml/Xslt/Borrowed/svgslides.xsl" sheet_2_uri = "Xml/Xslt/Borrowed/svgslides_custom.xsl" sheet_3_uri = "Xml/Xslt/Borrowed/slidescript.xsl" source_1_uri = "Xml/Xslt/Borrowed/slides4svg.xml" saxon_o...
34,891
13,070
""" 2338. 긴자리 계산 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 72 ms 해결 날짜: 2020년 9월 13일 """ def main(): A, B = int(input()), int(input()) print(A + B, A - B, A * B, sep='\n') if __name__ == '__main__': main()
232
160
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
2,952
1,119
from abc import ABC, abstractmethod from typing import Dict import pandas as pd from feast.data_source import DataSource from feast.repo_config import FeastConfigBaseModel class DataSourceCreator(ABC): @abstractmethod def create_data_source( self, destination: str, df: pd.DataFrame, ...
743
220
from yalul.interpreters.environment import Environment from yalul.interpreters.expressions.var_assignment_interpreter import VarAssignmentInterpreter from yalul.interpreters.interpreter_errors import InterpreterErrors class TestVarAssignmentInterpreter: """Test var assignment expression interpreter""" def te...
1,393
375
import boto3 from django.conf import settings from backend.models import CloudWatchEvent import json class Events: def __init__(self): self.client = boto3.client('events', region_name=settings.NARUKO_REGION) def list_rules(self): response = [] for rules in self._list_rul...
2,547
797
class Solution: def mostVisited(self, n: int, rounds: List[int]) -> List[int]: start, end = rounds[0], rounds[-1] if end >= start: return list(range(start, end + 1)) else: return list(range(1, end + 1)) + list(range(start, n + 1))
283
97
#!/usr/bin/env python # Manipulate sys.path to be able to import converscript from this local git # repository. import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) from converscript import RiveScript import json bot = RiveScript() bot.load_file("example.rive") dep = bot.deparse...
356
121
import matplotlib.pyplot as plt import numpy as np from scipy import signal, linalg from matplotlib import rc from matplotlib import rcParams __author__ = 'ernesto' # if use latex or mathtext rc('text', usetex=True) rcParams['text.latex.preamble'] = [r"\usepackage{amsmath}"] #respuesta al impulso deseada: sinc N = ...
2,715
1,342
# Copyright 2008-2015 Nokia Solutions and Networks # # 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...
19,353
5,913
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): SECRET_KEY = os.environ.get('SECRET_KEY') or 'rajatomar788' if os.environ.get('DATABASE_URL') is None: SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') elif os.environ.get('EXTRA_DATABASE') ...
902
368
from .default import size7extracondensedfont
45
12
from bom.octopart_parts_match import match_part from bom.models import Part, PartClass, Seller, SellerPart, Subpart, \ Manufacturer, Organization, PartFile def create_a_fake_organization(user, free=False): org = Organization( name="Atlas", subscription='F' if free else 'P', owner=user)...
3,433
1,287
# Source: # https://github.com/tpn/winsdk-10/blob/46c66795f49679eb4783377968ce25f6c778285a/Include/10.0.10240.0/um/WinUser.h # # convert all C-style comments to python multi-line string comment # find: (^/\*[\s\S\r]+?\*/) # replace: """\n$1\n""" # # convert all keycode #defines to be python constants # find: #define\s...
8,612
5,050
#! python3 # -*- coding: utf-8 -*- # from flask import Blueprint bp_errors = Blueprint('flicket-errors', __name__)
117
47
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('modules', '0002_module_floor'), ] operations = [ migrations.AddField( model_name='module', name='sho...
399
121
import abc import argparse import logging import pathlib from collections import namedtuple from operator import itemgetter import toml class NotConfiguredError(Exception): pass class ParseError(Exception): pass class Model(abc.ABC): """Interface for model that can save/load parameters. Each mod...
6,789
1,917
from __future__ import unicode_literals, print_function import sys from pathlib import Path import spacy from spacy.lang.ru import Russian from spacy.pipeline import Tagger, DependencyParser from spacy.util import fix_random_seed, set_lang_class from models.dep import MyDEP from models.loadvec import get_ft_vec from...
2,737
1,106
# pylint:disable=missing-class-docstring,no-self-use import os import unittest import archinfo import ailment import angr from angr.analyses.decompiler.peephole_optimizations import ConstantDereferences test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests') class ...
1,512
518
#!/usr/bin/python3 # 文件名:mysql_createtable.py import pymysql # 打开数据库连接 db = pymysql.connect('localhost','root','1234','fdtest') # 使用cursor()方法创建一个游标对象cursor cursor = db.cursor() # SQL插入语句 sql = """INSERT INTO EMPLOYEE( FIRST_NAME,LAST_NAME,AGE,SEX,INCOME) VALUES('Mac2','Mohan2',20,'M',6000)""" """ 或 sql = "INS...
604
345
import os import subprocess import threading mutex = threading.Lock() def render_appleseed(target_file, base_color_tex, normal_tex, roughness_tex, metallic_tex, resolution, appleseed_path): mutex.acquire() try: # Read the template file from disk. with open("scene_template.appleseed", "r") as...
1,572
486
from ubuntui.utils import Padding from ubuntui.widgets.hr import HR from conjureup.app_config import app from conjureup.ui.views.base import BaseView, SchemaFormView from conjureup.ui.widgets.selectors import MenuSelectButtonList class NewCredentialView(SchemaFormView): title = "New Credential Creation" def...
1,327
386
""" SleekXMPP: The Sleek XMPP Library Copyright (C) 2010 Nathanael C. Fritz This file is part of SleekXMPP. See the file LICENSE for copying permission. """ __all__ = ['xep_0004', 'xep_0012', 'xep_0030', 'xep_0033', 'xep_0045', 'xep_0050', 'xep_0085', 'xep_0092', 'xep_0199', 'gmail_notify', ...
355
183
#!/usr/bin/env python3 import transactions import taxmap import db import settings import datetime import argparse import uuid import pickle import jsonpickle import logging import logging.handlers import traceback def main(): handler = logging.handlers.RotatingFileHandler('../main.log', maxBytes=33554432, backup...
5,276
1,551
from .problem import ContingentProblem as Problem from .. action import Action from .sensor import Sensor from . import errors
127
31
sum = 0 for i in xrange(1,1001): sum = sum + i**i print sum % 10000000000
80
47
#!/usr/bin/python help_msg = 'get uniprot length of entire proteome' import os, sys CWD = os.getcwd() UTLTS_DIR = CWD[:CWD.index('proteomevis_scripts')]+'/proteomevis_scripts/utlts' sys.path.append(UTLTS_DIR) from parse_user_input import help_message from read_in_file import read_in from parse_data import organism ...
2,121
863
"""データセットをダウンロードするためのスクリプトです.""" # default packages import logging import pathlib import traceback import urllib.request as request # third party import pandas as pd import tqdm as tqdm_std # my packages import src.data.directory as directory # logger logger = logging.getLogger(__name__) class TqdmUpTo(tqdm_std.tq...
2,086
733
"""Primary application. """ import json import logging import logging.config import os import sys from flask import url_for, render_template, redirect, request from i_xero import Xero2 from i_xero.i_flask import FlaskInterface from utils import jsonify, serialize_model # initialize logging # The SlackBot app doesn't...
3,320
1,113
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'F:\work\code\pyqt5\ui\main.ui' # # Created by: PyQt5 UI code generator 5.9 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): ...
8,023
2,539
class Solution(object): def reverseVowels(self, s): """ :type s: str :rtype: str """ vowels = set("aeiouAEIOU") s = list(s) i = 0 j = len(s) - 1 while i < j: while i < j and s[i] not in vowels: i +=...
587
190
# example.py import basic result = basic.add(1, 5) print(result)
68
29
import cocotb from cocotb.triggers import FallingEdge, RisingEdge, First, Timer, Event from ... import SpiSlaveBase, SpiConfig, SpiFrameError, SpiFrameTimeout class DRV8304(SpiSlaveBase): def __init__(self, signals): self._config = SpiConfig( word_width=16, cpol=False, ...
2,213
765
from app import create_app,db from flask_script import Manager,Server from app.models import User,Comment,Blog from flask_migrate import Migrate, MigrateCommand #manage.shell # Creating app instance app = create_app('production') migrate = Migrate(app,db) manager = Manager(app) manager.add_command('db',MigrateComm...
540
180
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-04-17 17:19 from __future__ import unicode_literals from django.db import migrations import django_extensions.db.fields class Migration(migrations.Migration): dependencies = [ ('core', '0004_auto_20180417_1218'), ] operations = [ ...
901
298
__author__ = 'Evan Cordell' __copyright__ = 'Copyright 2012-2015 Localmed, Inc.' __version__ = "0.1.6" __version_info__ = tuple(__version__.split('.')) __short_version__ = __version__
186
75
from django.shortcuts import render, redirect from django.contrib.auth.forms import PasswordResetForm from django.core.mail import EmailMessage from django.template import loader from django.http import HttpResponse from django.contrib.auth.decorators import login_required from django.conf import settings from django...
7,452
2,012
# Copyright 2018 ZTE 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 ...
3,911
1,198
#!/usr/bin/env python3 import javalang def isPrimitive(obj): return not hasattr(obj, '__dict__') def extract_bad_function_from_text(src): return extract_function_from_text(src, criterion='bad') def extract_function_from_text(src, criterion='bad'): def recursive_find_deepest_child_position(node_body, ...
3,304
933
import uuid import mongoengine as me from mist.api import config from mist.api.exceptions import BadRequestError from mist.api.users.models import Organization from mist.api.selectors.models import SelectorClassMixin from mist.api.rules.base import NoDataRuleController from mist.api.rules.base import ResourceRuleCo...
17,226
4,624
# -*- coding: utf-8 -*- import codecs from os.path import abspath from os.path import dirname from os.path import join from setuptools import find_packages from setuptools import setup import oidc_rp def read_relative_file(filename): """ Returns contents of the given file, whose path is supposed relative to thi...
1,685
516
from nndet.evaluator.detection.froc import FROCMetric from nndet.evaluator.detection.coco import COCOMetric from nndet.evaluator.detection.hist import PredictionHistogram
171
63
# from ankisync2.apkg import Apkg, db # Has to be done through normal database methods # def test_update(): # apkg = Apkg("example1.apkg") # for n in db.Notes.filter(db.Notes.data["field1"] == "data1"): # n.data["field3"] = "data2" # n.save() # apkg.close()
289
111
import torch import torch.nn as nn from torchvision.datasets.vision import VisionDataset from PIL import Image import os, sys, math import os.path import torch import json import torch.utils.model_zoo as model_zoo from Yolo_v2_pytorch.src.utils import * from Yolo_v2_pytorch.src.yolo_net import Yolo from Yolo_v2_pytorc...
16,931
6,091
""" Challenge Exercises for Chapter 1. """ import random import timeit from algs.table import DataTable, ExerciseNum, caption from algs.counting import RecordedItem def partition(A, lo, hi, idx): """ Partition using A[idx] as value. Note lo and hi are INCLUSIVE on both ends and idx must be valid index. C...
9,127
3,160
from typing import Dict from exaslct_src.lib.data.image_info import ImageInfo from exaslct_src.lib.data.dependency_collector.dependency_collector import DependencyInfoCollector class DependencyImageInfoCollector(DependencyInfoCollector[ImageInfo]): def is_info(self, input): return isinstance(input, Dict...
522
165
# Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
3,131
1,131
# -*- coding: utf-8 -*- # Copyright (c) 2013 Australian Government, Department of the Environment # # 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...
6,388
3,479
import torch import pytest # NOTE: also registers the KL divergence from chmp.torch_utils import NormalModule, WeightsHS, fixed def test_kl_divergence__gamma__log_normal(): p = torch.distributions.LogNormal(torch.zeros(2), torch.ones(2)) q = torch.distributions.Gamma(torch.ones(2), torch.ones(2)) torch....
1,417
536
from decimal import Decimal from unittest import TestCase from hummingbot.core.utils.fixed_rate_source import FixedRateSource class FixedRateSourceTests(TestCase): def test_look_for_unconfigured_pair_rate(self): rate_source = FixedRateSource() self.assertIsNone(rate_source.rate("BTC-USDT")) ...
867
302
import torch from torch_geometric.data import Data from graphnet.components.pool import group_pulses_to_dom, group_pulses_to_pmt, sum_pool_and_distribute from graphnet.data.constants import FEATURES from graphnet.models.detector.detector import Detector class IceCube86(Detector): """`Detector` class for IceCube-...
5,293
2,140
import re t1 = 'Data !@[value1] and also !@[system:uptime] testing.' print("Content: " + t1) if re.search('!@\[[_a-zA-Z0-9:]*\]', t1): print("YES") else: print("NO") o = re.sub('!@\[[_a-zA-Z0-9:]*\]', '_B9yPrsE_\\g<0>_B9yPrsE_', t1) o2 = o.split("_B9yPrsE_") for i in o2: if i.startswith("!@["): ...
450
227
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
5,430
1,830
# License: BSD 3 clause import os import numpy as np import scipy from tick.array.build.array import ( tick_float_array_to_file, tick_float_array2d_to_file, tick_float_sparse2d_to_file, tick_double_array_to_file, tick_double_array2d_to_file, tick_double_sparse2d_to_file, tick_float_array_...
4,580
1,385
__all__=["factory","frontend","lib","tools","creation","install","unittests"]
78
25
import dearpygui.dearpygui as dpg import datetime as dt import math from registry import * SUN_DATA.update_date() # FUNCTIONS def get_semi_circle_points( center, radius, angle_i, angle_f, segments = 360, closed = False ): points_close = [[ center[0], center[1]-radius ] , center, [ c...
20,658
8,152
""" Copyright 2019 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
4,071
1,262
# Includes some code derived from the cpython project. # Source: https://github.com/python/cpython/blob/master/Lib/zipfile.py # Excuse the mess. import argparse from hashlib import sha1 import os import struct from zipfile import _EndRecData, ZipFile from zlib import adler32 _ECD_SIGNATURE = 0 _ECD_DISK_NUMBER = 1 _...
4,714
1,761
ANNOUNCEMENT_ROLE = "941805571915513857" GUILD_ID = "878926572235665418"
74
59
## ### Copyright (C) 2018-2019 Intel Corporation ### ### SPDX-License-Identifier: BSD-3-Clause ### from ....lib import * from ..util import * from .transcoder import TranscoderTest spec = load_test_spec("mpeg2", "transcode") class to_avc(TranscoderTest): @slash.requires(*have_gst_element("msdkh264enc")) @slash.re...
3,352
1,390
import os, time, mimetypes, glob from django.utils.translation import gettext_lazy as _ from django.urls import reverse from task.const import * from task.models import Task, detect_group from rusel.base.config import Config from rusel.base.forms import CreateGroupForm from rusel.context import get_base_context from ru...
10,220
3,093
import os,rootpath rootpath.append(pattern='main.py') # add the directory of main.py to PATH import glob from kivy.app import App from kivy.lang import Builder from kivy.properties import ObjectProperty,DictProperty,ListProperty from kivy.uix.boxlayout import BoxLayout import logging,importlib,pkgutil class Debugger(B...
2,046
754
import numpy as np class Perceptron: def __init__(self, weight, bias=0): self.weight = weight self.bias = bias def __repr__(self): return 'Perceptron(weight=%r, bias=%r)' % (self.weight, self.bias) def __get_predictions(self, data): return np.dot(data, self.weight) + self...
1,885
578
import numpy as np from numba import guvectorize @guvectorize(["void(float32[:], int32, int32, float32[:])", "void(float64[:], int32, int32, float64[:])", "void(int32[:], int32, int32, int32[:])", "void(int64[:], int32, int32, int64[:])"], "(n),(),()->(n)", nopyt...
901
437
def is_true(a,b,c,d,e,f,g): if a>10: print(10)
61
39
import tcod from input_handlers import handle_keys from game_states import GameStates from render_functions import clear_all, render_all, RenderOrder from map_objects.game_map import GameMap from fov_functions import initialize_fov, recompute_fov from entity import Entity, get_blocking_entity_at_location from compon...
5,109
1,590
# (c) 2012-2019, Ansible by Red Hat # # This file is part of Ansible Galaxy # # Ansible Galaxy is free software: you can redistribute it and/or modify # it under the terms of the Apache License as published by # the Apache Software Foundation, either version 2 of the License, or # (at your option) any later version. # ...
2,337
675
# -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt from __future__ import unicode_literals import frappe import unittest class TestStockSettings(unittest.TestCase): def setUp(self): frappe.db.set_value("Stock Settings", None, "clean_description_html", 0) ...
1,933
800
import logging import requests class Http: def sendRequest(url): payload = requests.get(str(url)) statusCode = payload.status_code content = payload.content if statusCode != 200: return logging.error(f"[Pybloxy - GET] Something went wrong! Error Code: {statusCode}") return content def postRequest(u...
1,148
390
#!/usr/bin/env python import rospy from std_msgs.msg import Float64 import random possibleLayers = [140, 50, 80, 200, 100] cur_position = 0.0 def position_callback(msg): global cur_position cur_position = msg.data #Build the layers simulation, then publish material strengths. Lasts 100 seconds. def runLayers...
1,305
475
import scrapy import re from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from ..items import ImagescraperItem class ImageCrawlSpiderSpider(CrawlSpider): name = "image_crawl_spider" allowed_domains = ["books.toscrape.com"] def start_requests(self): url =...
1,121
352