id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
25050 | from webdriver_manager.driver import EdgeDriver, IEDriver
from webdriver_manager.manager import DriverManager
from webdriver_manager import utils
class EdgeDriverManager(DriverManager):
def __init__(self, version=None,
os_type=utils.os_name()):
super(EdgeDriverManager, self).__init__()
... | StarcoderdataPython |
1739777 | import matplotlib.pyplot as plt
import torch
from torchvision import datasets, transforms, models
from collections import OrderedDict
from torch import nn
from torch import optim
import torch.nn.functional as F
import time
from workspace_utils import active_session
import numpy as np
from PIL import Image
from torch.au... | StarcoderdataPython |
3369172 | <filename>DataGeneration_database2_question2.py
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 31 01:30:30 2020
@author: <NAME>
"""
import json
import pandas as pd
import numpy as np
import re
import random
import sqlite3
import datetime
import calendar
from dateutil.relativedelta import *
with open('lookup1.jso... | StarcoderdataPython |
164572 | import pandas as pd
import numpy as np
def downgrade_dtypes(df):
"""Downgrade column types in the dataframe from float64/int64 type to float32/int32 type
Parameters
----------
df : DataFrame
Returns
-------
df: DataFrame
the output column types will be changed from float64... | StarcoderdataPython |
1743984 | <reponame>Utsav-Patel/Partial-Sensing
from src.TheBlindfoldedAgent import TheBlindfoldedAgent
from src.TheFourNeighborAgent import TheFourNeighborAgent
from src.TheExampleInferenceAgent import TheExampleInferenceAgent
from src.helper import generate_grid_manually, generate_grid_with_probability_p
from constants import... | StarcoderdataPython |
189742 | <gh_stars>10-100
# Process: Manaaki Whenua Land Cover Database (LCDB v5.0)
# Import required packages
import sys, subprocess
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Import helper functions relevant to this script
sys.path.append('E:/mdm123/D/scripts/geo/')
from geo_helpers import extr... | StarcoderdataPython |
1680043 | # Copyright 2019-2019 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | StarcoderdataPython |
1642556 | from django.conf.urls import url
from home import views
app_name = 'home'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^maps/$', views.maps_api, name='maps'),
# url(r'^msgs/$', views.message_api, name='msgs')
]
| StarcoderdataPython |
1632821 | <filename>dashboard/config/prod/settings.py
import sys
from os.path import join
from dashboard.config.base.settings import *
INTERNAL_IPS=('127.0.0.1')
ROOT_URLCONF = 'dashboard.config.prod.urls'
WSGI_APPLICATION = 'dashboard.config.prod.wsgi.application'
# Default to sqlite
DATABASES = {
'default': {
... | StarcoderdataPython |
1795638 | # Grade: 12.5 / 15
# This grade applies to the whole assignment, not just this part. Assignments should be completed in one file unless otherwise stated.
#<NAME>
#5/25/2016
#Homework2
numbers = [22,90,0,-10,3,22, 48]
#display th enumber of elements in the list
# TA-COMMENT: (-0.5) The question asks for the number of e... | StarcoderdataPython |
3206710 | from functools import partial
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from ..editor import EditorScene
from .layerlist import LayerListWidget
class InspectorWidget(QWidget):
image_changed = Signal()
scene_changed = Signal(EditorScene)
def __init__(self):
super().__init__()... | StarcoderdataPython |
4819578 | import random
import itertools
import string
import cProfile
from constants import * # @UnusedWildImport
def load_words():
"""
Returns a list of valid words. Words are strings of lowercase letters.
Depending on the size of the word list, this function may
take a while to finish.
"""
# pri... | StarcoderdataPython |
3284789 | <filename>UVC/T2TViT/models/token_performer.py
"""
Take Performer as T2T Transformer
"""
import math
import torch
import torch.nn as nn
class Token_performer(nn.Module):
def __init__(self, dim, in_dim, head_cnt=1, kernel_ratio=0.5, dp1=0.1, dp2 = 0.1):
super().__init__()
self.emb = in_dim * head_cn... | StarcoderdataPython |
1761621 | <filename>setup.py
from setuptools import setup
requirements = []
with open("requirements.txt") as f:
requirements = f.read().splitlines()
readme = ""
with open("README.rst") as f:
readme = f.read()
setup(
name="nekos.life-async",
author="igna",
project_urls={
"Website": "https://nekos.li... | StarcoderdataPython |
189459 | import matplotlib
import matplotlib.pyplot as plt
import pickle
To_Svg = True
if To_Svg:
figure_spike_sweep = "n_spikes_sweep.svg"
figure_tem_sweep ="n_tems_sweep.svg"
plt.rc('text', usetex=False)
plt.rc('text.latex', unicode = False)
plt.rc('svg',fonttype = 'none')
else:
figure_spike_sweep ... | StarcoderdataPython |
596 | from itertools import product
import numpy as np
import pytest
from alibi_detect.utils.discretizer import Discretizer
x = np.random.rand(10, 4)
n_features = x.shape[1]
feature_names = [str(_) for _ in range(n_features)]
categorical_features = [[], [1, 3]]
percentiles = [list(np.arange(25, 100, 25)), list(np.arange(10... | StarcoderdataPython |
1707541 | import requests
APEX_VALUES = ['172.16.31.10']
CNAME_VALUE = ["domains.tumblr.com"]
RESPONSE_FINGERPRINT = "Whatever you were looking for doesn't currently exist at this address."
def detector(domain, ip, cname):
if APEX_VALUES:
if ip in APEX_VALUES:
return True
if filter(lambda x: x in cname... | StarcoderdataPython |
3331438 | <reponame>AiondaDotCom/tools<filename>kimaiCSV2PDF/helperUnitTest.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# File: helperUnitTest.py
# Author: arwk
# Github: https://github.com/AiondaDotCom/tools
# Created: 25.10.17
# Modified: 25.10.17
##
import helper as hlp
import unittest
class TestUM(unittest.T... | StarcoderdataPython |
1609364 | # Generated by Django 3.2.3 on 2021-07-05 09:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('engine', '0009_quizattempt_images'),
]
operations = [
migrations.RemoveField(
model_name='quizattempt',
name='images... | StarcoderdataPython |
58257 | <filename>tests/test_landsat_c2.py
from pathlib import Path
from unittest.mock import patch
import numpy
import pytest
import rasterio
from rio_tiler.errors import InvalidBandName, MissingBands, TileOutsideBounds
from rio_tiler_pds.errors import InvalidLandsatSceneId
from rio_tiler_pds.landsat.aws import LandsatC2Rea... | StarcoderdataPython |
1735580 | #!/usr/bin/env python
from datetime import datetime
import annotate_support_functions
import subprocess
import difflib, sys
import threading, Queue
import time
import os.path
import struct
import hashlib
start = time.time()
import cPickle as pickle
######################################
#
# Task => Annotate var... | StarcoderdataPython |
1726259 | <reponame>SummerOf15/Robot-Control-and-Planification
"""
Test ICP localisation
Apply a random displacement to a scan and check the error of the recovered position through ICP
author: <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
import math
import time
import readDatasets as datasets
import icp
de... | StarcoderdataPython |
3231990 | <filename>pyKairosDB/tests/test_get_all_metric_names.py
#!/usr/bin/env python
import pyKairosDB
import time
import sys
c = pyKairosDB.connect() # use localhost:8080, the default, no ssl
print pyKairosDB.metadata.get_all_metric_names(c)
| StarcoderdataPython |
113413 | <filename>smzdmCheckin/smzdmCheckinForSCF.py
# -*- coding: utf8 -*-
import requests, json, time, os
requests.packages.urllib3.disable_warnings()
cookie = os.environ.get("cookie_smzdm")
def main(*arg):
try:
msg = ""
SCKEY = os.environ.get('SCKEY')
s = requests.Session()
s.headers.... | StarcoderdataPython |
99306 | from django.db import transaction
from django.utils.translation import gettext_lazy as _
import django_filters
import reversion
from rest_framework import exceptions, serializers, viewsets
from resources.api.base import NullableDateTimeField, TranslatedModelSerializer, register_view
from .models import CateringProdu... | StarcoderdataPython |
3247721 | <reponame>alpha-leo/ComputationalPhysics-Fall2020<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 27 12:36:26 2020
@author: win_10
"""
import numpy as np
import random
import matplotlib.pyplot as plt
from numpy.random import choice
class rand_walk_1:
def __init_... | StarcoderdataPython |
181815 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
class VM(object):
def __init__(self, ip):
self.ip = ip
self.reg = [0, 0, 0, 0, 0, 0]
self.reg[self.ip] -= 1
def run(self, prog):
while -1 <= self.reg[self.ip] < len(prog)-1:
self.reg[self.ip] += 1
... | StarcoderdataPython |
155584 | import numpy as np
def PCA_numpy(data, n_components=2):
#1nd step is to find covarience matrix
data_vector = []
for i in range(data.shape[1]):
data_vector.append(data[:, i])
cov_matrix = np.cov(data_vector)
#2rd step is to compute eigen vectors and eigne values
eig_values... | StarcoderdataPython |
1725404 | <gh_stars>0
from asyncio import create_task, sleep
from os import environ
from random import randrange
from typing import Optional
from discord import Client, Status, Game, TextChannel, Message
def verbose(*args) -> None:
"""Print the specified args only if $VERBOSE is set."""
if "VERBOSE" in environ.keys()... | StarcoderdataPython |
95576 | from fastapi_users.db.base import BaseUserDatabase, UserDatabaseDependency
__all__ = ["BaseUserDatabase", "UserDatabaseDependency"]
try: # pragma: no cover
from fastapi_users_db_sqlalchemy import ( # noqa: F401
SQLAlchemyBaseOAuthAccountTable,
SQLAlchemyBaseOAuthAccountTableUUID,
SQLAlc... | StarcoderdataPython |
4827716 | <reponame>intact-solutions/pysparse<gh_stars>0
import math, os, sys, time
import numpy as np
from pysparse.sparse import spmatrix
from pysparse.itsolvers.krylov import pcg, minres, qmrs, cgs
from pysparse.precon import precon
ll = spmatrix.ll_mat(5,5)
print(ll)
print(ll[1,1])
print(ll)
ll[2,1] = 1.0
ll[1,3] = 2.0
pri... | StarcoderdataPython |
3306831 | # -*- coding: utf-8 -*-
import bimon.core
def main():
bimon.core.BiMon().run()
| StarcoderdataPython |
90616 | <reponame>ProjectPepperHSB/Backend-Services<filename>get-mensa-data/get_mensa_data.py
#pip install pdf2image
#-- poppler --
#https://github.com/oschwartz10612/poppler-windows/releases/
#env: "C:\path\to\poppler-xx\bin"
import requests
import urllib.request
import json
import re
import traceback
from bs4 impo... | StarcoderdataPython |
1711286 | <filename>vim_debug/subwindows.py
from window import VimWindow
import errors
import base64
class StackWindow(VimWindow):
'''Keeps track of the current execution stack'''
name = 'STACK'
dtext = '[[Execution Stack - most recent call first]]'
def __init__(self, name = None):
VimWindow.__init__(sel... | StarcoderdataPython |
3396333 | <reponame>sony/nnabla-nas
# Copyright (c) 2020 Sony Corporation. 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
#
# Un... | StarcoderdataPython |
30215 | <filename>robotframework-ls/tests/robotframework_ls_tests/_resources/case_vars_file/robotvars.py
VARIABLE_1 = 10
VARIABLE_2 = 20
| StarcoderdataPython |
165244 | <filename>Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalNoise_cff.py
import FWCore.ParameterSet.Config as cms
import HLTrigger.HLTfilters.hltHighLevel_cfi
noiseHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
HLTPaths = ['HLT_MET25'],
# eventSetupPathsKey='HcalCalNoise',
throw = Fa... | StarcoderdataPython |
3357907 | <filename>setup.py
#!/usr/bin/python -tt
# coding:utf-8
from setuptools import setup
if __name__ == '__main__':
setup(
name='gocdpb',
version='9.2',
description='Configure GoCD pipeline from the commandline.',
long_description=(
'The Go CD Pipeline Builder is designed t... | StarcoderdataPython |
1786532 | <filename>t66y-spider/src/http_request/__init__.py
from urllib.parse import urlsplit
import urllib3
from log import LoggerObject
urllib3.disable_warnings()
class Downloader(LoggerObject):
def __init__(self, response_processor=None, num_pools=10, **kw):
super().__init__("downloader")
if kw.get("... | StarcoderdataPython |
3230058 | #!/usr/bin/python
#
# Copyright 2018-2022 Polyaxon, 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 ... | StarcoderdataPython |
3342130 | #!/usr/bin/env python3
"""
BSc University Grade Viewer.
Usage:
grades.py [--y1] [--y2] [--y3] [--y4] [--pause]
grades.py -h | --help | -v | --version
Options:
-h --help Show this screen.
-v --version Show version.
-p --pause Pause between each graph
--y1 Show y... | StarcoderdataPython |
18041 | <gh_stars>1-10
"""Support for IHC binary sensors."""
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import CONF_TYPE
from . import IHC_CONTROLLER, IHC_INFO
from .const import CONF_INVERTING
from .ihcdevice import IHCDevice
def setup_platform(hass, config, add_entities,... | StarcoderdataPython |
3352031 | <reponame>cyberphantom/Selfie-Drone-Stick
#!/usr/bin/env python
from __future__ import print_function
import numpy as np
import rospy
from cv_bridge import CvBridge, CvBridgeError
from phone import phone_IO
from drone import drone_IO
if __name__ == '__main__':
''' After Starting the ARDrone, We start getting ... | StarcoderdataPython |
16125 | # Create your views here.
from django.core.urlresolvers import reverse
from django.http.response import JsonResponse, HttpResponse
from settings.settings import AUTHORIZED_KEYS_FILE, SITE_URL
from bioshareX.models import Share, SSHKey, MetaData, Tag
from bioshareX.forms import MetaDataForm, json_form_validate
from guar... | StarcoderdataPython |
4822965 | <filename>app/core/utils.py
import os
import requests
from django.contrib.gis.geos import Point
from rest_framework import status
from typing import Dict
def get_geolocation_from_address(address: str) -> Dict[Point, str]:
"""
Returns geolocation point with latitude and longitude
and formatted-address
... | StarcoderdataPython |
1732322 | <filename>CMC_coin_info_fetch.py<gh_stars>1-10
#Author : <NAME>
#Name : CMC_Coin_Info_Fetch.py
#Description :
#To pull out twitter handle of all the currency and make a xls file. This uses APIs provided by CMC.
#This twitter handles will be used for monitoring using twitter APIs in other module.
#
#
#production... | StarcoderdataPython |
156824 | from itertools import combinations
import numpy as np
import time
def friend_numbers_exhaustive_count(count_till_number):
friend_numbers_cnt = 0
for pair in combinations(np.arange(1,count_till_number),2):
str_1 = str(pair[0])
str_2 = str(pair[1])
# print(str_1, str_2)
if np.any(... | StarcoderdataPython |
3237422 | <reponame>tzakrajs/yaiges<filename>run_server.py
#!/usr/bin/env python3
import socket
import sys
import pytest
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
import yaml
from core import logging, main_loop, route
# YAML Config is located at the path below
YAML_CONFIG_PATH... | StarcoderdataPython |
1620645 | #!/usr/bin/python
#
# HTTP Authentication: Basic and Digest Access Authentication
#
import traceback
import falcon
import json
import uuid
import time
import re
import base64
import hashlib
import random
from wsgiref.simple_server import make_server
DOMAIN = 'github.com'
USERS = {'admin': '<EMAIL>', 'minh': 'nguyen-h... | StarcoderdataPython |
1771050 | """
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 binary tree.
@return: An integer
"""
def maxPathSum(self, root):
self.maxSum = float('-inf')
... | StarcoderdataPython |
3349977 | <filename>config.py
# Copyright 2021 Dakewe Biotech Corporation. 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 |
4840944 | <filename>setup.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from codecs import open
import os.path as osp
import re
from setuptools import setup, find_packages
with open('nyc_signature/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(... | StarcoderdataPython |
113009 | <reponame>jfmaes/transformationsuite
import argparse
from transformer import Transformer
from format import Formatter
from Crypto.Hash import MD5
parser = argparse.ArgumentParser(description="Transformer next generation by jfmaes")
#DONT FORGET TO PUT REQUIRED TRUE
parser.add_argument("-f", "--file", help="the ... | StarcoderdataPython |
3270315 | <gh_stars>10-100
from pwn import *
cn = remote('172.16.17.32', 9999) # nc 172.16.17.32 9999
cn.recv() # title
while True:
print cn.recvline() # stage info
prob = cn.recvline()
cn.recv()
log.info(prob)
prob = prob.replace('Question> ', '').replace('= ?', '')
log.info('PROBLEM : ' + prob)
ans ... | StarcoderdataPython |
3303196 | <reponame>MinchinWeb/papermerge<gh_stars>0
from datetime import timedelta
import logging
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.shortcuts import render, redirect
from knox.models import AuthToken
from papermerge.core.forms import AuthTokenForm
logger ... | StarcoderdataPython |
72662 | <reponame>xihuaiwen/chinese_bert<gh_stars>0
# Copyright 2020 Graphcore Ltd.
import logging
import textwrap
from abc import abstractmethod
from copy import copy
from typing import Any, Iterable, List, Optional
import numpy as np
from scipy.stats import truncnorm
import popart
from pingpong.scope_manager import Scope
... | StarcoderdataPython |
3294879 | <filename>doc/jupyter_execute/notebooks/explainer_examples_v2.py
#!/usr/bin/env python
# coding: utf-8
# # Example model explanations with Seldon and v2 Protocol - Incubating
#
# In this notebook we will show examples that illustrate how to explain models using [MLServer] (https://github.com/SeldonIO/MLServer).
#
#... | StarcoderdataPython |
1752608 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import connection, migrations, models
from django.utils.timezone import utc
import datetime
def update_totals(apps, schema_editor):
model = apps.get_model("projects", "Project")
type = apps.get_model("contenttypes", "ContentType")... | StarcoderdataPython |
3351152 | <gh_stars>1-10
# geomdl-cli - Copyright (c) 2018-2019 <NAME> <<EMAIL>>
#
# 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
# to use,... | StarcoderdataPython |
1736411 | #!/usr/bin/env python3
import os
import shutil
import sys
# A simple script to copy items in a folder into one of two subfolders,
# depending on whether they were created before or after a given time
# Created by brendon-ai, September 2017
# Names of directories to move files into
SUBFOLDER_NAMES = ('before', 'afte... | StarcoderdataPython |
140373 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Pygonal
(c) 2016 Copyright <NAME> <<EMAIL>>
Portions copyright (c) 2010 by <NAME>
Portions copyright (c) 2009 The Super Effective Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in complianc... | StarcoderdataPython |
172983 | import os, sys, re, string, operator, math, datetime, time, signal, subprocess, shutil, glob, pkgutil
import params as p
import common_functions as cf
before = -1
###############################################################################
# Check for timeout and kill the job if it has passed the threshold
#######... | StarcoderdataPython |
108588 | # Generated by Django 3.2.3 on 2021-07-19 17:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hedera', '0003_profile_show_node_ids'),
]
operations = [
migrations.AddField(
model_name='profile',
name='lang',
... | StarcoderdataPython |
3314277 | """Integration tests for Subreg"""
from unittest import TestCase
from lexicon.tests.providers.integration_tests import IntegrationTests
# Hook into testing framework by inheriting unittest.TestCase and reuse
# the tests which *each and every* implementation of the interface must
# pass, by inheritance from integrati... | StarcoderdataPython |
1748418 | <filename>modules/ethnologue.py
#!/usr/bin/python3
"""
ethnologue.py - Ethnologue.com language lookup
author: mattr555
"""
from lxml import html
from string import ascii_lowercase
import web
import logging
logger = logging.getLogger('phenny')
def shorten_num(n):
if n < 1000:
return '{:,}'.format(n)
e... | StarcoderdataPython |
1661097 | #!/usr/bin/env python
# coding=utf-8
#
# Author: liufr
# Github: https://github.com/Fengrui-Liu
# LastEditTime: 2021-01-11 14:35:09
# Copyright 2021 liufr
# Description:
#
from .stream_generator import StreamGenerator
from .math_toolkit import StreamStatistic
from .dataset import MultivariateDS, UnivariateDS, CustomDS... | StarcoderdataPython |
3332970 | <filename>api/main.py
from fastapi import FastAPI
from api.config import Config
from api.satellite import views as satellite_views
from api.satellite.data import get_satellites
app = FastAPI()
app.include_router(satellite_views.router, prefix="/satellites")
config = Config()
@app.get("/health")
def health():
re... | StarcoderdataPython |
3268694 | <gh_stars>1-10
from . import abstract_models
class Transaction(abstract_models.AbstractTransaction):
pass
class Source(abstract_models.AbstractSource):
pass
class SourceType(abstract_models.AbstractSourceType):
pass
class Bankcard(abstract_models.AbstractBankcard):
pass
| StarcoderdataPython |
1648969 | from passlib.hash import sha512_crypt
s = "penguins"
for ip in range(1000,2000):
sp = str(ip)
p = sp[1:]
h = sha512_crypt.using(salt=s, rounds=5000).hash(p)
if h[12:16] == "PcSL":
print p, h
| StarcoderdataPython |
1639499 | <reponame>ghanashyamchalla/cis_interface
from yggdrasil.tests import assert_raises
from yggdrasil.metaschema.datatypes.tests import test_MetaschemaType as parent
class TestAnyMetaschemaType(parent.TestMetaschemaType):
r"""Test class for AnyMetaschemaType class."""
_mod = 'AnyMetaschemaType'
_cls = 'AnyMe... | StarcoderdataPython |
95902 | test = {
'name': 'q3_1_1',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> len(my_20_features)
20
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> np.all([f in test_movies.labels f... | StarcoderdataPython |
4817405 | <reponame>CrispenGari/days-of-python
def four_sum(numbers: list, target: int) -> list:
result = []
# don't want to handle empty lists and those with less than 4 numbers
if not numbers and len(numbers) < 4:
return result
# use the pointer method when sorting
numbers = sorted(numbers)
#... | StarcoderdataPython |
3328915 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : MeUtils.
# @File : memory_profiler_demo
# @Time : 2021/1/25 1:25 下午
# @Author : yuanjie
# @Email : <EMAIL>
# @Software : PyCharm
# @Description :
from memory_profiler import profile
@profile
def my_func():
a = [1] *... | StarcoderdataPython |
192352 | <filename>visualizer/scripts/solver_interactive.py
#! /usr/bin/env python
from solver_inc import *
VERSION = '0.1.1'
class Interactive_Solver(Incremental_Solver):
def __init__(self):
super(Interactive_Solver, self).__init__()
self._inits = []
def on_data(self, data):
if self._reset ==... | StarcoderdataPython |
3232490 | <reponame>fossabot/atlas<filename>ui-tests/testRunner.py
import unittest
import glob
import os
import importlib
suite = unittest.TestSuite()
for file in glob.glob('tests/test_*.py'):
modname = os.path.splitext(file)[0].replace('/', '.')
print modname
module = importlib.import_module(modname)
suite.ad... | StarcoderdataPython |
1649834 | <gh_stars>1-10
from .bosch_request_192 import BoschRequest192
| StarcoderdataPython |
1761152 | #!/usr/bin/python
from pptx import Presentation
from pptx.util import Inches
from wand.image import Image
import os, os.path
layoutMode = {
'TITLE' : 0,
'TITLE_AND_CONTENT' : 1,
'SECTION_HEADER' : 2,
'SEQUE' : 2,
'TWO_CONTENT' : 3,
'COMPARI... | StarcoderdataPython |
155571 | <filename>473-matchsticks-to-square/473-matchsticks-to-square.py
class Solution:
def makesquare(self, matchsticks: List[int]) -> bool:
"""
[1,1,2,2,2] total = 8, k = 4, subset = 2
subproblems:
Can I make 4 subsets with equal sum out of the given numbers?
... | StarcoderdataPython |
4840519 | from attacks.clf_pgd import *
from attacks.bpda import *
from attacks.square import *
from attacks.bpda_strong import *
from attacks.bpda_score import *
from attacks.bpda_total import *
| StarcoderdataPython |
1628097 | <gh_stars>1-10
import pytest
from pyspark.sql import SparkSession
from sparkql.exceptions import InvalidDataFrameError
from sparkql import Struct, String
def test_validation_example(spark_session: SparkSession):
dframe = spark_session.createDataFrame([{"title": "abc"}])
class Article(Struct):
title ... | StarcoderdataPython |
92108 | # -*- encoding: utf-8 -*-
"""
keri.core.coring module
"""
import re
import json
import copy
from dataclasses import dataclass, astuple
from collections import namedtuple, deque
from base64 import urlsafe_b64encode as encodeB64
from base64 import urlsafe_b64decode as decodeB64
from math import ceil
from fractions impo... | StarcoderdataPython |
1752095 | <filename>makeup_service/server/common.py
import os
from pathlib import Path
def get_data_folder():
root_folder = Path(__file__).parent.parent
data_folder = os.path.join(root_folder, 'data')
return data_folder
| StarcoderdataPython |
158451 | """Package containing pyleus implementation of major Storm entities.
"""
from __future__ import absolute_import
from collections import namedtuple
DEFAULT_STREAM = "default"
StormTuple = namedtuple('StormTuple', "id comp stream task values")
"""Namedtuple representing a Storm tuple.
* **id**\(``str`` or ``long``): ... | StarcoderdataPython |
197456 |
"""
This module defines a class used for evaluating coordinate transformations at null shell junctions.
"""
import numpy as np
import interpolators as interp
from helpers import *
class active_slice:
"""
Class for handling shell and corner slicing of SSS regions. Given the region and the slice parameters,
re... | StarcoderdataPython |
3364964 | <gh_stars>0
#!/usr/bin/env python
import sys, re
import getopt, os
import json
import nltk
from weathercom import get_weathercom
def usage():
print "weatherbot.py [-u \"Celsius\"] [-c \"San Francisco\"]"
if __name__=="__main__":
# set user model defaults
default_unit = "Celsius"
default_city = "Sa... | StarcoderdataPython |
196851 | # Lint as: python2, python3
# Copyright 2020 Google LLC. 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 req... | StarcoderdataPython |
166854 | """Version of Epson projector module."""
__version__ = '0.2.3.500'
| StarcoderdataPython |
1674723 | <gh_stars>0
from importlib import util
if util.find_spec('fio') is not None:
import fio
mod = 1000000007
def sieve_of_eratosthenes(n):
sieve = [1]*(n+1)
sieve[0] = sieve[1] = 0
for i in range(2, int(n**0.5)+1):
if sieve[i]:
for j in range(i**2, n+1, i):
sieve[j... | StarcoderdataPython |
26006 | <filename>generative_model/generator_test.py
import torch
import torch.nn as nn
from torch.autograd import Variable
from data_loading import *
from rdkit import Chem
'''
the model
'''
class generative_model(nn.Module):
def __init__(self, vocabs_size, hidden_size, output_size, embedding_dimension, n_layers):
... | StarcoderdataPython |
1779200 | <reponame>rnowling/ml-weather-model<filename>model.py
import argparse
from datetime import datetime
import numpy as np
import scipy.sparse as sp
from sklearn.linear_model import SGDRegressor
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
from feature_extractors import E... | StarcoderdataPython |
23923 | <gh_stars>1-10
version = "20.1"
| StarcoderdataPython |
1785741 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name='fuzzydirfilter',
version='1.1.2',
packages=find_packages(),
install_requires=['fuzzywuzzy', 'python-Levenshtein'],
entry_points={
'console_scripts':
'fuzzydirfilter = fuzzydirfilter.main:fuzzydirfilter_m... | StarcoderdataPython |
1739249 | <filename>src/zope/app/container/browser/tests/test_view_permissions.py<gh_stars>1-10
##############################################################################
#
# Copyright (c) 2004 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
... | StarcoderdataPython |
1654118 | #!/usr/bin/python
# Python3 program to illustrate
# hex() function
print("The hexadecimal form of 23 is"
+ hex(23))
print("The hexadecimal form of the "
"ascii value is 'a' is " + hex(ord('a')))
print("The hexadecimal form of 3.9 is "
... | StarcoderdataPython |
1703593 | #!/usr/bin/env python
import datetime
import pytimeparse
import six
from agate.data_types.base import DataType
from agate.exceptions import CastError
class TimeDelta(DataType):
"""
Data type representing the interval between two times.
"""
def cast(self, d):
"""
Cast a single value t... | StarcoderdataPython |
3313751 | <gh_stars>0
# Copyright AllSeen Alliance. All rights reserved.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AN... | StarcoderdataPython |
3335253 | <filename>platform/radio/efr32_multiphy_configurator/pyradioconfig/calculator_model_framework/Utils/CalcStatus.py<gh_stars>10-100
from enum import Enum
class CalcStatus(Enum):
Success = 0
Failure = -1
Warning = 1 | StarcoderdataPython |
3391501 | wicket=int(input("Enter wicket:"))
economy_rate=float(input("Enter economy_rate per over:"))
catch=int(input("Enter no. of catch:"))
stumping=int(input("Enter no. of stumping:"))
run_out=int(input("Enter no.of run out:"))
points=0
if wicket:
points=wicket*10
print("total +10 wicket point:")
print(wicket)
if w... | StarcoderdataPython |
4840395 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
# configuration to model pileup for initial physics phase
from SimGeneral.MixingModule.mixObjects_cfi import theMixObjects
from SimGeneral.MixingModule.mixPoolSource_cfi import *
from SimGeneral.MixingModule.digitizers_cfi import *
mix = cms.EDProduc... | StarcoderdataPython |
4825997 | <gh_stars>0
import datetime
import json
import logging
import time
from typing import Any, Dict, List, cast
from urllib.parse import urljoin
import requests
from dagster import (
EventMetadata,
Failure,
Field,
StringSource,
__version__,
check,
get_dagster_logger,
resource,
)
from dagste... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.