id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
170777
import torch import torch.nn as nn from mmcv.runner import ModuleList from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, build_assigner, build_sampler, merge_aug_bboxes, merge_aug_masks, multiclass_nms) from ..builder import HEADS, build_head, build_roi_extract...
StarcoderdataPython
3220253
# 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 ag...
StarcoderdataPython
147674
<filename>src/ui/file_options_dialog.py<gh_stars>1-10 # # <NAME> # # Version 3.0 onwards # # Copyright (c) 2021 dmh23 # import tkinter as tk import tkinter.messagebox as messagebox from src.ui.dialog import Dialog class FileOptionsDialog(Dialog): def __init__(self, parent): self._configManager = parent...
StarcoderdataPython
3272516
""" 可以通过以下接口来控制Xshell的会话。包括打开、关闭会话,记录会话日志等。 """ Connected = False # 当前会话是否连接 LocalAddress = "LocalAddress" # 获取本地地址 Path = "Path" # 获取当前会话文件路径 RemoteAddress = "RemoteAddress" # 获取远端地址 RemotePort = "RemotePort" # 获取远端端口号 Logging = False # 当前会话是否正在记录日志文件 LogFilePath = "LogFilePath" # 存放日志文件的路径 def Open(lpszSess...
StarcoderdataPython
47648
<reponame>minnieteng/smoke_project<filename>smoke/box/FeatureTimeSpaceGrid.py import os import json import tarfile import tempfile import numpy as np import numpy.ma as ma import matplotlib.pyplot as plt from datetime import datetime, timedelta from pytz import timezone from geopy.distance import distance from scipy.op...
StarcoderdataPython
3356901
<gh_stars>0 import concurrent.futures from copy import deepcopy from .SimulationResult import SimulationResult from .Simulator import Simulation from ..core.logger import Logger class Coordinator: def __init__(self, game, logger, count=1000, parallels=5): self._game = game self._max = count ...
StarcoderdataPython
186414
<filename>Flask/8_context.py from flask import Flask @app.route("/index") #线程局部变量 request def index(): request.form.get("name")
StarcoderdataPython
3377003
import handle_input as input import game_flags as flags import pygame as pg class Pacman(pg.sprite.Sprite): # Constructor def __init__(self, pos=(-1, -1)): # Call the parent class (Sprite) constructor pg.sprite.Sprite.__init__(self) size = (32, 32) self.pos = pos ...
StarcoderdataPython
1628212
<filename>main/urls.py from django.urls import path from . import views app_name = 'main' urlpatterns = [ path('', views.home, name='home'), path('savematkul/', views.savematkul, name='savematkul'), path('savetugas/<int:pk>', views.savetugas, name='savetugas'), ]
StarcoderdataPython
3297157
<filename>loop_message.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- from telegram.ext import Updater, MessageHandler, Filters import traceback as tb import json import random import threading START_MESSAGE = (''' Loop message in chat / group / channel. add - /add message: add message to loop. list - /list: lis...
StarcoderdataPython
58189
import tarfile import os tar_content_files = [ {"name": "config", "arc_name": "config"}, {"name": "out/chart-verifier", "arc_name": "chart-verifier"} ] def create(release): tgz_name = f"chart-verifier-{release}.tgz" if os.path.exists(tgz_name): os.remove(tgz_name) with tarfile.ope...
StarcoderdataPython
198014
<filename>backend/django/core/migrations/0023_trainingset_celery_task_id.py # -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-10-27 19:13 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("core", "0022_dat...
StarcoderdataPython
3357865
<filename>src/website/admin.py<gh_stars>0 from django.contrib import admin from .models import ScanImage, Session class ImageAdmin(admin.ModelAdmin): list_display = ['pk', 'image_url', 'created_on'] admin.site.register(ScanImage, ImageAdmin) admin.site.register(Session)
StarcoderdataPython
1720665
<reponame>joe307bad/cyborgbackup # Generated by Django 2.2.17 on 2021-01-15 20:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0010_client_bandwidth_limit'), ] operations = [ migrations.AddField( model_name='setti...
StarcoderdataPython
120948
<reponame>gkimeeq/WebCrawler # coding=utf-8 from scrapy.exceptions import DropItem import json import pymongo # 过滤价格的管道 class PricePipeline(object): vat_factor = 1.15 def process_item(self, item, spider): if item.get('price'): if item.get('price_excludes_vat'): item['pric...
StarcoderdataPython
1724649
<reponame>Lilith5th/Radiance<filename>test/testcases/px/test_phisto.py # -*- coding: utf-8 -*- from __future__ import division, print_function, unicode_literals import os import unittest import testsupport as ts from pyradlib import lcompare from pyradlib.pyrad_proc import PIPE, Error, ProcMixin class PhistoTestCas...
StarcoderdataPython
4812009
# -*- coding: utf-8 -*- '''Text block objects based on PDF raw dict extracted with ``PyMuPDF``. Data structure based on this `link <https://pymupdf.readthedocs.io/en/latest/textpage.html>`_:: { # raw dict # -------------------------------- 'type': 0, 'bbox': (x0,y0,x1,y1), ...
StarcoderdataPython
41138
import unittest import uuid from . import user_util class TestUtilFuncs(unittest.TestCase): def test_hash_and_verify_password(self): passwords = [str(uuid.uuid4()) for i in range(10)] for pw in passwords: self.assertTrue( user_util.verify_password(pw, user_util.hash_p...
StarcoderdataPython
162261
<reponame>Rasterer/tvm<gh_stars>1-10 import numpy as np from tvm import relay from tvm.relay.ir_pass import infer_type from tvm.relay.scope_builder import ScopeBuilder from tvm.relay.op import add from tvm.relay.module import Module # @tq, @jr should we put this in testing ns? def check_rts(expr, args, expected_resul...
StarcoderdataPython
1735861
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutStrings(Koan): def test_double_quoted_strings_are_strings(self): string = "Hello, world." self.assertEqual(True, isinstance(string, str)) def test_single_quoted_strings_are_also_strings(self): string =...
StarcoderdataPython
74112
from deepproblog.utils import check_path template = """ [Default] batch_size = {0} infoloss = {1} name = poker_batch_{0}_infoloss_{1} """ i = 0 check_path("parameter_cfg/0.cfg") for batch_size in [10, 25, 50, 100]: for infoloss in [0, 0.5, 1.0, 2.0, 4.0]: with open("parameter_cfg/{}.cfg".format(i), "w") ...
StarcoderdataPython
164527
""" Script containing methods useful for other plots """ import csv import pathlib import shutil import numpy as np from matplotlib import patches from config import FrameworkConfiguration def get_font_family_and_size(): """ Function to globally set and get font family and font size for plots """ ...
StarcoderdataPython
15878
# ---------------------------------------------------------------------- # | # | CastExpressionParserInfo_UnitTest.py # | # | <NAME> <<EMAIL>> # | 2021-10-04 09:14:16 # | # ---------------------------------------------------------------------- # | # | Copyright <NAME> 2021 # | Distributed under the B...
StarcoderdataPython
115676
<gh_stars>10-100 # Generated by Django 3.0.2 on 2020-01-25 19:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('channels', '0003_auto_20200110_0200'), ] operations = [ migrations.AlterField( model_name='channel', ...
StarcoderdataPython
1797470
""" projects subsystem's configuration - config-file schema - settings """ import trafaret as T CONFIG_SECTION_NAME = "projects" schema = T.Dict({T.Key("enabled", default=True, optional=True): T.Bool()})
StarcoderdataPython
1603416
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('event', '0001_initial'), migrations.swappable_dependency(settings.AUTH_...
StarcoderdataPython
3216019
<reponame>gleckler1/pcmdi_metrics import genutil ################################################################################ # OPTIONS ARE SET BY USER IN THIS FILE AS INDICATED BELOW BY: # ################################################################################ ## RUN IDENTIFICATION # DEFINES A SUBDIR...
StarcoderdataPython
4840312
<filename>BookAnalyzer.py from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter from pdfminer.converter import TextConverter from pdfminer.layout import LAParams from pdfminer.pdfpage import PDFPage from io import StringIO from re import findall # --------------------------------------------------...
StarcoderdataPython
3260478
import yaml import pandas as pd import subprocess import numpy as np from tabulate import tabulate import ruamel.yaml DATE='Date' DUE='Due' def load_yaml_file(file): """ Loads a yaml file from file system. @param file Path to file to be loaded. """ try: with open(file, 'r') as yaml: ...
StarcoderdataPython
128087
<reponame>ConsenSys/mythx-models """This module contains the GroupListRequest domain model.""" from datetime import datetime from typing import Optional from pydantic import BaseModel, Field class GroupListRequest(BaseModel): offset: Optional[int] created_by: Optional[str] = Field(alias="createdBy") gro...
StarcoderdataPython
156913
# vim:fileencoding=UTF-8 # # Copyright © 2015, 2019 <NAME> # # Licensed under the Apache License, Version 2.0 with modifications # and the "Commons Clause" Condition, (the "License"); you may not # use this file except in compliance with the License. You may obtain # a copy of the License at # # https://raw.githubu...
StarcoderdataPython
1729797
<reponame>aj-clark/earthenterprise<gh_stars>1-10 #-*- Python -*- # # Copyright 2017 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...
StarcoderdataPython
4828691
<gh_stars>10-100 class CountryCodeException(Exception): """ Country Code is not present in the Phone Number """ pass class CallTimeException(Exception): """ Wait time is too short for WhatsApp Web to Open """ pass class InternetException(Exception): """ Host machine is not ...
StarcoderdataPython
3237657
"""Main module tests.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import os import os.path as op import tempfile import shutil import numpy as np import tables as tb from nose import with_s...
StarcoderdataPython
1653831
""" File name: gdax/client.py Author: <NAME> <<EMAIL>> Implementation of GDAX Client to get realtime data. """ import json from datetime import datetime, timedelta from websocket import create_connection from cryptostreamer.provider import ProviderClient class NoProductsError(Exception): pass class NoChannelsEr...
StarcoderdataPython
1688491
from __future__ import print_function import sys, os, importlib import PARAMETERS locals().update(importlib.import_module("PARAMETERS").__dict__) #################################### # Parameters #################################### subdirs = ['positive', 'testImages'] #################################### # Main ##...
StarcoderdataPython
4831945
<reponame>zbwa/selenium_python """Класс логирования""" import logging import inspect def customLogger(logLevel=logging.DEBUG): loggerName = inspect.stack()[1][3] logger = logging.getLogger(loggerName) logger.setLevel(logging.DEBUG) fileHandler = logging.FileHandler('automation.log', mode='a') fi...
StarcoderdataPython
39139
<gh_stars>1-10 """ Created by <NAME>. """ from ekphrasis.classes.preprocessor import TextPreProcessor from ekphrasis.classes.tokenizer import SocialTokenizer from ekphrasis.dicts.emoticons import emoticons from textblob_de.lemmatizers import PatternParserLemmatizer from tqdm import tqdm from nltk.corpus import stopwor...
StarcoderdataPython
110177
# Update this file for version changes __version__ = '0.5.3'
StarcoderdataPython
117871
<reponame>Vimalanathan93/Udacity-DLND import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler from torch.autograd import Variable import torch.nn.functional as F import numpy as np import torchvision from torchvision import datasets, models, transforms import matplotlib.pyplo...
StarcoderdataPython
1678818
from __future__ import division from __future__ import print_function from __future__ import absolute_import from builtins import zip from builtins import range from builtins import object from past.utils import old_div import numpy as np import pandas as pd import os import collections from ..serialize import Seriali...
StarcoderdataPython
176534
<gh_stars>0 class RedbotMotorActor(object): # TODO(asydorchuk): load constants from the config file. _MAXIMUM_FREQUENCY = 50 def __init__(self, gpio, power_pin, direction_pin_1, direction_pin_2): self.gpio = gpio self.power_pin = power_pin self.direction_pin_1 = direction_pin_1...
StarcoderdataPython
3217030
# ---------------------------------------------------------- # Define resources # ---------------------------------------------------------- import logging from threading import Timer from datetime import datetime from ...kernel.agent.Action import Action # ---------------------------------------------------------- # ...
StarcoderdataPython
193226
<reponame>hpd/general ''' A script to create Maya lights and cameras from Otoy light stage data files Usage: import os import sys sys.path.append( "/path/to/script" ) import mayaLightStageImport as mlsi lightStageData = "/path/to/lightStage/data" cameraDir = os.path.join( lightStageData, "CH2_cameras" )...
StarcoderdataPython
4825033
import datetime from contextlib import contextmanager from flask_sqlalchemy import BaseQuery from flask_sqlalchemy import SQLAlchemy as _SQLAlchemy from sqlalchemy import asc, desc class SQLAlchemy(_SQLAlchemy): @contextmanager def auto_commit(self): try: yield self.session.co...
StarcoderdataPython
75574
from pathlib import Path from lib_bgp_simulator import BaseGraphSystemTester from lib_bgp_simulator import BGPSimpleAS from lib_bgp_simulator import ROVSimpleAS from lib_bgp_simulator import Graph013 from ..unstable import Unstable from ....as_classes import ROVPPV1SimpleAS from ....as_classes import ROVPPV2SimpleAS ...
StarcoderdataPython
1726948
# Much of the code below has been copied from # https://github.com/google/earthengine-api/blob/master/python/ee/cli/commands.py import sys import datetime import csv import ee class ReportWriter(object): def __init__(self, filename=None): self.total_size = 0 self.writers = [csv.writer(sys.stdout...
StarcoderdataPython
1730970
<reponame>makemebitter/cerebro-ds # Copyright 2020 <NAME> and <NAME>. 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 #...
StarcoderdataPython
3261853
<gh_stars>0 result = (int(input()) ** int(input())) + (int(input()) ** int(input())) print(result)
StarcoderdataPython
114328
<filename>senscritiquescraper/utils/search_utils.py import logging from bs4 import BeautifulSoup from typing import Optional import urllib.parse logger = logging.getLogger(__name__) GENRE_CHOICES = ["Morceaux", "Albums", "Films", "Livres", "Séries", "BD", "Jeux"] def sanitize_text(text: str) -> str: """Sanitize...
StarcoderdataPython
44828
<filename>exam_system/exams/models.py from django.db import models from questions.models import Question from topics.models import Topic class Exam(models.Model): id = models.AutoField(primary_key = True) name = models.TextField() start_date = models.DateField() end_date = models.DateField() number_of_question = ...
StarcoderdataPython
1677440
<reponame>vnitinv/thrift-versioning-py # # Autogenerated by Thrift Compiler (0.9.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py # from thrift.Thrift import TType, TMessageType, TException, TApplicationException from thrift.transport import TTransport from thrift.protoc...
StarcoderdataPython
1606654
from ..models import * import bcrypt def setPassword(request): try: passwordObj = ApiPassword() except: return '400' try: ApiPassword.objects.get(apiName=request['apiName']) return "409-1" except: passwordObj.apiName = request['apiName'] passwordObj.apiP...
StarcoderdataPython
3253641
<reponame>daljaru/daljaru.github.io<gh_stars>0 adj_list = [[2,1], [3,0], [3,0], [9,8,2,1], [5], [7,6,4], [7,5], [6,5], [3], [3]] N = len(adj_list) visited = [False] * N def bfs(i): queue = [] visited[i]...
StarcoderdataPython
1731263
<reponame>StephenZhang945/P3_Behavioral-Cloning import csv import cv2 import numpy as np import random import sklearn from sklearn.model_selection import train_test_split samples = [] with open('./data/driving_log.csv') as csvfile: reader = csv.reader(csvfile) for line in reader: samples.append(line) ...
StarcoderdataPython
1768877
<gh_stars>0 from django.contrib import admin from hello.models import Post class PostAdmin(admin.ModelAdmin): list_display = ('id', 'title', 'content') search_fields = ('title', 'content') admin.site.register(Post, PostAdmin)
StarcoderdataPython
1690853
import yaml from mule.task.mule import get_configs, list_agents, list_env, list_jobs, list_tasks from mule.task.error import messages from mule.logger import logger, start_debug import mule.task.parser from mule.task import Job from mule.util import JobContext, prettify_json import mule.util.yaml.env_var_loader as yaml...
StarcoderdataPython
1737751
# Generated by Django 2.0.2 on 2018-07-20 04:47 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('user_app', '0017_auto_20180720_0446'), ] operations = [ migrations.AlterField( model_name='regularuser', name='event...
StarcoderdataPython
7146
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
StarcoderdataPython
3371520
<filename>simple_neural_net/prediction_models.py import numpy as np class PredictionModel: def predictions( self, outputs ): # outputs: (num_outputs, num_examples) # predictions: (?, num_examples) raise NotImplementedError('Method must be implemented by child class') cl...
StarcoderdataPython
26171
<filename>calico/etcddriver/test/test_hwm.py # -*- coding: utf-8 -*- # Copyright (c) 2015-2016 Tigera, 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:/...
StarcoderdataPython
21271
<reponame>AliRzvn/HW1 import numpy as np from module import Module class Linear(Module): def __init__(self, name, input_dim, output_dim, l2_coef=.0): super(Linear, self).__init__(name) self.l2_coef = l2_coef # coefficient of l2 regularization. self.W = np.random.randn(input_dim, output_...
StarcoderdataPython
95060
<filename>draugr/torch_utilities/tensors/__init__.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "<NAME>" __doc__ = r""" Created on 21/02/2020 """ from pathlib import Path with open(Path(__file__).parent / "README.md", "r") as this_init_file: __doc__ += this_init_file.read(...
StarcoderdataPython
1783317
from .signals import events
StarcoderdataPython
3267724
from django.db import models from django.utils import timezone from django.contrib.postgres.fields import JSONField # Create your models here. # Extra fields to be added in the json file: related_entity, reputation_dimension, sentiment_score class Tweet(models.Model): tweet_id = models.CharField(max_length=50, pr...
StarcoderdataPython
3248056
''' Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0 This walks all of the combinations of metrics, dimensions, and aggregations. METRICS - contains descriptions of the metric to be pulled and the dimensions for that metric. See also the docs here: https://opendist...
StarcoderdataPython
69088
<filename>DataFrameDemo.py #ss DataFrameDemo.py from pyspark.sql import SparkSession from pyspark.sql.functions import col from pyspark.sql.functions import mean from pyspark.sql.types import Row from pyspark.sql.functions import pandas_udf import pandas as pd from pyspark.sql.functions import expr from pyspark.sql.fun...
StarcoderdataPython
1783015
<gh_stars>1-10 from django.shortcuts import render from rest_framework import viewsets from ..models import NewsHeading from ..serializers import NewsHeadingSerializer class NewsHeadingViewSet(viewsets.ReadOnlyModelViewSet): queryset = NewsHeading.objects.all().order_by('pk') serializer_class = NewsHeadingSer...
StarcoderdataPython
3277148
import demistomock as demisto from CommonServerPython import * def get_query(cre_name_null): if cre_name_null == "False": query = "SELECT *,\"CRE Name\",\"CRE Description\",CATEGORYNAME(highlevelcategory) " \ "FROM events WHERE \"CRE NAME\" <> NULL AND INOFFENSE({0}) START '{1}'" else:...
StarcoderdataPython
1694972
<filename>utils/request.py from dataclasses import dataclass from typing import Dict, Any import requests @dataclass class Response: status_code: int text: str as_dict: object headers: dict class APIRequest: def get(self, url: str) -> Response: response = requests.get(url) retur...
StarcoderdataPython
4807210
from github.celery import app as celery_app
StarcoderdataPython
1726546
from django_de.global_settings import * import dj_database_url DATABASES = {'default': dj_database_url.config()} # Honor the 'X-Forwarded-Proto' header for request.is_secure() SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') ALLOWED_HOSTS = ( 'djangode.herokuapp.com', 'django-de.org', 'www....
StarcoderdataPython
70872
<reponame>vfloeser/TumorDelivery<filename>plotuw.py ########################################################################################## # G E N E R A L I N F O # # ...
StarcoderdataPython
1621664
# Generated by Django 3.0.8 on 2020-08-07 16:00 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Account', fields=[ ('id', models.AutoField(...
StarcoderdataPython
3266023
# Copyright (c) 2020-2021, <NAME> # License: MIT License from typing import TYPE_CHECKING, Tuple import math from ezdxf.math import Vec3, X_AXIS, Y_AXIS, Vec2, Matrix44, sign, OCS if TYPE_CHECKING: from ezdxf.eztypes import DXFGraphic, Vertex __all__ = [ "TransformError", "NonUniformScalingError", "In...
StarcoderdataPython
1723489
<filename>test/test_strengthening.py from meteor_reasoner.graphutil.graph_strengthening import * from meteor_reasoner.classes import * import copy def test_strengthening(): head = Atom("C", tuple([Term("nan")])) literal_a = Literal(Atom("A", tuple([Term("X", "variable")])), [Operator("Boxminus", Interval(1, 2...
StarcoderdataPython
1611078
""" Classes for running optimization problems.""" # Author: <NAME> (modified by <NAME>) # License: BSD 3 clause from .ga_runner import GARunner from .rhc_runner import RHCRunner from .sa_runner import SARunner from .mimic_runner import MIMICRunner from .nngs_runner import NNGSRunner from .skmlp_runner import SKMLPRun...
StarcoderdataPython
17192
# Machine Learning Online Class - Exercise 2: Logistic Regression # # Instructions # ------------ # # This file contains code that helps you get started on the logistic # regression exercise. You will need to complete the following functions # in this exericse: # # sigmoid.py # costFunction.py # predic...
StarcoderdataPython
4813263
import logging from smbus2 import SMBus from twisted.internet.task import LoopingCall bus = SMBus(1) logger = logging.getLogger(__name__) def _periodic_check_door(instance): try: try: bus_data = bus.read_i2c_block_data(instance.sensor_i2c_address, 0, 8) except OSError: re...
StarcoderdataPython
191811
#! /usr/bin/env nix-shell #! nix-shell -i python3 leaflet.nix import os import folium import glob import pickle from urllib.parse import urlsplit, urlunsplit import html import sys from osgeo import gdal, osr from branca.element import CssLink, Figure, JavascriptLink, MacroElement from jinja2 import Template import j...
StarcoderdataPython
1600622
""" A tool for application models to register themselves so that they serve a standard interface """ from abc import ABC, abstractmethod from autumn.model_runner import build_model_runner from autumn.constants import Region class RegionAppBase(ABC): @abstractmethod def build_model(self, params): pass...
StarcoderdataPython
170568
<gh_stars>0 # Copyright 2020 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 ap...
StarcoderdataPython
4840968
from os.path import join from Input import gui, readData from Process import processQuestion from Output import saveToFile, success def buildPolls(lines, t, d, f): p = join(d, f) + "-" fileCount = 0 while lines: output, start = processQuestion(lines, t) if output is None: retu...
StarcoderdataPython
3230508
import cv2 import face_recognition from urllib.request import urlretrieve from pathlib import Path import os import tempfile from sys import platform import random import string import utils.console as console class FaceRecog: def __init__(self, profile_list, profile_img, num_jitters=10): self.profile_li...
StarcoderdataPython
1797875
<gh_stars>1-10 for r in range(9): for c in range(r + 1): print("%dx%d" % (r + 1, c + 1), end=" ") print()
StarcoderdataPython
1732214
""" readal.py Galaxy wrapper for automatic conversion of alignments into different formats using ReadAl version 1.4 """ import sys,optparse,os,subprocess,tempfile,shutil class Test: """ """ def __init__(self,opts=None): self.opts = opts self.iname = 'infile_copy' shutil.copy(self...
StarcoderdataPython
1661372
from django.urls import include, path from rest_framework.urlpatterns import format_suffix_patterns from . import views urlpatterns = [ path('getAvailableAssets', views.all_asset), path('getassetmarketprice/<str:name>', views.price_asset) ] urlpatterns = format_suffix_patterns(urlpatterns)
StarcoderdataPython
185714
import socket import threading from . import logger class TelnetConnectionHandler(threading.Thread): def __init__(self, sock, address, clients, lock): super().__init__() self.socket = sock self.address, self.port = address self.clients = clients self.lock = lock @pro...
StarcoderdataPython
65711
"""File to hold important constant values and configure drone upon startup""" from mavsdk import System MAX_ALT: int = 750 # Feet TAKEOFF_ALT: int = 100 # Feet WAIT: float = 2.0 # Seconds async def config_params(drone: System) -> None: """ Sets certain parameters within the drone for flight ...
StarcoderdataPython
3370309
class Solution: def verticalTraversal(self, root: TreeNode) -> List[List[int]]: node_list = [] def DFS(node, row, column): if node is not None: node_list.append((column, row, node.val)) # preorder DFS DFS(node.left, row + 1, column - 1) ...
StarcoderdataPython
3205404
<filename>pyelixys/hal/elixysobject.py<gh_stars>0 #!/usr/bin/env python import sys from pyelixys.hal.hwconf import config class ElixysObject(object): """Parent object for all elixys systems All onjects can therefore access the system config and status """ sysconf = config
StarcoderdataPython
12565
<reponame>icbi-lab/nextNEOpi #!/usr/bin/env python """ Requirements: * Python >= 3.7 * Pysam Copyright (c) 2021 <NAME> <<EMAIL>> MIT License <http://opensource.org/licenses/MIT> """ RELEASE = False __version_info__ = ( "0", "1", ) __version__ = ".".join(__version_info__) __version__ += "-dev" if no...
StarcoderdataPython
4812337
<reponame>ooici/pyon # $ANTLR 3.1.3 Mar 18, 2009 10:09:25 src/SavedFSM/Monitor.g 2012-03-12 22:09:37 import sys from antlr3 import * from antlr3.compat import set, frozenset # for convenience in actions HIDDEN = BaseRecognizer.HIDDEN # token types RESV=12 ANNOTATION=25 ASSERTION=28 PARALLEL=19 T__61=61 ID=26 T__60=...
StarcoderdataPython
153314
""" return a new sorted merged list from K sorted lists, each with size N. """ from functools import reduce flat_map = lambda f, xs: reduce(lambda a, b: a + b, map(f, xs)) # O(KN log KN) def merge_lists(lists): # flattend_list = [] # for l in lists: # flattend_list.extend(l) flattend_list = flat_m...
StarcoderdataPython
1672816
<reponame>omarocegueda/dipy<gh_stars>0 import numpy as np from .localtrack import local_tracker from dipy.align import Bunch from dipy.tracking import utils # enum TissueClass (tissue_classifier.pxd) is not accessible # from here. To be changed when minimal cython version > 0.21. # cython 0.21 - cpdef enum to export ...
StarcoderdataPython
3229751
<reponame>mail2nsrajesh/ansible-pacemaker #!/usr/bin/python # (c) 2017, <NAME> <<EMAIL>> # # Copyright Red Hat, 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 ...
StarcoderdataPython
157190
<reponame>mdgaziur/Ranky ''' Data list contains all users info. Each user's info must be a list. First Element: 0 (int) Second Element: name (str) Third Element: username (str) Fourth Element: toph link (str) Fifth Element: dimik link (str) Sixth Element: uri link (str) Note: If any user does n...
StarcoderdataPython
1693185
from evaluation import AbstractEvaluation from alignment.data import AlignmentMatch from tools import ConfigConsts import bert_score class BertScoreMetric(AbstractEvaluation): def getMetricName(self): return "BertScore" def evaluate(self, alignmentMatches): process_line = [] align_li...
StarcoderdataPython
159576
<reponame>theplusagency/wagtail-commerce # -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-09-17 20:09 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import wagtailcommerce.products.models class Migration(migrations.Migration): initia...
StarcoderdataPython
1724282
# _*_ coding:utf-8 _*_ if __name__ == "__main__": # squares = [1, 4, 9, 16, 25] # print(squares) # print(squares[0]) # print(squares[-1]) # print(squares[0:]) # print(squares[:-1]) # print(squares + [36, 49, 64, 81, 100]) # cubes = [1, 8, 27, 65, 125] # print(cubes) # cubes[3] =...
StarcoderdataPython