id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
194411 | # Copyright 2014 Facebook, Inc.
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.
# As with any software that integrates with the Fa... | StarcoderdataPython |
3322441 | <reponame>jtmillard/fusionpbx-install.py
"""
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (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.mozilla.org/MPL/
So... | StarcoderdataPython |
3264689 | <gh_stars>0
from django import forms
from .models import Profile, Project, Rating
class ProjectForm(forms.ModelForm):
class Meta:
model = Project
exclude = ['poster','postername', 'pub_date']
class RatingForm(forms.ModelForm):
class Meta:
model = Rating
exclude = ['average','project','postername... | StarcoderdataPython |
161479 | <filename>dqpackage/libdaq/timeutils.py<gh_stars>0
'''Some usefull time hooks basing on a simple time module. '''
import time
import matplotlib.mlab as mlab
def upper_day(ut):
uht = upper_hour(ut)
gmt = time.localtime(uht)
if gmt.tm_hour == 0:
return uht
else:
return uht + (24 - gmt.tm... | StarcoderdataPython |
3392518 | from numpy import *
import numpy as np
import pandas as pd
import math
from math import log
import operator
def calcInfoEnt(dataSet):
numEntries = len(dataSet)
labelCounts = {}
for featVec in dataSet:
curLabel = featVec[-1]
if curLabel not in labelCounts.keys():
labelCounts[curL... | StarcoderdataPython |
89369 | <reponame>LMSC-NTappy/PyMoDAQ<filename>src/pymodaq/daq_utils/parameter/pymodaq_ptypes/itemselect.py
from qtpy import QtWidgets, QtCore, QtGui
from pyqtgraph.parametertree.Parameter import ParameterItem
from pyqtgraph.parametertree.parameterTypes.basetypes import WidgetParameterItem
from pyqtgraph.parametertree import P... | StarcoderdataPython |
28495 | from python_helper import log, Test, SettingHelper, RandomHelper, ObjectHelper, TestHelper, ReflectionHelper, Constant
from python_framework import EncapsulateItWithGlobalException, GlobalException, ExceptionHandler, HttpStatus
LOG_HELPER_SETTINGS = {
log.LOG : False,
log.INFO : True,
log.SUCCESS : True,
... | StarcoderdataPython |
3370046 | <gh_stars>1-10
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/metrics.ipynb (unless otherwise specified).
__all__ = ['peace', 'ece', 'ece_v2', 'class_wise_error']
# Cell
from riverreliability import utils
import numpy as np
import scipy.stats
import scipy.integrate
import riverreliability.beta
import sklear... | StarcoderdataPython |
4813468 | import itertools
def main() -> None:
# floyd_warshall -> tsp for visiting nodes.
n, m, r = map(int, input().split())
visiting_nodes = list(map(int, input().split()))
for i in range(r):
visiting_nodes[i] -= 1
INF = 1 << 60
dist = [[INF] * n for _ in range(n)]
for _ in r... | StarcoderdataPython |
1625941 | <gh_stars>10-100
import math
import numpy as np
import torch
from torch import nn, optim
from torch.nn import functional as F
import pytorch_lightning as pl
from pytorch_lightning.core.lightning import LightningModule
import argparse
import wandb
from relso.nn import bneck
from relso.nn.base import BaseModel, Bas... | StarcoderdataPython |
1619760 | <reponame>rikkt0r/hackerrank_python
def isBalanced(s):
_map = {
'{': '}',
'[': ']',
'(': ')'
}
stack = []
for c in s:
if c == '{' or c == '[' or c == '(':
stack.append(c)
else:
if not stack or _map[stack.pop()] != c:
return... | StarcoderdataPython |
82032 | from django.contrib import admin
from django.urls import path
from content.views import contentServiceViewSet
urlpatterns = [
path('content', contentServiceViewSet.as_view({
'get':'list',
'post':'create'
})),
path( 'contentfile', contentServiceViewSet.as_view({
'post':'fileupload'
... | StarcoderdataPython |
1686235 | """Copy and paste using the internet"""
__version__ = '0.1'
import argparse
import pyperclip as clipboard
import requests
from bs4 import BeautifulSoup
from colorama import Fore
def create_clip(l, m, u):
"""Create clip """
url = u + l
response = requests.get(url)
page = response.content
soup = ... | StarcoderdataPython |
1773261 | """
N phase calculation engine
(c) <NAME>, 2018
"""
import numpy as np
from scipy.sparse.linalg import spsolve
from scipy.sparse import csc_matrix, hstack, vstack
from scipy.sparse.linalg import factorized
from scipy.sparse.linalg import splu
def gauss_seidel_power_flow(Vbus, Sbus, Ibus, Ybus,
... | StarcoderdataPython |
3346635 | """
Write a program which can filter even numbers in a list by using filter function. The list is: [1,2,3,4,5,6,7,8,9,10].
"""
"""Question:
Write a program which can filter even numbers in a list by using filter function. The list is: [1,2,3,4,5,6,7,8,9,10].
Hints:
Use filter() to filter some elements in a list.
Use l... | StarcoderdataPython |
3396389 | # -*- coding: utf-8
import os
import os.path
from setuptools import setup
setup(name='operant',
version='0.1',
author="<NAME>",
author_email="<EMAIL>",
packages=['operant','operant.storage'],
)
| StarcoderdataPython |
1759423 | from __future__ import print_function
import argparse
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.util... | StarcoderdataPython |
150886 | <filename>bonus_top_interview_questions/328. Odd Even Linked List.py<gh_stars>0
"""
Runtime: 62 ms, faster than 49.24% of Python3 online submissions for Odd Even Linked List.
Memory Usage: 16.6 MB, less than 81.51% of Python3 online submissions for Odd Even Linked List.
"""
from typing import List
from typing import Op... | StarcoderdataPython |
1662406 | #!/usr/bin/env python
import sys
from pyspark.sql import SparkSession
from csv import reader
from pyspark.sql.functions import format_string
spark = SparkSession.builder.appName("task2SQL").getOrCreate()
parking_violation = spark.read.format('csv').options(header='true',inferschema='true').load(sys.argv[1])
parking_... | StarcoderdataPython |
3212961 | <filename>modules/signatures/windows/antivm_vmware_in_insn.py<gh_stars>10-100
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from lib.cuckoo.common.abstracts import Signature
class VMWareInInstruct... | StarcoderdataPython |
49331 | <reponame>JonathanGailliez/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by M... | StarcoderdataPython |
189809 | from os.path import expanduser, join
import logging
NEBULA_API_URL = 'https://nebuladb.io/api/v1/'
CONFIG = join(expanduser("~"), '.nebula.conf')
PLATFORMS = ['digital-ocean', 'rackspace', 'linode', 'aws']
log = logging.getLogger(__name__)
def _get_api_key():
API_KEY = None
try:
with open(CONFIG) as... | StarcoderdataPython |
3354512 | <reponame>spockthegray/mantaflow
#
# Flip scene with adaptive time stepping (otherwise similar to flip02)
#
from manta import *
# solver params
dim = 3
res = 80
gs = vec3(res,res,res)
if (dim==2):
gs.z=1
s = Solver(name='main', gridSize = gs, dim=dim)
# how many frames to calculate
frames = 200
# adaptive time... | StarcoderdataPython |
126985 | <reponame>nhomar/timesheet<gh_stars>0
"""Console script for timesheet."""
import sys
import click
from timesheet import timesheet
@click.command()
@click.option('-s', '--server', type=str)
@click.option('--domain', type=str)
@click.option('--id', type=int)
def main(server, domain='[]', id=0):
click.echo("See clic... | StarcoderdataPython |
49106 | # -*- coding: utf-8 -*-
"""
Helper functions to organize CHDI imaging data
Created on Fri Jan 15 11:07:53 2016
@author: <NAME>
Python Version: Python 3.5.1 |Anaconda 2.4.1 (64-bit)
"""
import glob as gl
import pandas as pd
import numpy as np
import os
from functools import partial
def linear_pred(m,b,x):
y = m ... | StarcoderdataPython |
1699300 | # Compass example (not finished)
# Copyright (c) 2016 <NAME> & <NAME>
# 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, cop... | StarcoderdataPython |
1694965 | ### Author: <NAME> <<EMAIL>>
class dstat_plugin(dstat):
def __init__(self):
self.name = 'load avg'
self.nick = ('1m', '5m', '15m')
self.vars = ('load1', 'load5', 'load15')
self.type = 'f'
self.width = 4
self.scale = 0.5
self.server = os.getenv('DSTAT_SNMPSERV... | StarcoderdataPython |
3288365 | import json
import warnings
from dataclasses import dataclass
from dataclasses import field
from typing import Any
from typing import Callable
from typing import Dict
from typing import Iterable
from typing import List
from typing import Optional
from typing import Sequence
from typing import Type
from typing import Un... | StarcoderdataPython |
3360732 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2019-05-15 23:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('workflow', '0047_add_program_using_results_framework_booleanfield'),
('workflow', '0047_add_... | StarcoderdataPython |
28179 | <gh_stars>0
import pathlib
import click
from . import candeout
@click.group()
@click.argument("ifile", type=click.Path(exists=True, dir_okay=False), required=True)
@click.argument(
"ofile",
type=click.Path(exists=False, dir_okay=False, writable=True),
required=False,
)
@click.pass_context
def main(ctx, ... | StarcoderdataPython |
3324395 | <reponame>Natharam/Library-Management
from django.shortcuts import render
def my_view(request):
# View code here...
return render(request, 'index.html', {
'foo': 'bar',
}, content_type='application/xhtml+xml') | StarcoderdataPython |
3323639 | import pandas as pd
from probdrift import Y_VAR, X_VAR
col_subset = X_VAR + Y_VAR + ["id"]
dat = pd.read_csv("atlantic_oc.csv")
dat.sort_values("t", inplace=True)
subset = dat[col_subset]
to_save = subset.iloc[:1000, :]
to_save.to_csv("test_dat.csv", index=False)
| StarcoderdataPython |
53052 | from unittest import TestCase
from pathlib import Path
from src.markdown_converter import MarkdownConverter
class TestMarkdownHeader(TestCase):
def setUp(self):
self.converter = MarkdownConverter("test/dokuwiki_example.txt")
def test_acceptance_test_case(self):
# python 3.5 and up
e... | StarcoderdataPython |
173038 | <reponame>rotem94/MCTS-T-
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 20 14:17:31 2018
Result plotting
@author: thomas
"""
import matplotlib as mpl
#from prettyplotlib import mpl
#from prettyplotlib import brewer2mpl
mpl.use('Agg')
mpl.rc('font',**{'family':'sans-serif','serif':['Computer Modern Roman']})
#mpl.rc(... | StarcoderdataPython |
158083 | match 42:
case x if x % 4 == 0 and (x % 400 == 0 or x % 100 != 0):
y
z | StarcoderdataPython |
1648902 | import datetime
from src import tkfinder
from src.resources import const, embed
def get_character_name_from_content(content):
first_line = content[0]
return first_line.split("Similar moves from ")[1]
def get_moves_from_content(content):
content.pop(0)
for i in range(len(content)):
content[i... | StarcoderdataPython |
1656703 | <filename>cogs/4inrow.py
import discord
from discord.ext import commands
from utils.settings import GlobalVars
from itertools import groupby, chain
import logging
import random
globalVars = GlobalVars()
logging.getLogger('discord').setLevel(logging.CRITICAL)
logging.basicConfig(filename=globalVars.path + 'peritabot.lo... | StarcoderdataPython |
16455 | <gh_stars>1-10
L = ['michael', 'sarah', 'tracy', 'bob', 'jack']
# 取前N个元素
r = []
n = 3
for i in range(n):
r.append(L[i])
print(r)
# python提供slice操作符简化.
m = 0
print(L[m:n], L[:n], L[-n:-1])
L = list(range(100))
print(L[:10], '\r', L[-10:], '\r', L[10:20], '\r', L[:10:2], '\r', L[::5])
print((0, 1, 2, 3, 4, 5)[:3])
pri... | StarcoderdataPython |
3312439 | def f(n):
for i in xrange(n):
pass
f(100000000)
print "done with first"
_xrange = xrange
def xrange(end):
return _xrange(end-1)
f(100000000)
print "done with second"
| StarcoderdataPython |
3273521 | <gh_stars>1-10
from django.shortcuts import render
from django.views.generic import ListView,TemplateView,DetailView,DeleteView,UpdateView,CreateView
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth import login,logout
from django.contrib.auth.decorators import login_required
from djan... | StarcoderdataPython |
1636263 | # coding=utf-8
import optparse
import itertools
import matplotlib.pyplot as plt
import sys
import visdom
import torch
import pickle
from collections import OrderedDict
from tqdm import tqdm
from torch.autograd import Variable
from sklearn.metrics import classification_report, f1_score, confusion_matrix
import loader
... | StarcoderdataPython |
179218 | import argparse
import yaml
from dotmap import DotMap
from os import path
import numpy as np
import torch
from torch.utils.data import DataLoader
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lig... | StarcoderdataPython |
1738957 | <reponame>ryuta46/catbuffer-generators
from .JavaScriptFunctionGenerator import FunctionType, JavaScriptFunctionGenerator
from .JavaScriptGeneratorUtils import indent
class JavaScriptClassGenerator:
@staticmethod
def get_generated_class_name(name):
return '{}Buffer'.format(name)
@staticmethod
... | StarcoderdataPython |
3346149 | import datetime
from time import time
import unittest
import urbanairship as ua
from tests import TEST_KEY, TEST_SECRET
class TestAttribute(unittest.TestCase):
def setUp(self):
self.test_time = datetime.datetime.utcnow()
self.test_time_str = self.test_time.replace(microsecond=0).isoformat()
d... | StarcoderdataPython |
1646010 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-21 21:37
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0026_auto_20161117_1304'),
]
operations = [
migrations.Remov... | StarcoderdataPython |
1612470 | <reponame>haje01/ray
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
from types import FunctionType
import ray
import ray.cloudpickle as pickle
from ray.experimental.internal_kv import _internal_kv_initialized, \
_internal_kv_get, _intern... | StarcoderdataPython |
1781343 |
from loguru import logger
import bittensor.utils.networking as net
class Neuron:
uid: int
hotkey : str
ip: str
ip_type: int
modality: int
coldkey : str
def __init__(self, uid, hotkey, ip, ip_type, modality, coldkey):
self.uid = uid
self.hotkey = hotkey
self.ip = ne... | StarcoderdataPython |
126104 | from nlgen.cfg import CFG, PTerminal, PUnion
def test_simple_production_union():
cfg = CFG([
("S", PUnion([
PTerminal("foo"),
PTerminal("bar")
])),
])
expect = [("foo",), ("bar",)]
result = list(cfg.permutation_values("S"))
assert expect == result
def test... | StarcoderdataPython |
123940 | # Generated by Django 3.1 on 2022-03-22 05:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('store', '0003_reviewrating'),
]
operations = [
migrations.RenameField(
model_name='reviewrating',
old_name='created_date',
... | StarcoderdataPython |
3339821 | <gh_stars>1-10
# coding=utf-8
"""
API for storage indexing, access and search.
"""
from __future__ import absolute_import
import logging
import pathlib
import cachetools
import jsonschema
import yaml
try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
from yaml import SafeLoader
from datacub... | StarcoderdataPython |
190598 | <gh_stars>0
from .collection import all_collection
from .rules import all_rules
for t in all_collection:
t.add_rules(all_rules)
def generate(theme):
if theme == 'all':
for t in all_collection:
write_theme_to_file(t)
else:
for t in all_collection:
if theme == t.sch... | StarcoderdataPython |
753 | <filename>tests/test_dynamics.py
import pytest
import numpy as np
from casadi import MX, SX
import biorbd_casadi as biorbd
from bioptim.dynamics.configure_problem import ConfigureProblem
from bioptim.dynamics.dynamics_functions import DynamicsFunctions
from bioptim.interfaces.biorbd_interface import BiorbdInterface
fr... | StarcoderdataPython |
1668094 | <gh_stars>1-10
import boto3
from logging import getLogger, StreamHandler, DEBUG
logger = getLogger(__name__)
handler = StreamHandler()
handler.setLevel(DEBUG)
logger.setLevel(DEBUG)
logger.addHandler(handler)
logger.propagate = False
client = boto3.client('cloudformation')
def create_simulation_resource(resource_fil... | StarcoderdataPython |
1757130 | import torch
import logging
def get_device(args):
if args.training_type == "simulation" and args.backend == "single_process":
if args.using_gpu:
device = torch.device(
"cuda:" + str(args.gpu_id) if torch.cuda.is_available() else "cpu"
)
else:
de... | StarcoderdataPython |
4835747 | from functools import partial
from io import BytesIO
from operator import attrgetter
import unicodecsv as csv
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_str as force_text
def get_pretty_name(accessor):
return accessor.replace("_", " ").replace(".", " ").capita... | StarcoderdataPython |
3263023 | <reponame>thiagofreitascarneiro/Grafico_Charts.js
from random import randint
from django.views.generic import TemplateView
from chartjs.views.lines import BaseLineChartView
class IndexView(TemplateView):
template_name = 'index.html'
class DadosJSONView(BaseLineChartView):
def get_labels(self):
'''R... | StarcoderdataPython |
1605259 | import requests
from .constants import AIRPOL_URL
import json
from typing import Optional
from .apmodel import AirpolData
import os
API_KEY = os.getenv("API_KEY") or None
if not API_KEY:
raise Exception("API_KEY doesn't exit")
def by_geoc(lat: float, lon: float, types: Optional[str] = "current") -> AirpolD... | StarcoderdataPython |
1683064 |
import smart_imports
smart_imports.all()
class Road(django_models.Model):
point_1 = django_models.ForeignKey('places.Place', related_name='+', on_delete=django_models.CASCADE)
point_2 = django_models.ForeignKey('places.Place', related_name='+', on_delete=django_models.CASCADE)
length = django_models.F... | StarcoderdataPython |
168302 | import turtle as t
t.goto(100,0)
for i in range(50):
t.left(80)
t.fd(100)
t.left(135)
t.fd(105) | StarcoderdataPython |
169087 | <reponame>GAMES-UChile/mogptk
import torch
import numpy as np
from . import MultiOutputKernel, Parameter, config
class IndependentMultiOutputKernel(MultiOutputKernel):
def __init__(self, *kernels, output_dims=None, name="IMO"):
if output_dims is None:
output_dims = len(kernels)
super(In... | StarcoderdataPython |
3241904 | import idc
import ida_idaapi
import ida_kernwin
import traceback
import os
import sys
import threading
import debug_print
ida_idaapi.require("debug_print")
class cache_data(debug_print.debug):
def __init__(self, data_dict=None, config=None, debug=False):
#debug_print.debug.__init__(self, de... | StarcoderdataPython |
3281576 | <filename>bugal/base/models/countries.py
"""Country Model."""
# Django
from django.db import models
class Country(models.Model):
"""Country model
Creates Countries table.
"""
name = models.CharField(max_length=100, unique=True)
short_name = models.CharField(max_length=5, unique=True)
def _... | StarcoderdataPython |
1786588 | <reponame>meikuam/screen-saver<filename>src/screen-saver.py<gh_stars>0
import os
import sys
sys.path.insert(1, os.path.abspath(".."))
from src.utils.cam import cam_capture
import dbus
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
def get_root_dir():
return os.path.abspath('..')
def... | StarcoderdataPython |
3211194 | <reponame>sampotter/pyvista
import pytest
import pyvista as pv
def test_compare_images_two_plotters(sphere, tmpdir):
filename = str(tmpdir.mkdir("tmpdir").join('tmp.png'))
pl1 = pv.Plotter()
pl1.add_mesh(sphere)
arr1 = pl1.screenshot(filename)
im1 = pv.read(filename)
pl2 = pv.Plotter()
pl... | StarcoderdataPython |
1736508 | <reponame>Fleen66/Python_exercises
valordacasa = float(input('Digite o valor da casa: '))
salario = float(input('Digite o valor de seu salario: '))
anos = int(input('Digite em quantos anos irá financiar o imovel: '))
# calculando #
meses = 12 * anos
mensalidade = valordacasa / meses
#fazendo a condição do calculo
if me... | StarcoderdataPython |
1754506 | <filename>robots/misc/sound.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Copyright (c) 2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation fil... | StarcoderdataPython |
171003 | <reponame>NickleDave/make-vis-search-stim-pygame<gh_stars>1-10
import pygame
from .abstract_stim_maker import AbstractStimMaker
class RVvGVStimMaker(AbstractStimMaker):
"""Make visual search stimuli with vertical rectangles
where target is red and distractors are green."""
def draw_item(self, display_sur... | StarcoderdataPython |
46645 | <gh_stars>10-100
import csv
import hashlib
import logging
import secrets
import os
import pandas as pd
from datetime import datetime
import dateutil.parser as parser
from flask import (Blueprint, flash, redirect, render_template, request,
send_file, url_for, current_app)
from flask_login import cur... | StarcoderdataPython |
154254 | import json
import pandas as pd
from dataprep.scrape_all_alexa_information import main
file_name = "data_for_trainig_model_corpus_2018_audience_overlap_sites_level_3_and_referral_data_2018_corpus_level3_deep.csv"
df = pd.read_csv(file_name)
df.head()
unique_sources = df.source.unique().tolist()
uniqu... | StarcoderdataPython |
4812682 | from gamechangerml.src.search.ranking import features as ft
def add_pagerank_r(doc_dict):
doc_dict["pagerank_r"] = ft.get_pr(doc_dict["id"])
return doc_dict
def add_popscore_r(doc_dict):
doc_dict["pop_score"] = ft.get_pop_score(doc_dict["filename"])
return doc_dict
def add_orgs_rs(doc_dict):
d... | StarcoderdataPython |
59475 | <gh_stars>0
from random import randint as r
class Game:
@staticmethod
def zar_at():
return r(1,7) | StarcoderdataPython |
1674514 | <gh_stars>1-10
# --
# Copyright (c) 2008-2017 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
import os
import textwrap
from setuptools import setup, find_packages
VERSION =... | StarcoderdataPython |
44996 | <reponame>andykimchris/Unsplash
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2018-02-26 18:00
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('images', '0001_initial'),
]
operations = [
migratio... | StarcoderdataPython |
1682843 | """
=========================================
prop_cycle property markevery in rcParams
=========================================
This example demonstrates a working solution to issue #8576, providing full
support of the markevery property for axes.prop_cycle assignments through
rcParams. Makes use of the same list of... | StarcoderdataPython |
3364317 | <reponame>Bentechy66/mini-ww-bot<filename>wwbot/__main__.py
import os
import sys
import traceback
import logging
logging.basicConfig(level=logging.INFO, format='%(levelname)s::%(name)s@%(asctime)s : %(message)s')
logger = logging.getLogger("wwbot")
from wwbot.errors import WWBotException
import discord
from discord.... | StarcoderdataPython |
99338 | <gh_stars>1-10
import os
import random
from langdetect import detect
import sys
import glob
import re
from os.path import basename, dirname
lang1 = "ja"
input_folder = "./03_length_clean"
output_folder = "./04_lang1_combine"
try:
lang1 = sys.argv[1]
input_folder = sys.argv[2]
output_folder = sys.argv[3]
e... | StarcoderdataPython |
4825412 | # Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
3249768 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from conans import ConanFile, CMake, tools, RunEnvironment
class FontconfigTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configu... | StarcoderdataPython |
56096 | import sys
class DynamicTerminalOutput:
def __init__(self, start_output):
self.last_output = start_output
print(start_output)
def update(self, new_output: str):
self._clear_previous()
print(new_output)
self.last_output = new_output
def clear(self):
self.up... | StarcoderdataPython |
1604226 | #!/usr/bin/env python2
import os
import argparse
import numpy as np
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='stamp state estimate that are marked using id')
parser.add_argument('state_est',
help='state estimate file that starts with id')
pa... | StarcoderdataPython |
1690125 | import cPickle as pickle
import gzip
import re
from urlparse import urljoin
from time import sleep as delay
from functools import wraps
import requests
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
def load(filename):
with gzip.open(filename) as f:
return pickle.load(f)
searchurl ... | StarcoderdataPython |
80399 | def get_sum(arr,i,j):
sum = 0
sum += arr[i-1][j-1]
sum += arr[i-1][j]
sum += arr[i - 1][j+1]
sum += arr[i][j]
sum += arr[i+1][j-1]
sum += arr[i+1][j]
sum += arr[i+1][j+1]
return sum
if __name__ == '__main__':
arr = []
for _ in range(6):
arr.append(list(map(int, inp... | StarcoderdataPython |
159487 | import time
import json
from .master_valve_control_py3 import Master_Valve
from .valve_resistance_check_py3 import Valve_Resistance_Check
from .clean_filter_py3 import Clean_Filter
from .check_off_py3 import Check_Off
#from .irrigation_control_py3 import Irrigation_Control
f... | StarcoderdataPython |
191714 | <filename>TP2/Script TP2 ArangoDB.py
from pyArango.connection import *
import pandas as pd
from tqdm import tqdm
conn = Connection(username="root", password="")
try:
db = conn.createDatabase(name="tp2BasesDeDatos")
except CreationError:
db = conn["tp2BasesDeDatos"]
#levanto las tablas en CSV a Pandas
SUPERH... | StarcoderdataPython |
1736070 | <reponame>gtataranni/bcc<gh_stars>10-100
#!/usr/bin/python
#
# stacksnoop Trace a kernel function and print all kernel stack traces.
# For Linux, uses BCC, eBPF, and currently x86_64 only. Inline C.
#
# USAGE: stacksnoop [-h] [-p PID] [-s] [-v] function
#
# Copyright 2016 Netflix, Inc.
# Licensed under... | StarcoderdataPython |
3257942 | <filename>tests/integration_docker/ContainerStatsStreamTest.py
import unittest
from lib.Docker.DependencyResolver import DependencyResolver
class ContainerStatsStreamTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.containerStatsStreamPool = DependencyResolver.get_Resolver().get_Contai... | StarcoderdataPython |
1600173 | from .avl_tree import AVLTree
from .interface import ADTInterface
| StarcoderdataPython |
1636046 | <filename>PySONIC/neurons/sweeney.py
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Email: <EMAIL>
# @Date: 2019-06-11 15:58:38
# @Last Modified by: <NAME>
# @Last Modified time: 2020-03-31 18:13:57
import numpy as np
from ..core import PointNeuron, addSonicFeatures
@addSonicFeatures
class SweeneyNode(PointNeuron... | StarcoderdataPython |
3293012 | import torch.nn as nn
from utils.utils import *
device = get_default_device()
class LSTMVAE(nn.Module):
def __init__(self, batch_size, time_step, input_size, hidden_size, z_size, mean=None, sigma=None):
super().__init__()
# init param
self.batch_size = batch_size
self.time_step =... | StarcoderdataPython |
3305647 | from __future__ import division
import sys
import matplotlib.pyplot as plt
import numpy as np
import scipy.signal as signal
import scipy.stats as stats
import scipy.interpolate as intr
import deriv
class SplinedBinConverter(object):
def __init__(self, low, high, bins):
self.low, self.high, self.bins = low... | StarcoderdataPython |
1724688 | <filename>tests/test_historic_ag.py
# Copyright (c) 2021 | KingKevin23 (@kingkevin023)
from unittest import TestCase
from datetime import date, datetime
from json import loads
from agspiel.api.historic_ag import HistorischeAg
class TestHistorischeAg(TestCase):
def setUp(self):
f = open("testhistoricag.j... | StarcoderdataPython |
4837366 | # coding: utf-8
"""
AIS
AIStore is a scalable object-storage based caching system with Amazon and Google Cloud backends. # noqa: E501
OpenAPI spec version: 1.1.0
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import shu... | StarcoderdataPython |
3222210 | import os
from fabric.api import env, task, execute, run
from fabtools.vagrant import vagrant
import utils
import provision
import serve
# shared environment between local machines and remote machines
# (anything that is different gets overwritten in environment-setting
# functions)
env.mysql_root_password = '<PASSW... | StarcoderdataPython |
1734675 | <gh_stars>1-10
class RenderTree(object):
"""A tree interface where the only responsibility of subclasses is to define
what it means to render. Calling str on a RenderTree will implictly call render."""
def __str__(self):
return self.render()
def render(self, prefix=''):
raise NotImplem... | StarcoderdataPython |
3302542 | <filename>spooq/transformer/enum_cleaner.py<gh_stars>1-10
import sys
import pyspark.sql.functions as F, types as T
from pyspark.sql.column import Column
from .base_cleaner import BaseCleaner
class EnumCleaner(BaseCleaner):
"""
Cleanses a dataframe based on lists of allowed|disallowed values.
Examples
... | StarcoderdataPython |
4829425 | <filename>lldb/packages/Python/lldbsuite/test/expression_command/radar_9531204/TestPrintfAfterUp.py
"""
The evaluating printf(...) after break stop and then up a stack frame.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbte... | StarcoderdataPython |
1611665 | # Project Quex (http://quex.sourceforge.net); License: MIT;
# (C) 2005-2020 <NAME>;
#_______________________________________________________________________________
# PURPOSE: (quick overview, to keep the head of the file as a watch window)
#
# SM0: (0)--- 'a' --->(1)--- 'b' --->(2)--- 'c' --->(3)--- 'e' ---> SUCCES... | StarcoderdataPython |
1604055 | class MultipleJurisdictionsError(ValueError):
pass
class InvalidAppError(ValueError):
pass
| StarcoderdataPython |
9335 | """
Calibrate with the ROS package aruco_detect
"""
import rospy
import roslib
from geometry_msgs.msg import Transform
class ROSArUcoCalibrate:
def __init__(self, aruco_tag_len=0.0795):
print("Please roslaunch roslaunch aruco_detect aruco_detect.launch before you run!")
self.aruco_tf_topic = "/f... | StarcoderdataPython |
3228616 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 23 15:04:32 2018
@author: maximoskaliakatsos-papakostas
"""
import music21 as m21
import os
cwd = os.getcwd()
import sys
sys.path.insert(0, cwd + '/CM_auxiliary')
import CM_TonalityGrouping_classes as tgc
import CM_Misc_Aux_functions ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.