id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
5067902
# --depends-on commands # --depends-on config import re import traceback from src import ModuleManager, utils REGEX_SED = re.compile("^(?:(\\S+)[:,] )?s/") @utils.export("channelset", utils.BoolSetting("sed", "Disable/Enable sed in a channel")) @utils.export( "channelset", utils.BoolSetting( "sed-...
StarcoderdataPython
4946406
<reponame>visnz/sketchfab_download #!BPY """ Name: 'COLLADA 1.3.1 (.dae) ...' Blender: 237 Group: 'Import' Tooltip: 'Import scene from COLLADA format (.dae)' """ __author__ = "<NAME>" __url__ = ("blender", "blenderartist.org", "Project homepage, http://colladablender.sourceforge.net",) __version__ = "0.4" __bpydoc__ ...
StarcoderdataPython
12846798
def createDynamicAttribute(nodeName, attrName, attrType, value): pass def findNodeFromMaya(nodeName): pass def findSelectedNodeFromMaya(): pass def resolveIconFile(filename): """ Resolve filenames using the XBMLANGPATH icon searchpath or look through the embedded Qt resources (if the path ...
StarcoderdataPython
114247
<reponame>BenoitAnastay/aiohue<gh_stars>0 """Model(s) for device resource on HUE bridge.""" from dataclasses import dataclass from enum import Enum from typing import Optional, Type from .group import Group from .resource import NamedResourceMetadata, ResourceTypes class DeviceArchetypes(Enum): """ Enum wit...
StarcoderdataPython
214452
<reponame>dualspiral/makecourse<filename>makeCourse/plastex/overrides/macros.py from plasTeX import Command, sourceChildren, Environment from plasTeX.Base.LaTeX import Math from plasTeX.Base.TeX import Primitives from plasTeX.Tokenizer import Token, EscapeSequence, Other class numbas(Command): args = '[ intro:str ...
StarcoderdataPython
9727170
import typing import numpy as np import pandas as pd from sklearn.neighbors import NearestNeighbors from minerva.metafeatures.metafeature import MetaFeatureValue class DatasetRegistry: r"""Registry for training datasets. Provides convenience methods for finding training datasets with metafeatures similar t...
StarcoderdataPython
4800292
<filename>dialogue-engine/test/programytest/mappings/test_denormalise.py """ Copyright (c) 2020 COTOBA DESIGN, Inc. 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 w...
StarcoderdataPython
1778154
# coding=utf-8 """ parse2csv ~~~~~~~~~ A command-line tool to parse multiple files for named patterns and write the values in CSV format. :copyright: (c) 2018 by <NAME>. :license: MIT, see LICENSE for more details. """ from .parse2csv import generate #noqa from .parse2csv import list_dialec...
StarcoderdataPython
3254485
<reponame>padre-lab-eu/extended_simiir<filename>ifind/search/engines/companycheck.py import json import requests from ifind.search.engine import Engine from ifind.search.response import Response from ifind.search.exceptions import EngineAPIKeyException, QueryParamException, EngineConnectionException from ifind.utils.en...
StarcoderdataPython
3376766
<reponame>ThijsEigenwijs/lykos import re import random import itertools import math from collections import defaultdict from src.utilities import * from src import users, channels, status, debuglog, errlog, plog from src.decorators import command, event_listener from src.containers import UserList, UserSet, UserDict, ...
StarcoderdataPython
3285508
import pandas as pd import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry from bs4 import BeautifulSoup import random import time import logging def calculate_pagecount(total_items): if int(total_items)%100 ==0: pages = int(total_items)//100 el...
StarcoderdataPython
6663078
<reponame>predicatemike/predigame<gh_stars>0 WIDTH = 20 HEIGHT = 10 TITLE = 'Piggys Revenge' # use a grass background BACKGROUND = 'ville' piggy = actor('Piggy', (-5, 7), size=3).speed(7) piggy.act(RUN_RIGHT, FOREVER) def zombies(): z3 = actor('Zombie-3', (-9, 7), size=3) z1 = actor('Zombie-1', (-6, 7), siz...
StarcoderdataPython
6525397
<filename>multi-region-bucket/lambda.py """Lambda function for forward content of one bucket to multiple other buckets""" import ast import os import urllib import boto3 REPLICATION_REGIONS = os.environ.get('REPLICATION_REGIONS') BUCKET_OBJECT_ACL = os.environ.get('BUCKET_OBJECT_ACL') def lambda_handler(event, _): ...
StarcoderdataPython
12861873
''' Intermediate C#1, stigid PROBLEM: Given a number less than 10^50 and length n, find the sum of all the n -digit numbers (starting on the left) that are formed such that, after the first n -digit number is formed all others are formed by deleting the leading digit and taking the next n -digits. '''...
StarcoderdataPython
4957931
import numpy as np import iminuit as minuit import time import functools import logging from scipy.special import ndtri, erf from collections import OrderedDict from copy import deepcopy import numpy as np # --- Helper functions ------------------------------------- # def set_default(func = None, passed_kwargs = {})...
StarcoderdataPython
8097846
<filename>player.py class Player: VERSION = "<NAME>" def betRequest(self, game_state): ACE_PAIR = game_state['players'][game_state['in_action']]['hole_cards'][0]['rank'] == 'A' and \ game_state['players'][game_state['in_action']]['hole_cards'][1]['rank'] == 'A' PAIR = game...
StarcoderdataPython
6460920
<gh_stars>0 #!/usr/bin/python3 # -*- coding: utf-8 -*- """ Instagram Access and Configurations """ INSTA_USERNAME = "" INSTA_PASSWORD = "" INSTA_TAGS_FOLLOW = "amazing, beautiful, adventure" INSTA_UNFOLLOW_DISABLED = "leh.ellen01" INSTA_COPY_FOLLOWERS_FROM = "leh.ellen01" """ Facebook Access and Configurations """ F...
StarcoderdataPython
8030491
# -*- coding: utf-8 -*- import numpy as np from meteography.features import RawFeatures IMG_SIZE = 20 class TestRawFeatures: def test_extract_samesize(self): shape = (IMG_SIZE, IMG_SIZE) data = np.random.rand(IMG_SIZE * IMG_SIZE) extractor = RawFeatures(shape, shape) features = e...
StarcoderdataPython
4974157
<gh_stars>0 # -*- coding: utf-8 -*- ########################################################################################### # # Author: astips - (animator.well) # # Date: 2017.03 # # Url: https://github.com/astips # # Description: studio url base class # ############################################################...
StarcoderdataPython
6414280
import os import csv csvpath ='Resources/election_data.csv' total_votes = 0 candidate = [] # Full List of candidates candidate_Name = "" candidate_votes =[] percentage_votes =[] #Open and read csv file with open(csvpath) as csvfile: #, newline = '', encoding = 'latin-1') as csvfile: csv_reader =csv.reader(csvfile,...
StarcoderdataPython
9768761
from rpython.annotator import model from rpython.annotator.listdef import ListDef from rpython.annotator.dictdef import DictDef def none(): return model.s_None def impossible(): return model.s_ImpossibleValue def float(): return model.SomeFloat() def singlefloat(): return model.SomeSingleFloat()...
StarcoderdataPython
172862
import numpy as np import random from collections import namedtuple, deque from DQNmodel import QNetwork import torch import torch.nn.functional as F import torch.optim as optim BUFFER_SIZE = int(1e5) # replay buffer size BATCH_SIZE = 64 # minibatch size GAMMA = 0.99 # discount factor TAU = 1e-3 ...
StarcoderdataPython
4811374
# Generated by Django 2.2 on 2019-04-02 14:30 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('internet_nl_dashboard', '0016_auto_20190401_1626'), ] operations = [ migrations.AddField( model_name='urllist', name='...
StarcoderdataPython
5175280
<filename>com/Leetcode/647.PalindromicSubstrings.py class Solution: def countSubstringsdp(self, s: str) -> int: n, ans = len(s), 0 dp = [[False] * n for _ in range(n)] for i in range(n): k = 0 for j in range(i, n): if k == j: dp[k][...
StarcoderdataPython
6651585
<reponame>tadeu/markdown-it-py<gh_stars>100-1000 import html import re from typing import Callable, Optional from urllib.parse import urlparse, urlunparse, quote, unquote # noqa: F401 from .utils import ESCAPABLE # TODO below we port the use of the JS packages: # var mdurl = require('mdurl') # var punycode ...
StarcoderdataPython
6678437
<filename>rademacher.py from __future__ import print_function import sys import os import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torchvision import time import copy torch.manual_seed(0) sample_num = 1000 label_npy = './labels.npy' if not os.path.exists(label_npy):...
StarcoderdataPython
4952844
# Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """The Queue object of key-press events and chameleon events to display UI.""" from Queue import Queue import threading # Global queue object for LCM UI ...
StarcoderdataPython
9639582
# Generated by Django 2.2.4 on 2019-08-26 11:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('notices', '0001_initial'), ] operations = [ migrations.AddField( model_name='outagenotice', name='scheduled_for', ...
StarcoderdataPython
315255
# Generated by Django 3.0.7 on 2020-07-16 14:24 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('web', '0054_auto_20200710_1442'), ] operations = [ migrations.CreateModel( name='Cat', ...
StarcoderdataPython
6656962
#This is a the list of all defined variables! f = 10.0 f_lb = 0.0 f_ub = 100.0 f_times = 1 f_step = 0 f_type = 'fvar' f_name = 'f' f_scan = False n_fvar = 1 t1 = 20.0 t1_lb = 40.0 t1_ub = 200.0 t1_times = 1 t1_step = 20.0 t1_type = 't1' t1_name = 't1' t1_scan = True t2 = ...
StarcoderdataPython
11339457
''' Create a URL Shortner in Python Author: <NAME> ''' import pyshorteners import pyperclip from tkinter import * root = Tk() root.geometry("500x250") root.title("My URL shortener") root.configure(bg = "#49A") url = StringVar() url_address = StringVar() def urlshortener(): urladdress = url.get(...
StarcoderdataPython
3445995
# Copyright 2019 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
StarcoderdataPython
9689761
secret_key = b'your secret key'
StarcoderdataPython
3222965
<reponame>MTAS101/chat import frappe from frappe import _ from chat.utils import get_full_name import ast @frappe.whitelist() def get(email): """Get all the rooms for a user Args: email (str): Email of user requests all rooms """ room_doctype = frappe.qb.DocType('Chat Room') all_rooms ...
StarcoderdataPython
5096072
<reponame>pjeanjean/i3ipc-python<gh_stars>0 #!/usr/bin/env python3 from .con import Con from .replies import (BarConfigReply, CommandReply, ConfigReply, OutputReply, TickReply, VersionReply, WorkspaceReply, SeatReply, InputReply) from .events import (IpcBaseEvent, BarconfigUpdateEvent, BindingEve...
StarcoderdataPython
4896347
# ___________________________________________________________________________ # # EGRET: Electrical Grid Research and Engineering Tools # Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC # (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. # Government retains certain r...
StarcoderdataPython
156366
<reponame>PsiPhiTheta/LeetCode class Solution: def reverseString(self, s): """ :type s: str :rtype: str """ output = list(s) output = output[::-1] output = "".join(output) return output
StarcoderdataPython
144497
<filename>docs/tutorials/detection/demo_webcam.py """09. Run an object detection model on your webcam ================================================== This article will shows how to play with pre-trained object detection models by running them directly on your webcam video stream. .. note:: - This tutorial has...
StarcoderdataPython
1682115
# -*- coding: utf-8 -*- # @Date : 2015-11-03 14:26:37 # @Author : <NAME> (<EMAIL>) # @Link : http://www.collabo.com.br/ from __future__ import ( print_function, unicode_literals ) import os SECRET_KEY = 'nosecret' INSTALLED_APPS = [ "tests", ] if 'TRAVIS' in os.environ: database = os.enviro...
StarcoderdataPython
3524312
from collections import namedtuple import random import numpy import pqhelper.data as pq_data from investigators import visuals as v from stemnode import TreeNode Summary = namedtuple('Summary', ('board', 'action', 'score', 'mana_drain_leaves', 'total_leaves')) class StateInvestig...
StarcoderdataPython
54142
<gh_stars>10-100 # Copyright 2020 Google LLC # # 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 agree...
StarcoderdataPython
11359178
<gh_stars>1-10 #!/usr/bin/env python # -*- coding:utf-8 -*- ## ============================================================================= import sys import os reload(sys) sys.setdefaultencoding('utf8') import requests from bs4 import BeautifulSoup import pandas as pd pd.options.display.float_format = '{:,.2f}'.fo...
StarcoderdataPython
11382471
<filename>tests/intergration/test_memgraph.py # Copyright (c) 2016-2021 Memgraph Ltd. [https://memgraph.com] # # 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/lice...
StarcoderdataPython
3567445
<reponame>alivx/auto-config-generator<gh_stars>1-10 #Load jinja Loader function from libs.jinjaLoader import jinjaLoader #Run the config template jinjaLoader("ConfigOutput","config/nginx_conf.json","templates/nginx/nginx.conf") print("Please check the config file.")
StarcoderdataPython
6518931
from minihand.commands import command, Command from minihand.core import MiniHand from importlib import reload as Reload @command(name="help", aliases=["도움", "도움말"], shorthelp="도움 커맨드입니다.") def help(ctx, find: str=None): """기본 모든 커맨드 / 커맨드 검색기 입니다.""" handler = ctx.handler helpstr = "" if find: ...
StarcoderdataPython
8156333
from contextlib import contextmanager import json import logging import time import sys from typing import ( Optional, Dict, Any, Union, ) from .event import Event from .version import __version__ log = logging.getLogger('airline') class Client(): def __init__(self, dataset: str, debug=False): ...
StarcoderdataPython
6476825
"""Test configuration""" import os import pytest def pytest_configure(config): pytest.path = os.path.dirname(os.path.abspath(__file__))
StarcoderdataPython
5103299
<filename>pymatgen/io/tests/test_xcrysden.py # coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from pymatgen.util.testing import PymatgenTest from pymatgen.core.lattice import Lattice from pymatgen.core.structure import Structure from pymatgen.io.xcrysden imp...
StarcoderdataPython
1883505
<gh_stars>1-10 ###Spatial simulation program using differential evolution_scipy### ##Brief explanation of the method## """ scipy.optimize.differential_evolution References: 1.-<NAME> and <NAME>, Differential Evolution - a Simple and Efficient Heuristic for Global Optimization over Continuous Spaces, Journal of Globa...
StarcoderdataPython
1680306
"""Deform schemas for sharder""" import colander from . import tables from pyramid import threadlocal class Shard(colander.MappingSchema): name = colander.SchemaNode(colander.String()) url = colander.SchemaNode(colander.String()) selector = colander.SchemaNode(colander.String(), description='j...
StarcoderdataPython
11305195
<filename>config.py import os class Config(object): """ https://flask.palletsprojects.com/en/1.1.x/config/ """ # Flask configuration values ENV = os.environ.get('FLASK_ENV') DEBUG = os.environ.get('FLASK_DEBUG') TESTING = os.environ.get('FLASK_TESTING') SECRET_KEY = os.environ.get('FLAS...
StarcoderdataPython
4912089
<gh_stars>0 from etk.extraction import Extractable from etk.origin_record import OriginRecord class KnowledgeGraphProvenanceRecord(Extractable): """ A Provenance Record containing details of Extraction Results history. """ def __init__(self, _id, _type: str, reference_type: str, _value: str, json_pat...
StarcoderdataPython
3438637
import os import time import logging from datetime import datetime, timedelta from aggregators import power_aggregator from aggregators import power_price_fetcher from aggregators import water_aggregator from misc import power_warning from misc import shelly_trigger import schedule if os.environ.get("DEBUG") == "1": ...
StarcoderdataPython
1732097
<filename>problems/4153.py def Num4153(): while True: testcase = input().split() if testcase.count("0") == 3: return triangle = [int(t) for t in testcase] triangle.sort() if triangle[0] ** 2 + triangle[1] ** 2 == triangle[2] ** 2: print("right") ...
StarcoderdataPython
5164724
from bot import * SAVE_SCORE_FOLDER = "greedy_scores.csv" class BotGreedy(Bot): def __init__(self, tag): self.__count = 1 def act(self, xdif, ydif, vel): if ydif < 10: return FLAP else: return NOT_FLAP def dead(self, score): with open(SAVE_SCORE_FOLDER, 'a') as f: f.write(str(score) + '\n') ...
StarcoderdataPython
3380914
""" Copyright 2019 Cartesi Pte. 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 in writing, software d...
StarcoderdataPython
194892
from model.project import Project class ProjectHelper: def __init__(self, app): self.app = app def go_to_create_project(self): wd = self.app.wd wd.find_element_by_link_text("Manage").click() wd.find_element_by_link_text("Manage Projects").click() def open_project_create_...
StarcoderdataPython
359362
# Functions used in analyses import gdal import numpy as np def make_raster(in_ds, fn, data, data_type, nodata=None): """Create a one-band GeoTiff. in_ds - datasource to copy projection and geotransform from fn - path to the file to create data - Numpy array containing data to archive ...
StarcoderdataPython
4800132
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 3 17:25:00 2022 @author: advaith """ import random #%% """GLOBAL VARIABLES""" max_score = 22222 round_score = 0 total_score = 0 def read_from_txt(word_list): #read from the textfile and store as a list. duplicate list wi...
StarcoderdataPython
1909761
<filename>tests/auto/pythonLib/test_factory_other.py<gh_stars>0 # # Copyright (c) 2018, <NAME> and <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must r...
StarcoderdataPython
1838993
#!/usr/bin/env python """ Hello! This template is available to help get you started with creating a shim. Start by adjusting the `TEMPLATE` and `template` parameters. Next, adjust the payload based on the API specification of your webhook destination. Finally, add an import statement to __init__.py like: import logins...
StarcoderdataPython
3350104
#coding:utf-8 import sys import requests import time import re from scapy.utils import PcapReader ##resend the package in package.txt, and get the return from server. # host='' cookienum = 2 cookieB = {'Cookie':'456789test'} cookieC = {'Cookie':'159786test'} class RepeterByRequests: def __init__(self, username, c...
StarcoderdataPython
3545433
<reponame>Semicheche/foa_frappe_docker # Copyright (c) 2017, Frappe and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from erpnext.setup.doctype.company.company import update_company_current_month_sales, update_company_monthly_sales def ex...
StarcoderdataPython
3217274
<filename>danceschool/banlist/apps.py # Third Party Imports # Give this app a custom verbose name to avoid confusion from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class BanlistAppConfig(AppConfig): name = 'danceschool.banlist' verbose_name = _('Registration ...
StarcoderdataPython
396905
# ~*~ coding: utf-8 ~*~ from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand from sentry_youtrack import VERSION import os import sys os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'test_settings') class PyTest(TestCommand): user_options = [('pytest-args=', 'a', "A...
StarcoderdataPython
8148551
from sklearn.preprocessing import MinMaxScaler from numpy import loadtxt import numpy as np import matplotlib as plt import pandas as pd from numpy import reshape data = loadtxt('data-time.txt') print(data) #redata = np.reshape(-1,1) #print(redata) scaler = MinMaxScaler() print(scaler.fit(data)) MinMaxScaler(copy=Tru...
StarcoderdataPython
4969024
from decimal import Decimal from django.db.models import Sum from django.shortcuts import get_object_or_404 from datetime import date, timedelta from .models import Task class TaskRepository: """Repository for tasks.""" def list(self): return Task.objects.all() def create(self, title: str, descr...
StarcoderdataPython
6544776
<gh_stars>1-10 from pathlib import Path work_dir = Path('/workdir') data_dir = work_dir / 'data' cover_dir = data_dir / 'Cover' jmipod_dir = data_dir / 'JMiPOD' juniward_dir = data_dir / 'JUNIWARD' uerd_dir = data_dir / 'UERD' sample_submission_path = data_dir / 'sample_submission.csv' test_dir = data_dir / 'Test' t...
StarcoderdataPython
6411828
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from PyQt4 import QtCore, QtGui import numpy as np import PyQt4.Qwt5 as Qwt import wave import pyaudio import thread import time import pylab import matplotlib import scipy #Dołączenie Interfejsu graficzneo do kodu uruchomiania aplikacji import ui_metoda def FFT(...
StarcoderdataPython
9794104
class ConsoleMode: Basic = "basic" SingleLine = "single_line"
StarcoderdataPython
6625317
<reponame>deafmute1/listenbrainz-disc #stdlib from enum import Enum from typing import Iterable, Tuple, Union, Optional import logging import importlib.metadata from datetime import datetime #self import lbzdisc.utils as utils from lbzdisc.data import DataManager #pypi from discord.ext import commands import disc...
StarcoderdataPython
9623098
<reponame>acpn/brasilprev-challenge<gh_stars>1-10 """empty message Revision ID: 3c7d31ef2ffd Revises: 769d5875a08b Create Date: 2020-11-23 12:59:09.966179 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '3c7d31ef2ffd' down_revision = '7<PASSWORD>5<PASSWORD>a08b...
StarcoderdataPython
4960605
import urllib.parse as urlparse from bs4 import BeautifulSoup, NavigableString import re import six convert_heading_re = re.compile(r"convert_h(\d+)") line_beginning_re = re.compile(r"^", re.MULTILINE) whitespace_re = re.compile(r"[\r\n\s\t ]+") FRAGMENT_ID = "__MARKDOWNIFY_WRAPPER__" wrapped = '<div id="%s">%%s</di...
StarcoderdataPython
5195449
<gh_stars>0 """empty message Revision ID: 69233168a099 Revises: 178695a29dca Create Date: 2018-12-21 23:23:42.120840 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '69233168a099' down_revision = '178695a29dca' branch_labels = None depends_on = None def upgra...
StarcoderdataPython
1914598
<filename>src/tests/test_subx.py import pytest from .. import * def make_subx_args(model): predictor_domain = Geo(20,50, -110, -70) attrs = [recursive_getattr(model, i) for i in model.walk() ] args = [(predictor_domain, attrs[i]) for i in range(len(attrs))] return args def make_subx_obs_args(model):...
StarcoderdataPython
4808297
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2019 <NAME> <<EMAIL>> # Licensed under the MIT License - https://opensource.org/licenses/MIT
StarcoderdataPython
8103666
# # whip6: Warsaw High-performance IPv6. # # Copyright (c) 2012-2017 <NAME> # All rights reserved. # # This file is distributed under the terms in the attached LICENSE # files. # import glob import re from os.path import join from termcolor import colored from build_step import BuildStep PRINTF_PATTERN = re.com...
StarcoderdataPython
296038
<filename>root/functions/find_in_text/utils.py def get_sec(time_str): """Get Seconds from time.""" h, m, s = time_str.split(':') return int(h) * 3600 + int(m) * 60 + int(s)
StarcoderdataPython
3261782
a=[-1,150,190,170,-1,-1,160,180] #a=[8,7,6,5,4,3] r=0 sum1=0 for i in range(len(a)): for j in range(len(a)-i-1): if a[j]!=-1 and a[j+1]!=-1: break else: r=a[j] a[j]=a[j+1] a[j+1]=r for i in range(len(a)): for j in range(len(a)-i-...
StarcoderdataPython
8175547
<gh_stars>0 from fastapi import FastAPI app = FastAPI() @app.get('/') def ping(): return {'result': 'Service is alive...'} @app.get('/example') async def example_endpoint(): return { 'result': 'Example' } @app.get('/users/{user_id}') async def get_user(user_id: int): return { 'user_id': user_id }
StarcoderdataPython
8041483
<filename>month01/day10/demo04.py """ 实例变量应用 """ # 练习:将面向过程代码day10/homework/exercise01 # 修改为面向对象代码 # --------------------------类-------------------------- class Commodity: def __init__(self,cid,name,price): self.cid = cid self.name = name self.price = price list_commodity_infos = [...
StarcoderdataPython
244503
<filename>cdeid/utils/resources.py PACKAGE_NAME = 'cdeid' SPACY_PRETRAINED_MODEL_LG = 'en_core_web_lg' # SPACY_PRETRAINED_MODEL_SM = 'en_core_web_sm' PROGRESS_STATUS = { 1: 'prepare data sets', 2: 'train spacy on balanced sets', 3: 'train stanza on balanced sets', 4: 'train flair on balanced sets', ...
StarcoderdataPython
1652444
<reponame>the-octopus/Octopus #!/usr/bin/env python3 import time from selenium.webdriver.support.events import EventFiringWebDriver, AbstractEventListener from lib.reporter import Reporter class WebEventListener(AbstractEventListener): def before_click(self, element, driver): strElement = get_element_str...
StarcoderdataPython
8132884
class InvalidImageException(Exception): pass class ImageNotFoundException(Exception): pass class InvalidEngineException(Exception): pass
StarcoderdataPython
9761802
<gh_stars>1-10 /home/runner/.cache/pip/pool/7f/d5/d6/a16b454232e2194817a582c4fd14190f9e461f3e63b4aace0e0cadc822
StarcoderdataPython
3392133
import functools import inspect from typing import Callable, List, Any, Dict async def execute_middlewares(func: Callable, routine_func: Callable, middlewares: List, *args: Any) -> Any: if middlewares: middleware_context = {} # type: Dict async def middleware_bubble(idx: int = 0, *ma: Any, **mkw...
StarcoderdataPython
5061817
import os from aws_cdk import ( aws_ec2 as ec2, aws_rds as rds, aws_secretsmanager as sm, core, ) from stacks.vpc_stack import VpcStack class RDSStack(core.Stack): def __init__(self, scope: core.Construct, id: str, vpc: VpcStack, **kwargs) -> None: super().__init__(scope, id, **kwargs) ...
StarcoderdataPython
4838516
#!/usr/bin/env python import sys import os import pickle libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib') sys.path.append(libdir) import jdecode import nltk_model as model def update_ngrams(lines, gramdict, grams): for line in lines: for i in range(0, len(line) - (grams - 1)): ...
StarcoderdataPython
8121321
<gh_stars>0 import argparse import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt plt.figure() n_array = [int(i) for i in np.linspace(10, 300, 50)] burn_in = 10000 chain_size = 500000 if __name__ == '__main__': parser = argparse.ArgumentParser(formatter_class=argparse.Argumen...
StarcoderdataPython
1937713
import warnings import numpy as np def to_dataframe(result): with warnings.catch_warnings(): warnings.simplefilter("ignore") import pandas as pd def collection_to_dataframe(n, x): n = str(n).replace('[', '(').replace(']', ')') df = pd.DataFrame() values...
StarcoderdataPython
3526332
<reponame>ansvver/pylufia # -*- coding: utf-8 -*- """ @file __init__.py @brief __init__ of nlp.feature @author ふぇいと (@stfate) @description """ from .bag_of_words import * from .tfidf import *
StarcoderdataPython
3583032
from scratch_py import manager import os import time # Start Pygame game = manager.GameManager(800, 800, os.getcwd()) game.change_title("Catch Ghost Game") # Background game.change_background_image('woods.png') # Variables ghost_score = 0 # Sprites ghost = game.new_sprite('ghost-a.png', 70) ghost.go_to(0,0) # Dial...
StarcoderdataPython
9690826
<reponame>MaxGosselin/alpha-auctions # Generated by Django 2.1.7 on 2019-03-15 18:04 import auctions.auction_timer import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operat...
StarcoderdataPython
281
"""Methods for working with ontologies and the OLS.""" from urllib.parse import quote_plus import requests OLS_API_ROOT = "http://www.ebi.ac.uk/ols/api" # Curie means something like CL:0000001 def _ontology_name(curie): """Get the name of the ontology from the curie, CL or UBERON for example.""" return cur...
StarcoderdataPython
1769559
<reponame>izzley/nem """ generate datetime and date series """ import logging import math from dateutil.rrule import rrule, SECONDLY, DAILY, HOURLY, MONTHLY, YEARLY from datetime import ( date, datetime, timedelta, timezone, ) from typing import Generator, Optional, Tuple, Union def date_iso_str(_da...
StarcoderdataPython
6634033
<reponame>vbhave/document-reranking<filename>sentence_selection.py import numpy as np from scipy import spatial from datetime import datetime max_doc_len = 500 time_start = datetime.now() print("Starting time is " + str(time_start)) glove_embeddings = {} embeds_file = open('glove/simple.txt', 'r') #embeds_file = ope...
StarcoderdataPython
11347141
from dyn2sel.dcs_techniques.from_deslib.deslib_interface import DESLIBInterface import deslib.dcs as deslib class LCA(DESLIBInterface): """ OLA The Overall Local Accuracy (OLA) first gathers the K-Nearest neighbors of the query instance. Next, the algorithm computes the accuracy of each classifier reg...
StarcoderdataPython
4897687
import os import sys import json import logging import cfnresponse import boto3 from botocore.exceptions import ClientError logger = logging.getLogger() logger.setLevel(logging.INFO) client = boto3.client('sagemaker') def handler(event, context): responseData = {} try: logger.info("Received event: {}...
StarcoderdataPython
12813614
from .config import _OptimizerConfig, AdamConfig, LambConfig, SGDConfig from .lr_scheduler import _LRScheduler, ConstantWarmupLRScheduler, CosineWarmupLRScheduler,\ LinearWarmupLRScheduler, PolyWarmupLRScheduler from .fused_adam import FusedAdam, AdamWMode from .fp16_optimizer import FP16_Optimizer
StarcoderdataPython
5187937
from __future__ import print_function """This module contains classes that are specialized for opening specific types of files. They also retrieve and store the file properties (e.g. compression, extension) for further reference. """ import logging import os # PORT: pathlib2 is for python version 2.7, use pathlib in ...
StarcoderdataPython