id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3352908 | import csv
import time
import numpy as np
import torch
from torch import nn
from common.eval_test import evaluate
def arch_search_valid(model, train_data, test_data, corrupt_func, optimizer, lr_scheduler, clip_value=1., batchsize=16,
lam=2, valid_rate=0.5, gpu_id=0, period=None, out_model='out_... | StarcoderdataPython |
3357465 | """Pipeline code to run alignments and prepare BAM files.
This works as part of the lane/flowcell process step of the pipeline.
"""
from collections import namedtuple
import os
import toolz as tz
from bcbio import bam, utils
from bcbio.bam import cram
from bcbio.ngsalign import (bowtie, bwa, tophat, bowtie2,
... | StarcoderdataPython |
1786696 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# import needed libraries
import glob
import hashlib
import logging.config
import os
import os.path
import pickle
from rdflib import Graph, Namespace, BNode, Literal, URIRef # type: ignore
from rdflib.namespace import RDF, RDFS, OWL # type: ignore
from tqdm import tqdm ... | StarcoderdataPython |
3239848 | <filename>src/decks/migrations/0007_auto_20200804_2018.py
# Generated by Django 3.0.8 on 2020-08-04 20:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('decks', '0006_auto_20200804_1827'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
44871 | <filename>crop_video.py<gh_stars>10-100
import cv2
import numpy as np
'''
Loads two videos and generates an interface to crop these to equal length
and being synced in time.
Specify:
path1: path to first video
path2: path to second video
vidname: name of the instance to be created
'''
path1 = "videos_ori... | StarcoderdataPython |
3222165 | from django import forms
from .models import Image, Profile, Comment
class NewImageForm(forms.ModelForm):
class Meta:
model = Image
exclude = ['user', 'post_date', 'liker', 'profile']
class NewProfileForm(forms.ModelForm):
class Meta:
model = Profile
exclude = ['user', 'follow... | StarcoderdataPython |
4834989 | import warnings
from pathlib import Path
from threading import RLock
from typing import Union
import dask.dataframe as dd
from cachetools import LRUCache, cached
from cbgen import bgen_file, bgen_metafile
from cbgen.typing import Partition
from dask.delayed import delayed
from pandas import DataFrame
from ._environme... | StarcoderdataPython |
4822478 | """
2015-2016 <NAME> <EMAIL>
"""
import random
import numpy as np
import matplotlib.pyplot as plt
from dataset.data_utils import get_cifar10_data
from classifiers import Softmax
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['ima... | StarcoderdataPython |
98054 | <reponame>Snewmy/swordie<gh_stars>1-10
# Knight Stronghold: Secret Grove
# Quest: Rescue Neinhart
from net.swordie.ms.enums import WeatherEffNoticeType
KNIGHT_DISTRICT_4 = 271030400
WATCHMAN = 8610016
ENEMY_SPAWNS = [(635, 208), (159, 208), (59, 208), (-313, 208)]
sm.showWeatherNotice("Defeat all the monsters surroun... | StarcoderdataPython |
1666137 | #!/usr/bin/python
#-!- coding: utf-8 -!-
""" This is WiFi Car control class. """
import pigpio,thread,time
import RPi.GPIO as GPIO
class WifiCar:
distance=None # The distance measure approximate 10 times every second.
PG=None # pigpio object.
LED_RED_PIN=12
LED_BLUE_PIN=16
LED_GREEN_PIN=20
SERVO_POWER_P... | StarcoderdataPython |
150203 | <gh_stars>0
# Copyright 2012-2015 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of... | StarcoderdataPython |
29383 | import pytest
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize('name', [
('nodejs'),
])
def test_packages_are_installed(host, name):
package = host.package(name)... | StarcoderdataPython |
4832298 | from tornado_jinja2 import Jinja2Loader
import unittest
import jinja2
class LoaderTest(unittest.TestCase):
templates_path = 'test/templates/'
def setUp(self):
self.jinja2_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(self.templates_path))
self.loader = Jinja2Loader(se... | StarcoderdataPython |
156588 | <gh_stars>1-10
from torch.utils.model_zoo import load_url
from .model import Model
model_urls = {
"dfl": "https://github.com/zheniu/stochastic-cslr-ckpt/raw/main/dfl.pth",
"sfl": "https://github.com/zheniu/stochastic-cslr-ckpt/raw/main/sfl.pth",
}
def load_model(use_sfl=True, pretrained=True):
model = M... | StarcoderdataPython |
1635923 | <gh_stars>1-10
"""FezHat 1.1 tools."""
import smbus
from RPi import GPIO
class Pins(object):
"""Store the address of the sensors."""
SWITCH_LEFT = 18
SWITCH_RIGHT = 22
ANALOG_1 = 1
ANALOG_2 = 2
ANALOG_3 = 3
ANALOG_6 = 6
ANALOG_7 = 7
LED = 24
class Fezhat(object):
"""Access... | StarcoderdataPython |
1780409 | <gh_stars>0
#!/usr/bin/env python
import os, base64, tempfile, io
from os import path
from setuptools import setup, Command
from distutils.command.build_scripts import build_scripts
from setuptools.dist import Distribution as _Distribution
LONG="""
Versioneer is a tool to automatically update version strings (in setu... | StarcoderdataPython |
3227519 | import sys
from pyautocad import Autocad
from win32com import client
import math
import os
import psutil
# filepath = "E:\work\软件\软件\图档\8GBY112_C.dwg"
filepath = sys.argv[1]
def getAllPid():
pid_dict={}
pids = psutil.pids()
for pid in pids:
p = psutil.Process(pid)
pid_dict[pid]=p.name()
... | StarcoderdataPython |
3262063 | <gh_stars>0
class Equipment:
ID = 0
def __init__(self, name):
self.name = name
Equipment.ID += 1
self.id = Equipment.ID
def __repr__(self):
return f"Equipment <{self.id}> {self.name}"
@staticmethod
def get_next_id():
return Equipment.ID + 1
| StarcoderdataPython |
1656168 | import struct
class APP_ID:
APP_CS_LOGIN = 0xB0
APP_SC_LOGIN_OK = 0xA0
APP_SC_LOGIN_NOK = 0xA1
app_cs_structs = {
APP_ID.APP_CS_LOGIN : 'sBs', # username, hashed?, password
}
app_sc_structs = {
APP_ID.APP_SC_LOGIN_OK : '', # token
APP_ID.APP_SC_LOGIN_NOK : '',
}
... | StarcoderdataPython |
3380428 | <gh_stars>10-100
from signalflowgrapher.commands.command_handler import Command
from signalflowgrapher.model.model import ObservableGraph, CurvedBranch
class ChangeBranchWeightCommand(Command):
def __init__(self,
branch: CurvedBranch,
weight: str,
graph: Observab... | StarcoderdataPython |
193709 | <gh_stars>1-10
import unittest
import mock
import requests
import responses
from kerlescan import inventory_service_interface
from kerlescan.exceptions import ItemNotReturned, ServiceError
from drift import app
from . import fixtures
class InventoryServiceTests(unittest.TestCase):
def setUp(self):
tes... | StarcoderdataPython |
3379031 | <gh_stars>1-10
"""conf URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')... | StarcoderdataPython |
3218274 | <reponame>pl8787/textnet-release
#-*-coding:utf8-*-
import copy, os
from gen_conf_file import *
from dataset_cfg import *
def gen_gate_bilstm(d_mem, init, lr, dataset):
# print "ORC: left & right lstm share parameters"
is_share = False
net = {}
# dataset = 'tb_fine'
# dataset = 'mr'
if dataset... | StarcoderdataPython |
1778921 | from enum import Enum
import tkinter as tk
from ..translator import Translator
from ..resources import get_resource_path
from ..updater.SimpleSemVer import SimpleSemVer
class UpdateType(Enum):
App = 0
Skills = 1
AppLanguage = 2
SkillCorrections = 3
class AskUpdate(tk.Toplevel):
def __init__(
... | StarcoderdataPython |
1738986 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# (C) Copyright IBM Corp. 2020.
#
# 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 ... | StarcoderdataPython |
81888 | flag="OYE, jaa 4 plate emarald se cheese maggi aur patties le kar aa... aur bolna kharcha mere khate mie likh dene!! ISM: TOH_SANDEEP_KO_BULANA_PADTA_HAI"
binary_password="<PASSWORD>"
| StarcoderdataPython |
139110 | from typing import List
from collections import Counter
class Solution:
def minSetSize(self, arr: List[int]) -> int:
freq = Counter(arr)
freq = freq.most_common()
numRequired = len(arr) // 2
start = 0
while numRequired > 0:
numRequired -= freq[start][1]
... | StarcoderdataPython |
1601365 | <reponame>wmeueleleyb/Leibniz-series-plotted-<gh_stars>0
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import random
x = []
y = []
pi = 4
j = 0
plt.style.use('fivethirtyeight')
def animate(i):
global pi, j
if j % 2 == 0: pi -= (4/(j*2 + 3))
else: pi += (4/(j... | StarcoderdataPython |
3215700 | <gh_stars>1-10
__author__ = 'lorenzo'
#
# http://stackoverflow.com/a/29681061/2536357
#
from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.
vendor.add('lib')
# run from the project root:
# pip install -t lib -r requirements.txt
# Uncomment if appstat is on
#def webapp_add_wsgi_... | StarcoderdataPython |
189666 | from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Clean all entries for http451'
def add_arguments(self, parser):
pass
# parser.add_argument('dump', nargs='+', type=int)
def handle(self, *args, **options):
self.stdout.write(self... | StarcoderdataPython |
3221842 | <filename>yacg/model/model.py
# Attention, this file is generated. Manual changes get lost with the next
# run of the code generation.
# created by yacg (template: pythonBeans.mako v1.0.0)
from enum import Enum
class Type:
""" Dummy base class to implement strong typed references
"""
def __init__(self):... | StarcoderdataPython |
1756294 | <reponame>realjf/ceph-board-py
from django.contrib import admin
from .models import Article
class ArticleAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'created_time',)
list_display_links = ('title',)
admin.site.register(Article, ArticleAdmin)
| StarcoderdataPython |
3348313 | from avatar_sgg.dataset.ade20k import get_ade20k_split
from avatar_sgg.config.util import get_config
from avatar_sgg.image_retrieval.evaluation import compute_similarity, compute_text_graph_similarity, \
compute_recall_on_category, compute_recall_johnson_feiefei, \
use_merged_sequence, run_evaluation
import nu... | StarcoderdataPython |
198436 | <gh_stars>100-1000
# Copyright 2019-present Kensho Technologies, LLC.
import datetime
from typing import Tuple
import unittest
from graphql import print_ast
import pytest
from .. import test_input_data
from ...cost_estimation.analysis import analyze_query_string
from ...cost_estimation.statistics import LocalStatisti... | StarcoderdataPython |
3381924 | import operator
import django.urls
import ipware.ip
import ipware.ip
from django.contrib.auth.decorators import login_required
from django.db import transaction
from django.db.models import Prefetch, Min
from django.http.response import (HttpResponseNotFound,
JsonResponse,
... | StarcoderdataPython |
1755108 | import numpy as np
import sys
import optwrapper as ow
A = np.array( [ [1.0979, -.0105, .0167 ], [-.0105, 1.0481, .0825], [.0167, .0825, 1.1540] ] )
def instcost( x, u, grad=True ):
Q = np.zeros( (3,3) )
R = .01
if( not grad ):
return x.dot(Q).dot(x) + u.dot(R).dot(u)
return ( x.dot(Q).dot(x)... | StarcoderdataPython |
4828648 | <gh_stars>0
from elegant_finrl.run import *
from elegant_finrl.agent import AgentPPO, AgentDDPG
from elegant_finrl.env import StockTradingEnv
import yfinance as yf
from stockstats import StockDataFrame as Sdf
args = Arguments(if_on_policy=True)
args.agent = AgentPPO()
args.env = StockTradingEnv(cwd='./', if_eval=True)... | StarcoderdataPython |
1798617 | <reponame>Aliacf21/BotBuilder-Samples<filename>samples/python/47.inspection/data_models/__init__.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from .custom_state import CustomState
__all__ = ["CustomState"]
| StarcoderdataPython |
1627657 | <gh_stars>0
# -*- coding: utf-8 -*-
import logging
from pymongo import MongoClient
class DB_manager(object):
def __init__(self):
self.logger = logging.getLogger(" {0}".format(__name__))
def init_db(self):
self.client = MongoClient('localhost', 24730)
self.db = self.client.mobilepars... | StarcoderdataPython |
3388588 | <reponame>smrmkt/online_learning_algorithms
#!/usr/bin/env python
#-*-coding:utf-8-*-
import enum
import numpy as np
class Evaluator:
CalcType = enum.Enum("CalcType", ["update", "predict"])
def __init__(self, model, y_vec, feats_vec):
self.model = model
self.count = len(y_vec)
self.y... | StarcoderdataPython |
1759033 | # -*- coding: utf-8 -*-
import time
from pykinect2 import PyKinectV2
from pykinect2.PyKinectV2 import *
from pykinect2 import PyKinectRuntime
from Kinetic import extractPoints
from numpy import *
#import pyttsx
k = PyKinectRuntime.PyKinectRuntime(PyKinectV2.FrameSourceTypes_Body)
print "Kinect lance"
#e = pyttsx.ini... | StarcoderdataPython |
58800 | import indicoio
from celery import Celery
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_googlemaps import GoogleMaps
from flask_mail import Mail
from flask_mongoengine import MongoEngine
from app.celery.factory import init_celery
from config import config, DEVELOPMENT_CONFIG_NAME
celery = C... | StarcoderdataPython |
4803573 | # Copyright 2014 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 ... | StarcoderdataPython |
1674004 | <reponame>Pseudomanifold/pyper
"""Filtrations and persistent homology calculation for functions."""
import enum
import operator
import numpy as np
from ..utilities import UnionFind
from ..representations import PersistenceDiagram
def calculate_persistence_diagrams_1d(
function,
order='sublevel',
):
"""... | StarcoderdataPython |
193605 | from django import template
from trax.trax import utils
register = template.Library()
@register.filter(name='humanize_timedelta')
def d(value):
return utils.humanize_timedelta(value)
| StarcoderdataPython |
1721012 | # Generated by Django 2.2.9 on 2020-10-25 10:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0005_auto_20201004_1241'),
]
operations = [
migrations.AlterModelOptions(
name='group',
options={'verbose_n... | StarcoderdataPython |
182623 | <gh_stars>1-10
import logging
import time
try:
from fortrace.core.vmm import Vmm
from fortrace.utility.logger_helper import create_logger
from fortrace.core.vmm import GuestListener
from fortrace.core.reporter import Reporter
import fortrace.utility.scenarioHelper as scenH
except ImportError as ie:... | StarcoderdataPython |
1745178 | <filename>FEF_and_LIP_and_mdPul_v3.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 12 16:23:57 2020
@author: amelie
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 11 13:56:08 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from FEF_full im... | StarcoderdataPython |
1622809 | import contextlib
import datetime
import logging
import os
import tempfile
import uuid
from pathlib import Path
from typing import Dict, Iterator, List, Optional
from urllib.parse import urlparse, urlunparse
from pkg_resources import get_distribution
from scaraplate.automation.base import ProjectVCS, TemplateVCS
from... | StarcoderdataPython |
1726698 | from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def env_value():
return "localhost" | StarcoderdataPython |
157663 | # -*- coding: utf-8 -*-
import unittest
from unittest import mock
from thumbnails import get_thumbnail
from thumbnails.conf import settings
from thumbnails.images import Thumbnail
from .utils import override_settings
class GetThumbnailTestCase(unittest.TestCase):
@mock.patch('{}.get'.format(settings.THUMBNAIL_... | StarcoderdataPython |
1616369 | #from math import pi
#from math import *
import math as mt
#import math
print(mt.pi) | StarcoderdataPython |
3364471 | <filename>lib/data_utils/visualization.py
# ---------------------------------------------------------------
# SNIPER: Efficient Multi-scale Training
# Licensed under The Apache-2.0 License [see LICENSE for details]
# by <NAME>
# ---------------------------------------------------------------
import matplotlib
matplotli... | StarcoderdataPython |
1615667 | <gh_stars>0
import datetime
import logging
import os
import sdm_service
import sys
GRANT_TIMEOUT=60 #minutes
def get_params():
if not sys.argv or len(sys.argv) != 3:
raise Exception("Invalid number of arguments")
return sys.argv[1], sys.argv[2]
class GrantTemporaryAccess:
service = sdm_service.cr... | StarcoderdataPython |
129555 | class School:
def __init__(self, name, num_pupils, num_classrooms):
self.name = name
self.num_pupils = num_pupils
self.num_classrooms = num_classrooms
def calculate_average_pupils(self):
return self.num_pupils / self.num_classrooms
def show_info(self):
"""
>>> s = School("Eveyln Intermediate", 96, 15... | StarcoderdataPython |
75518 | <filename>tests/clpy_tests/random_tests/test_distributions.py
import unittest
import clpy
from clpy.random import distributions
from clpy import testing
@testing.parameterize(*testing.product({
'shape': [(4, 3, 2), (3, 2)],
'loc_shape': [(), (3, 2)],
'scale_shape': [(), (3, 2)],
})
)
@testing.gpu
class T... | StarcoderdataPython |
2646 | from unittest import TestCase
from unittest.mock import Mock, patch
import sys
sys.modules['smbus'] = Mock() # Mock the hardware layer to avoid errors.
from ledshimdemo.canvas import Canvas
from ledshimdemo.effects.cheerlights import CheerLightsEffect
class TestCheerLights(TestCase):
TEST_CANVAS_SIZE = 3 # t... | StarcoderdataPython |
120870 | <gh_stars>0
import os
from lisdf.parsing.sdf import SDF, Collision, Link, Mesh, Visual
def _handle_component(component, model_path: str) -> None:
"""
Handle component and inject URI into link component geometry
"""
if isinstance(component, Link):
for link_component in component.aggregate_orde... | StarcoderdataPython |
1631816 | <filename>python/labs/shopping-list-app/starter-code/shopping_list_starter.py<gh_stars>1-10
#!/usr/bin/python
#
# Copyright 2018 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
#
#... | StarcoderdataPython |
1747719 | from django import forms
from django_measurement.forms import MeasurementField
from tests.custom_measure_base import DegreePerTime, Temperature, Time
from tests.models import MeasurementTestModel
class MeasurementTestForm(forms.ModelForm):
class Meta:
model = MeasurementTestModel
exclude = []
c... | StarcoderdataPython |
1725464 | <gh_stars>0
import pytest
from snek_case.sneks import Snek
class TestSnek(Snek):
snek_type = "test"
snek = "---:>"
def test_cannot_create() -> None:
# Assemble / Act / Assert
with pytest.raises(TypeError):
Snek() # type: ignore
def test_can_subclass() -> None:
# Assemble / Act / Asser... | StarcoderdataPython |
1747905 | <gh_stars>1000+
#
# Copyright 2019 The FATE 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 r... | StarcoderdataPython |
3261607 | import numpy as np
from glm import vec2
from ....model.model import Material, RenderCompound
from ....gl.framebuffer import FrameBuffer, FB_NONE
from ....gl.shader import ShaderProgram
from ...base import SecondPassRenderer
from ...util import sample_vertex_shader, gen_screen_mesh
# Separable convolution
vert_shader ... | StarcoderdataPython |
139993 | <filename>mini-apps/tic-tac-toe-full/tic_tac_toe_module.py
import random
# def generate_board():
# """
# funkcija ki generira naključno tic tac toe board - igralno ploščo
# vzorci = ['X','O']
# nakljucen_vzorec = random.choice(vzorci)
# """
# return board
# def print_board(board):
# ""... | StarcoderdataPython |
3366807 | <reponame>icsi-berkeley/framework-code
"""
.. The SpecalizerTools module performs basic operations to gather information from a SemSpec
and output an n-tuple.
.. moduleauthor:: <NAME> <<EMAIL>>
------
See LICENSE.txt for licensing information.
------
"""
from nluas.utils import update, Struct
... | StarcoderdataPython |
3355567 | <gh_stars>0
"""
Interactive CLI menu module
"""
# Imports
import os # Os module for the 'clear' command.
import sys # Sys module for the 'exit' command.
import config # Config module for the setter functions.
import cron # Cron module for the crontab manipulations.
# Menu decorator
def menu_decorator(menu):
... | StarcoderdataPython |
1775257 | #Parte 1:
from argparse import BooleanOptionalAction
from asyncio import current_task
from msilib.schema import Directory
from tkinter.messagebox import ABORTRETRYIGNORE
from tkinter.tix import REAL
from pkg_resources import NullProvider
tipo CUENTA estructura
saldo: REAL
descubierto: REAL
invariante
... | StarcoderdataPython |
1647694 | <filename>prepare/input/prepare_pre_select.py
from __future__ import print_function
from itertools import permutations
import numpy as np
import os
import glob
import cv2
import re
import sys
import matplotlib.pyplot as plt
ROUNDS = 100
DIFF = 5
DIFF_RANGE = 0
MODE = 'all'
MIN_DIR = int(sys.argv[1])
MAX_DIR = int(sy... | StarcoderdataPython |
3371895 | <filename>datedfolders.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 22 08:34:18 2020
@author: anthonysafarik
"""
import subprocess
import os
import shutil
def check_output(cmd):
try:
output = subprocess.check_output(cmd)
return output
except:
return ''
def... | StarcoderdataPython |
148199 | <filename>dags/s3topostgres_dag.py<gh_stars>0
"""Airflow DAG S3 to postgres
@author:Shaurya
@date: 2021-01-03
"""
import os,sys,inspect
current_dir=os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir=os.path.dirname(current_dir)
sys.path.insert(0,parent_dir)
from pprint import ... | StarcoderdataPython |
3214076 | <filename>acmicpc/2457/2457.py<gh_stars>1-10
n = int(input()) # 꽃의 개수
def quick_sort_in_list(unsorted:list, start, end)->list:
if end - start <= 0:
return
pivot = unsorted[end]
i = start
for j in range(start, end):
if unsorted[j] <= pivot:
unsorted[i], unsorted[j] = unsorte... | StarcoderdataPython |
67010 | <gh_stars>1000+
import h2o
h2o.init()
weather_hex = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/junit/weather.csv")
# Get a summary of the data
weather_hex.describe()
| StarcoderdataPython |
1753440 | <filename>tess/utils.py
from datetime import datetime
from tess.data.vulnerability import Vulnerability
class Utils:
@staticmethod
def get_available_feature_schema(data, force_base_entries=True):
cwe_entries = []
capec_entries = []
keywords_entries = []
for el in data:
... | StarcoderdataPython |
44889 | <gh_stars>1-10
#!/usr/bin/env python
import s3p_openstack_tools as s3p
from datetime import datetime
import argparse
import sys
import os
import pdb
from time import sleep
debug_mode=False
verbosity_level=0
# cloud test control: check main() for definition of cloud_info using these
validate_existing = True
attach_to_r... | StarcoderdataPython |
1788989 | <gh_stars>1-10
from numpy.core.numeric import Infinity
__author__ = '<NAME> <<EMAIL>>'
# TODO: this class will be removed in the future
class TimeRangeVO:
startDate = -Infinity
endDate = Infinity
def __init__(self, start_date, end_date):
self.startDate = start_date
self.endDate = end_da... | StarcoderdataPython |
27425 | # Import the Evernote client
from evernote.api.client import EvernoteClient
# Define access token either:
# Developer Tokens (https://dev.evernote.com/doc/articles/dev_tokens.php)
# or OAuth (https://dev.evernote.com/doc/articles/authentication.php)
access_token = "insert dev or oauth token here"
# Setup the client
c... | StarcoderdataPython |
3391834 | from .conn import LogicalConnection
| StarcoderdataPython |
1601003 | <reponame>saschajullmann/sedotra
from app.crud.base import CRUDBase
from app.models.team import Team
from app.schemas.team import TeamCreate, TeamUpdate
class CRUDTeam(CRUDBase[Team, TeamCreate, TeamUpdate]):
pass
team = CRUDTeam(Team)
| StarcoderdataPython |
191836 | import os
from blockstack.client import BlockstackClient
token = os.environ.get('BK_TOKEN')
client = BlockstackClient(base_uri=('%s/api' % os.environ['BK_INSTANCE']), token=token)
alice = client.wallets.get('Blue')
bob = client.wallets.get('Red')
alice_oracle = client.oracles.get('Blue')
bob_oracle = client.oracles.ge... | StarcoderdataPython |
120759 | # -*- coding: utf-8 -*-
#
# File: cooper.py
# Author: <NAME> <<EMAIL>>
# Date: Fri Jan 20 16:12:23 2012
#
#
# Copyright (c) 2012, 2015 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "S... | StarcoderdataPython |
3265056 | <gh_stars>0
#Find Perfect Numbers
##TOOLS
def Divisors(num):
from math import sqrt as mmsq
s=set([1])
i=1
a=int(mmsq(num)+1)
while i<=a:
if(num//i==num):
i+=1
continue
if (num%i==0):
if (num//i!=i):
s.add(num//i)
s.... | StarcoderdataPython |
8461 | <reponame>dumbPy/beancount_bot
import traceback
import telebot
from telebot import apihelper
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton, MessageEntity, Message, CallbackQuery
from beancount_bot import transaction
from beancount_bot.config import get_config, load_config
from beancount_bot.disp... | StarcoderdataPython |
101204 | """
Parameters and syntactic sugar.
"""
def dec(func):
def wrapper(*args, **kwargs):
print('Top decoration')
rv = func(*args, **kwargs)
print('Bottom decoration')
return rv
return wrapper
@dec
def sum_it(a, b):
return(a + b)
x = sum_it(10, 5)
print(x)
| StarcoderdataPython |
1764392 | <gh_stars>1-10
"""TEST MODULE TEMPLATE"""
from advent_of_code.utils.parse import parse_guard_records
from advent_of_code.y2018.d4 import solution_1
from advent_of_code.y2018.d4 import solution_2
def test_solution_1():
example_input = """[1518-11-01 00:00] Guard #10 begins shift
[1518-11-01 00:05] falls asleep
[15... | StarcoderdataPython |
14213 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 2 13:09:55 2018
@author: mali
"""
#import time
import pickle
import pyNN.utility.plotting as plot
import matplotlib.pyplot as plt
import comn_conversion as cnvrt
import prnt_plt_anmy as ppanmy
# file and folder names =============================... | StarcoderdataPython |
1799678 | <filename>gyp/ios.gyp
{
'includes': [
'../ios/app/mapboxgl-app.gypi',
'../ios/benchmark/benchmark-ios.gypi',
],
}
| StarcoderdataPython |
3230091 | import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from torch import optim
import numpy as np
NUM_CLASSES = 21
class SimpleClassifier(nn.Module):
def __init__(self):
super(SimpleClassifier, self).__init__()
self.conv1 = nn.Conv2d(3, 64, 5)
... | StarcoderdataPython |
1655414 | <reponame>SDomarecki/WSEOptimizer<gh_stars>1-10
from datetime import date
from app.config import Config
def test_init_validData_createsValidConfig():
test__fetch_database_config_validData_fetchesValidVariables()
test__fetch_simulation_config_validData_fetchesValidVariables()
test__fetch_selection_config_... | StarcoderdataPython |
4821547 | <filename>src/helpers/split_email.py
def split_email(email):
"""
Input: string
Returns: "username"
If the "email = x" argument is provided to the main function, split_email
is called. Splits string containing an email address on the '@',
returns 0th element.
"""
username ... | StarcoderdataPython |
3386291 | <filename>3_data_cleaning.py<gh_stars>1-10
import pymongo
import pandas as pd
def convert_to_excel(pdict):
columns = ['职位ID', '公司ID', '国家', '经度', '纬度', '行业领域', '教育水平', '工作经验', '城市', '区域', '职位诱惑',
'最低工资', '最高工资', '平均工资', '职位名称', '公司规模', '公司缩写名', '财务阶段', '工作性质', '公司标签',
'职位标签', '行业标签',... | StarcoderdataPython |
1707783 | import copy
from spec_classes.types.missing import _MissingType, MISSING
def test_missing():
assert MISSING is _MissingType()
assert bool(MISSING) is False
assert repr(MISSING) == "MISSING"
assert copy.copy(MISSING) is MISSING
assert copy.deepcopy(MISSING) is MISSING
| StarcoderdataPython |
1720600 | ######################################################################
# @author : bidaya0 (<EMAIL>@$HOSTNAME)
# @file : api_route
# @created : Tuesday Aug 17, 2021 17:43:27 CST
#
# @description :
######################################################################
from django.db import models
from d... | StarcoderdataPython |
1647972 | import random
import time
from airtest.core.api import *
from airtest.core.error import TargetNotFoundError
from airtest.core.helper import (G, delay_after_operation)
def connect_windows(name):
""" 连接win设备
"""
try:
connect_device("windows:///?title_re=%s" % name)
except Exception as e:
... | StarcoderdataPython |
57113 | <reponame>diatomsRcool/checklists<gh_stars>1-10
#this code changes the file names from geonames id to country name
#it creates a directory for each country and places the tsv file in that directory
#the country name is all lower case with underscores for spaces
#be sure to change the file paths for your local machine
... | StarcoderdataPython |
58923 | <filename>hcc_october_inservice_2021/simple_nn.py<gh_stars>0
# simple_nn.py
# A simple neural network with one node that has two inputs and one output.
train_X = [1, 2, 4, 5, 6, 7]
train_Y = [3, 5, 4, 6, 7, 2]
def initialize_parameters: | StarcoderdataPython |
58350 | <reponame>furious-luke/polecat<gh_stars>1-10
from polecat.db.schema import IntColumn, RelatedColumn, Schema, Table
def create_table(name=None, related_table=None, schema=None):
columns = [
IntColumn('id', primary_key=True),
IntColumn('col1'),
IntColumn('col2')
]
if related_table:
... | StarcoderdataPython |
184613 | '''
This is a simple service class which accepts http requests and return data based on the request in JSON format.
Services -
1./emp - return all rows of the csv file as a JSON array.
2./emp/column/{csv column name} It return all values of a csv column.
E.g./emp/column/City will return all Cities like "Seat... | StarcoderdataPython |
146189 | <gh_stars>1-10
from typing import Any
from dagster.core.errors import DagsterInvalidConfigError
from ...config import Shape
from ..execution.context.logger import InitLoggerContext, UnboundInitLoggerContext
from .logger_definition import LoggerDefinition
def logger_invocation_result(logger_def: LoggerDefinition, in... | StarcoderdataPython |
1797096 | <reponame>rlan/LeetCode
#
# LeetCode
# Algorithm 136 Single Number
#
# <NAME>, May 6, 2017.
# See LICENSE
#
# Test case(s):
# [1]
# [0,2,0]
#
# Your runtime beats 83.04 % of python submissions.
#
class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
... | StarcoderdataPython |
3359225 | <reponame>saai-sudarsanan-d/Alpha-v1<filename>intent_keys.py
import re
intent_keywords = {
'self':['your','you','yourself'],
'greet': ['hi','morning','hello','welcome','Hey','Nice to meet you'],
'time': ['time', 'clock'],
'date':['date','day','calendar','today'],
"search":['search',"when","wha... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.