id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
28445
__author__ = "Wild Print" __maintainer__ = __author__ __email__ = "<EMAIL>" __license__ = "MIT" __version__ = "0.0.1" __all__ = ( "__author__", "__email__", "__license__", "__maintainer__", "__version__", )
StarcoderdataPython
1663580
from robloxpy import Asset Asset.price_in_robux(1)
StarcoderdataPython
1640033
<filename>idact/detail/helper/put_remote_file.py """This module contains a function for downloading a file from cluster in a Fabric task.""" from io import BytesIO import fabric.decorators from fabric.operations import put from idact.detail.helper.stage_info import stage_debug from idact.detail.log.capture_fabri...
StarcoderdataPython
1622497
import numpy as np import matplotlib.pyplot as plt def insert_zeros(trace, tt=None): """Insert zero locations in data trace and tt vector based on linear fit""" if tt is None: tt = np.arange(len(trace)) # Find zeros zc_idx = np.where(np.diff(np.signbit(trace)))[0] x1 = tt[zc_idx] x2...
StarcoderdataPython
113662
<filename>diamond_miner/generators/database.py from ipaddress import IPv6Address from typing import Iterable, Iterator, Optional from diamond_miner.defaults import ( DEFAULT_PREFIX_SIZE_V4, DEFAULT_PREFIX_SIZE_V6, DEFAULT_PROBE_DST_PORT, DEFAULT_PROBE_SRC_PORT, PROTOCOLS, UNIVERSE_SUBSET, ) fro...
StarcoderdataPython
4826619
import logging, math, json, pickle, os import matplotlib.pyplot as plt import numpy as np import matplotlib.dates as mdates from datetime import datetime import matplotlib.patches as patches from matplotlib.backends.backend_pdf import PdfPages import matplotlib.gridspec as gridspec import statistics logger = logging.g...
StarcoderdataPython
1624826
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.absp...
StarcoderdataPython
3373302
<reponame>beyond-blockchain/py-bbclib # -*- coding: utf-8 -*- """ Copyright (c) 2018 beyond-blockchain.org. 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/LICENS...
StarcoderdataPython
4824067
<filename>darkflow/darkflow/net/flow.py import os import time import numpy as np import tensorflow as tf import pickle train_stats = ( 'Training statistics: \n' '\tLearning rate : {}\n' '\tBatch size : {}\n' '\tEpoch number : {}\n' '\tBackup every : {}' ) def _save_ckpt(self, step, loss_profi...
StarcoderdataPython
3354320
<filename>python/testData/formatter/fromImportForceParenthesesIfMultiline_after.py from module import foo from module import foo, bar # | margin from module import (foo, bar, baz) from module import (foo, bar) from module import (foo, ...
StarcoderdataPython
3347416
<gh_stars>0 from PIL import Image from django.contrib.sites.models import Site from django.core.management.base import BaseCommand from api.models import * from djangocms_blog.cms_appconfig import BlogConfig from djangocms_blog.models import Post as BlogPost from filer.models import ThumbnailOption from django.conf ...
StarcoderdataPython
1662867
import sys import os import json import shlex import ast from pathlib import Path from pprint import pprint from datetime import datetime, timedelta from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.operators.python_operator import PythonOperator from airflow.operators.pytho...
StarcoderdataPython
155719
""" Building ======== The building module contains functions related to building acoustics. """ from __future__ import division import numpy as np #from acoustics.utils import w def rw_curve(tl): """ Calculate the curve of :math:`Rw` from a NumPy array `tl` with third octave data between 100 Hz and 3....
StarcoderdataPython
3343093
<reponame>KadinTucker/Temporary-NUMA01 # -*- coding: utf-8 -*- """ Created on Mon Jan 6 11:32:19 2020 @author: <NAME> """ from scipy import * from matplotlib.pyplot import * #x and y are lists of 2D vectors with z and a(a = alpha) #N is the number of iterations #xdz,xda,ydz,yda are the derivate functions ...
StarcoderdataPython
121077
__author__ = 'zhwei'
StarcoderdataPython
4818602
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 11 08:12:26 2019 @author: miguelcaballero """ # STD lib imports import os import sys # Third party libs import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt def corr_heatmap(data): correlations = data....
StarcoderdataPython
193555
<reponame>asadparkar/Marvelon-Discord-<gh_stars>0 import discord from discord.ext import commands import json import os import random import time import asyncio client=commands.Bot(command_prefix="!") #-----------------------------------------------------------(ITEMS SHOP)-----------------------------------...
StarcoderdataPython
3348936
<reponame>lyp2333/External-Attention-pytorch<gh_stars>1-10 import torch from torch import nn class Rearange(nn.Module): def __init__(self,image_size=14,patch_size=7) : self.h=patch_size self.w=patch_size self.nw=image_size // patch_size self.nh=image_size // patch_size ...
StarcoderdataPython
131079
from django.db.backends.sqlite3.base import ( DatabaseWrapper as BaseSqliteWrapper ) from ...cursor import CidCursorWrapper class DatabaseWrapper(BaseSqliteWrapper): def create_cursor(self, name=None): if name: base_cursor = super(DatabaseWrapper, self).create_cursor(name) else: ...
StarcoderdataPython
3327293
""" """ import sys if './' not in sys.path: sys.path.append('./') from screws.freeze.main import FrozenOnly from objects.CSCG._3d.mesh.boundaries.boundary.visualize import _3dCSCG_Mesh_Boundary_VIS class _3dCSCG_Mesh_Boundary(FrozenOnly): def __init__(self, bdrs, name): self._bdrs_ = bdrs ...
StarcoderdataPython
3284367
<filename>app/appapi/paths/system_api.py<gh_stars>0 from bottle import request, response from appapi.paths.base_api import BaseApi class SystemApi(BaseApi): def _path(self): return 'system' def alive(self): """ GET """ return 'Alive' def echo(self): """ ...
StarcoderdataPython
113293
<gh_stars>0 # Copyright 2015 Fortinet, 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 # #...
StarcoderdataPython
1739946
<gh_stars>100-1000 import jieba print(" ".join(jieba.cut("给我办一个三十的新流量业务")))
StarcoderdataPython
113640
<reponame>deveshwaripujari/deep-instrument import numpy as np from sklearn.base import BaseEstimator, TransformerMixin import sys # TODO: package the chromagram script sys.path.append('tools/music-processing-experiments/') from analysis import split_to_blocks from spectrogram import create_window from reassignment im...
StarcoderdataPython
4817636
<reponame>suulcoder/ProjectGenerator """ Class Databae will be util to make conection with Neo4J Project Generator Universidad del Valle de Guatemala <NAME> <NAME> <NAME> -Algunos proyectos almacenados en la base de datos fueron obtenidos de la siguiente fuente de información: Sciencebuddies.(2019). Recommendation pro...
StarcoderdataPython
169846
<gh_stars>0 import json import os from multiprocessing.pool import ThreadPool from web3 import Web3, IPCProvider from custom_http_provider import CustomHTTPProvider INFURA_ADDRESS = 'https://mainnet.infura.io/v3/4facf9a657054a2287e6a4bec21046a3' DEFAULT_REQUEST_TIMEOUT = 30 web3_infura = Web3(CustomHTTPProvider(endp...
StarcoderdataPython
36957
import sqlalchemy as sa import numpy as np import datetime as dt from faker import Faker from jinja2 import Environment, PackageLoader from database.models.core import ( Base, Products, Customers, TransactionDetails, Transactions, ) import logging logging.basicConfig() logger = logging.getLogger(...
StarcoderdataPython
1645718
""" A package which contains a bunch of small helpful devtools while scripting """ from .argsguard import args_guard from .parse import parse_int, parse_float from .ostools import * from .sysargs import args_to_dictionary from . import colorama_ext from .progression_bar import progress_bar from .log import log from .g...
StarcoderdataPython
3347460
from totalimpact.providers import provider from totalimpact.providers.provider import Provider, ProviderContentMalformedError import json, re, os, requests, socket from operator import itemgetter import logging logger = logging.getLogger('ti.providers.altmetric_com') class Altmetric_Com(Provider): example_id ...
StarcoderdataPython
1609820
<filename>04_LinkedLists/palindrome_list.py # Palindrome List # https://www.interviewbit.com/problems/palindrome-list/ # # Given a singly linked list, determine if its a palindrome. Return 1 or 0 denoting if its a palindrome or not, respectively. # # Notes: # # Expected solution is linear in time and constant in sp...
StarcoderdataPython
1632564
<reponame>danielSoler93/msm_pele import sys sys.settrace import os import socket import matplotlib import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties import numpy as np import argparse DATAFILE = 'pmf_xyz.dat' data = np.loadtxt(DATAFILE) #x = data[:,0] templateLine = "HETATM%s C1 ...
StarcoderdataPython
55497
import tqdm import mediapipe import requests import cv2 import numpy as np import matplotlib class FullBodyPoseEmbedder(object): """Converts 3D pose landmarks into 3D embedding.""" def __init__(self, torso_size_multiplier=2.5): # Multiplier to apply to the torso to get minimal body size. se...
StarcoderdataPython
1675069
from django.conf.urls import url, include from niji import urls as niji_urls urlpatterns = [ url(r'testurl', include(niji_urls, namespace="niji")), ]
StarcoderdataPython
3219843
<reponame>guyzmo/PyEtherpadLite #!/usr/bin/env python """Module to talk to EtherpadLite API.""" import json import urllib import urllib2 class APIClient: """Client to talk to EtherpadLite API.""" API_VERSION = "1.2.8" CODE_OK = 0 CODE_INVALID_PARAMETERS = 1 CODE_INTERNAL_ERROR = 2 CODE_INVALI...
StarcoderdataPython
3339530
<gh_stars>1-10 from functools import reduce from django.utils.translation import gettext_lazy as _ from django.db.models import Q, CharField, TextField, ManyToManyField, ForeignKey, SET_NULL, QuerySet, Count from app.conference.models.category import Category from app.users.models import User from app.utils.models impo...
StarcoderdataPython
164955
import torch import numpy as np # check if CUDA is available train_on_gpu = torch.cuda.is_available() device=torch.device('cuda' if torch.cuda.is_available() else 'cpu') if not train_on_gpu: print('CUDA is not available. Training on CPU ...') else: print('CUDA is available! Training on GPU ...') ...
StarcoderdataPython
3215889
from rantlib.core_application.ui.window.window import Window from rantlib.core_application.ui.theme import * from rantlib.core_application.ui.runnables.load_themes import LoadThemesRunnable from rantlib.core_application.ui.parts.pg_theme_sample import ThemeSamplePage from PyQt5.QtWidgets import QWidget, QHBoxLayout, QV...
StarcoderdataPython
86330
<filename>adminmgr/media/code/python/red1/BD_1595_1702_0194_reducer.py #!/usr/bin/python3 from itertools import groupby from operator import itemgetter import sys mydict={} wickets = 0 runs = 0 balls = 0 for line in sys.stdin: line = line.strip() batsman,bowler,run = line.split(',') key = (batsman,bowler) #[...
StarcoderdataPython
1743876
<reponame>JoeQureshi/stocal """Test that the exampe is working """ import unittest from stocal import MassAction, Event, ReactionRule, Process class Dilution(ReactionRule): """Dilution rule""" Transition = MassAction def novel_reactions(self, species): yield self.Transition([species], [], 0.001) ...
StarcoderdataPython
41697
""" Deep Residual Learning for Image Recognition https://arxiv.org/abs/1512.03385 """ from typing import Type import torch.nn as nn from uninas.modules.networks.stackedcells import StackedCellsNetworkBody from uninas.modules.stems.cnn import ConvStem from uninas.modules.layers.cnn import PoolingLayer from uninas.modul...
StarcoderdataPython
102161
<reponame>mkyutani/psarray #!/usr/bin/env python3 import chardet import io import platform import subprocess from subprocess import PIPE, DEVNULL class PSArray: def __init__(self): self.stream = None self.nextline = None def readline(self): if self.stream is None: return ...
StarcoderdataPython
3361920
<filename>core/game.py from core.player import Player from core.board import Board from core.warrior import Warrior from core.king import King from core.peasant import Peasant from core.ship import Ship from core.building import Building from core.battle import Battle GARDEN_INCOME = 1 PEASANT_PRICE = 2 WARRIOR_PRICE ...
StarcoderdataPython
4817931
from django.shortcuts import render, redirect from django.urls import reverse from django.http import JsonResponse from django.conf import settings from django.contrib import messages from django.core.mail import EmailMessage from django.template.loader import render_to_string from hknweb.events.views.aggregate_displa...
StarcoderdataPython
1784815
<filename>guanabara/Exercicios/mundo 3 _ aulas 16 a 23/090.py # SITUAÇÃO DO ESTUDANTE """Lê nome e média de um aluno, guardando também a situação deste num dicionário. Ao final, mostra o conteúdo da estrutura na tela.""" nome = str(input('Nome do estudante: _ ')).strip().title() media = float(input(f'Média de {nome}: ...
StarcoderdataPython
38619
<reponame>KelsonDenton/battleships import math class MoveValidator: # class takes coordinates, orient, spaces, and board as constructors def __init__(self, coord, orient, spaces, board): self.coordinate = coord self.orientation = orient self.space = spaces self.playerBoard = b...
StarcoderdataPython
157167
<reponame>migrationcv/customer_journey<gh_stars>0 import frappe from datetime import datetime from collections import OrderedDict def days_between(d1, d2): if type(d1) == type(d2): if(d1 > d2): return (d1 - d2).days else: return (d2 - d1).days else: return "not defined" ...
StarcoderdataPython
1646259
#!/usr/bin/env python3 # This sample demonstrates how to use the siem/source_addresses and # siem/local_destination_addresses endpoints in the REST API. # Here we will be showing an example of how to get all offenses associated with # an IP address. For this scenario to work there must already be offenses on # the sys...
StarcoderdataPython
3366892
<reponame>cclauss/CMasher # %% IMPORTS # Package imports from matplotlib.cm import register_cmap from matplotlib.colors import ListedColormap # All declaration __all__ = ['cmap'] # Author declaration __author__ = "<NAME> (@1313e)" # Package declaration __package__ = 'cmasher' # %% GLOBALS AND DEFINITIONS # Type of...
StarcoderdataPython
1701552
<gh_stars>100-1000 from django.utils.translation import ugettext_lazy as _ from mayan.apps.documents.models.document_file_models import DocumentFile from mayan.apps.documents.models.document_version_models import DocumentVersion DEFAULT_DOCUMENT_BODY_TEMPLATE = _( 'Attached to this email is the {{ object_name }}:...
StarcoderdataPython
196340
<reponame>rkini-pnnl/volttron-GS # -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # Copyright (c) 2017, Battelle Memorial Institute # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following cond...
StarcoderdataPython
183253
from setuptools import setup, find_packages def parse_requirements(requirement_file): with open(requirement_file) as f: return f.readlines() setup( name='slack-url-utils', version='1.0.0', packages=find_packages(exclude=['tests*']), license='MIT', description='A Python package of URL u...
StarcoderdataPython
10613
<reponame>adriens63/BERT_fine_tuning_for_MLM_and_token_classification import os.path as osp import argparse import yaml from src.token_classification.archs.data_formatter import * # ********************* launch formating *********************** # cmd to launch : python -m src.token_classification.format --config ...
StarcoderdataPython
3361167
"""Player or computer reaction to a roll.""" import random class Dice(): """Define dice variations.""" dice_pool_normal = (1, 2, 3, 4, 5, 6) dice_pool_easy = (1, 1, 2, 2, 2, 3, 3, 4, 5, 6) dice_pool_hard = (1, 2, 3, 4, 4, 5, 5, 5, 6, 6) dice_pool_cheat = dice_pool_normal[1:] def roll(self, ...
StarcoderdataPython
22250
<gh_stars>0 import os numeros = [0,0] numeros[0] = float(input('Digite o numero 1: ')) numeros[1] = float(input('Digite o numero 2: ')) print(f'o maior valor entre os dois é: {max(numeros)}') os.system('pause')
StarcoderdataPython
3306762
# Generated by Django 3.2.6 on 2021-12-30 20:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("core", "0012_add_trashed_indexes"), ] operations = [ migrations.AlterField( model_name="application", name="name", ...
StarcoderdataPython
1738856
<reponame>mikiboy/socian<filename>app.py """ Socian API """ import os from bson import json_util from pymongo import MongoClient, errors from chalice import Chalice, Response, BadRequestError app = Chalice(app_name='socian', debug=True) @app.route('/', cors=True) def index(): """index view""" return Response(...
StarcoderdataPython
158319
<filename>model/model.py<gh_stars>1-10 import sys,os import torch import torch.nn as nn import numpy as np from timeit import default_timer as timer import math import kornia from timeit import default_timer as timer from decimal import Decimal import options as opt import utils.query as query from utils.nnutils import...
StarcoderdataPython
1790558
import logging import tornado.web from gryphon.dashboards.handlers.admin_base import AdminBaseHandler from gryphon.dashboards.handlers.mixins.start_and_end_time import StartAndEndTimeMixin from gryphon.lib.gryphonfury import fees logger = logging.getLogger(__name__) class FeesDashboardHandler(AdminBaseHandler, Sta...
StarcoderdataPython
3364334
version = '1.0.126'
StarcoderdataPython
126065
from torch.nn.modules.loss import _Loss import torch from enum import Enum from typing import Union class Mode(Enum): BINARY = "binary" MULTICLASS = "multiclass" MULTILABEL = "multilabel" class Reduction(Enum): SUM = "sum" MEAN = "mean" NONE = "none" SAMPLE_SUM = "sample_sum" # mean by s...
StarcoderdataPython
1689
import numpy as np import sys import os from PIL import Image from visu.helper_functions import save_image from scipy.spatial.transform import Rotation as R from helper import re_quat import copy import torch import numpy as np import k3d class Visualizer(): def __init__(self, p_visu, writer=None): if p_v...
StarcoderdataPython
1779870
<gh_stars>10-100 import pandas as pd def clean_know_2020(data: pd.DataFrame) -> tuple[pd.Series, pd.DataFrame]: data = data.copy() # Convert the data type to integer and fill the missing values. for i in range(1, 45): data[f"saq{i}_1"] = data[f"saq{i}_1"].astype(int) data[f"saq{i}_2"] = d...
StarcoderdataPython
143955
# Copyright 2019 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
StarcoderdataPython
23010
<reponame>MarvinT/morphs import pandas as pd import numpy as np import morphs from six import exec_ from pathlib2 import Path from joblib import Parallel, delayed # adapted from klustakwik # NEVER POINT THIS AT SOMETHING YOU DONT TRUST def _read_python(path): assert path.exists() with open(path.as_posix(), "r...
StarcoderdataPython
1651856
import random import sqlalchemy as sa import string import time SIZE = 1024 NUM = 1024 METADATA = sa.MetaData() TABLE = sa.Table( "data", METADATA, sa.Column("id", sa.Integer(), primary_key=True), sa.Column("data", sa.String(), nullable=False), ) url = "sqlite:///concat.db" engine = sa.create_engine(url...
StarcoderdataPython
3213250
from rest_framework import status from rest_framework.decorators import api_view, permission_classes, authentication_classes from rest_framework.response import Response from itdtool import account_repo from itdtool.tasks.gtrends_task import get_cat_suggestions, get_autocomplete, get_gtrends from validate_ip import val...
StarcoderdataPython
3288803
""" Copyright 2020 Inmanta Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
StarcoderdataPython
3252034
from setuptools import setup, find_packages setup( name = 'tiny_elephant', packages = find_packages(), version = '0.1.3', description = 'In memory based collaborative filtering', author = '<NAME>', author_email = '<EMAIL>', url = 'https://github.com/kyunooh/tiny_elephant', download_url ...
StarcoderdataPython
3398900
import math # TC: O(mxn) | SC: O(1) def solution_1(arr_1, arr_2): index_1 = 0 index_2 = 0 while index_1 < len(arr_1): if arr_1[index_1] >= arr_2[index_2]: arr_1[index_1], arr_2[index_2] = arr_2[index_2], arr_1[index_1] # After each swap sort the arr_2. arr_2.s...
StarcoderdataPython
3312671
import io import backoff from google.api_core.exceptions import NotFound, PreconditionFailed from google.cloud import storage UTF_8 = "utf-8" def upload_text(bucket_name: str, blob_name: str, content: str): storage_client = storage.Client() bucket = storage_client.bucket(bucket_name) blob = bucket.blob(...
StarcoderdataPython
4835658
from typing import Any, Optional import psycopg2 from pypandas_sql.dbconnector.db_connector import DBConnector from utils import config_helper, credential_helper, filepath_helper __CREDENTIALS__ = 'credentials' __ENGINE_NAME__ = 'redshift+psycopg2' class RedshiftConnector(DBConnector): def __init__(self) -> N...
StarcoderdataPython
1618457
<filename>law/workflow/local.py # coding: utf-8 """ Local workflow implementation. """ __all__ = ["LocalWorkflow"] from law.workflow.base import BaseWorkflow, BaseWorkflowProxy from law.util import DotDict class LocalWorkflowProxy(BaseWorkflowProxy): """ Workflow proxy class for the local workflow impleme...
StarcoderdataPython
197995
<reponame>Nikulinnn/sphinx-copybutton """A small sphinx extension to add "copy" buttons to code blocks.""" from pathlib import Path from sphinx.util import logging __version__ = "0.3.1" logger = logging.getLogger(__name__) def scb_static_path(app): app.config.html_static_path.append( str(Path(__file__)....
StarcoderdataPython
3362191
<filename>hideout/env.py import os import distutils.util import hideout # # NOTE: Deprecated. Please use HIDEOUT_CACHE_DIR # Base directory for storing cache files generated by hideout. # HIDEOUT_BASE_DIR = os.getenv('HIDEOUT_BASEDIR', './caches') def set_cache_dir(): if HIDEOUT_BASE_DIR != './caches': ...
StarcoderdataPython
3270547
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_jupyter_utils ---------------------------------- Tests for `jupyter_utils` module. """ import sys import unittest class TestJupyter_utils(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_000_something(sel...
StarcoderdataPython
169858
<filename>looking_for_group/discord/provider.py<gh_stars>0 from allauth.socialaccount.providers.discord.provider import DiscordAccount, DiscordProvider class DiscordGuildAccount(DiscordAccount): pass class DiscordProviderWithGuilds(DiscordProvider): ''' Adds the guild scope to the Oauth request. '''...
StarcoderdataPython
117282
""" Libraries for handling molecular property calculations """ from automol.prop._wfn import total_dipole_moment from automol.prop._wfn import total_polarizability from automol.prop import freq __all__ = [ 'total_dipole_moment', 'total_polarizability', 'freq' ]
StarcoderdataPython
3348607
<filename>io_scene_vrm/importer/blend_model.py """ Copyright (c) 2018 iCyP Released under the MIT license https://opensource.org/licenses/mit-license.php """ import base64 import contextlib import copy import itertools import json import math import os.path import secrets import shutil import string import struct im...
StarcoderdataPython
2922
<reponame>Mindelirium/foundation<gh_stars>0 from cms.api import get_page_draft from cms.toolbar_pool import toolbar_pool from cms.toolbar_base import CMSToolbar from cms.utils import get_cms_setting from cms.utils.permissions import has_page_change_permission from django.core.urlresolvers import reverse, NoReverseMatch...
StarcoderdataPython
1631123
<filename>pytorch_translate/research/adversarial/experiments/scripts/unk-to-typo.py #!/usr/bin/env python3 import argparse import random import sys def load_dictionary(filename): """Loads a pytorch_translate dictionary""" dic = set() with open(filename, "r") as df: for line in df: # T...
StarcoderdataPython
1786031
<gh_stars>0 class Url: # Url's url_meet = 'https://meet.google.com/rjv-tajd-syt' url_gLogin = 'https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1#identifier' class Xpath: # XPaths em...
StarcoderdataPython
1721752
from datetime import timedelta from fastapi import FastAPI, Depends, HTTPException, status from fastapi.security.oauth2 import OAuth2PasswordRequestForm from fastapi.responses import HTMLResponse from .logger import logger from .logs.main_messages import * from .models.security_models import * from .dependencies.secu...
StarcoderdataPython
1706540
<gh_stars>0 import sys import traceback import numpy as np # Concept: Define coordinate frames, # Then define relations between these frames. # For now relations are concrete, but in future # they might include uncertainty. # # Note: So long as only a single path from any frame a to any other # frame b exists,...
StarcoderdataPython
21681
import json from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, FileType from pathlib import Path def main(): parser = ArgumentParser(description='Collect markdown files, and write JSON.', formatter_class=ArgumentDefaultsHelpFormatter) project_path = Path(__file__)....
StarcoderdataPython
1696864
import codecs __author__ = 'xubinggui' try: f = open('/Users/xubinggui/Downloads/test.txt', 'r') print f.read() finally: if f: f.close() with open('/Users/xubinggui/Downloads/test.txt', 'rb') as f: print f.read().decode('UTF-8') with codecs.open('/Users/xubinggui/Downloads/test.txt', 'r') as...
StarcoderdataPython
133109
import argparse import csv from itertools import combinations from pathlib import Path from dcctools.config import Configuration parser = argparse.ArgumentParser( description="Tool for scoring household linkage results" ) parser.add_argument( "--dotools", nargs=1, required=True, help="data-owner-tools project...
StarcoderdataPython
3356102
<reponame>ASVIEST/paud try: from mpmath import log except ImportError: from math import log def bytes_needed(n): if n == 0: return 1 return int(log(n, 256)) + 1 class Frame: __slots__ = "value" def __init__(self, value): if isinstance(value, bytes): self.value = ...
StarcoderdataPython
3377950
<filename>Model/ligandScreenExtractConditions.py import torch import pandas import numpy ligandInput = pandas.read_csv('data/ligandScreen-Ligands.tsv', sep='\t', low_memory=False, index_col=0) inName = ligandInput.columns.values ligandInput = ligandInput.loc[:,inName] sampleName = numpy.array(ligandInput.index.values)...
StarcoderdataPython
4804679
<gh_stars>1-10 from django.urls import path from . import account_activator from .views import (LoginAPIView, RegistrationAPIView, UserRetrieveUpdateAPIView, ResetPasswordAPIView, ConfirmResetPassword, ResetPasswordDoneAPIView, SocialAuth) # App name for the namespace in Django...
StarcoderdataPython
3300577
<filename>daikin/daikin.py """ http://rdlab.cdmt.vn/project-2013/daikin-ir-protocol http://www.mcmajan.com/mcmajanwpr/blog/2013/10/21/ir-daikin-decodificare-protocolli-infrarossi-complessi/ https://github.com/blafois/Daikin-IR-Reverse https://github.com/mjg59/python-broadlink """ import logging import binascii import ...
StarcoderdataPython
3361123
<filename>cake/helpers.py<gh_stars>1-10 import typing import cake import copy as cd from cake import abc __all__ = ("convert_type", "compare_multiple", "compare_any", "copy") def convert_type( result: typing.Any, check_value_attr: bool = True, *args, **kwargs ) -> object: """ Returns an object of the sp...
StarcoderdataPython
1688835
<gh_stars>1-10 #!/usr/bin/env python3 from setuptools import setup, find_packages import versioneer with open('README.md') as f: readme = f.read() dependencies = [] with open('requirements.txt', 'r') as f: for line in f: dependencies.append(line.strip()) setup( name='datatracker', version=ve...
StarcoderdataPython
1669768
<filename>Density_of_Live_Grids.py # -*- coding: utf-8 -*- """ Created on Sun Mar 17 04:46:52 2019 @author: karad """ import numpy as np image = np.loadtxt('iteration_9.txt',bool) count=0 for i in range(image.shape[0]): for j in range(image.shape[1]): if (image[i][j]==1): count +=1 proportio...
StarcoderdataPython
1789743
import json import datetime import re from peewee import * from playhouse.shortcuts import model_to_dict db = SqliteDatabase(None) def copy_keys(a, b, args): for key in args: a[key] = b.get(key, None) return a def del_keys(d, args): for key in args: if key in d: del d[key] ...
StarcoderdataPython
99398
from pypeflow.io import ( syscall, capture, cd, mkdirs, symlink, rm, touch, filesize, exists_and_not_empty) # needed? import contextlib import io import logging import os import pprint import sys if sys.version_info >= (3, 0): NativeIO = io.StringIO else: NativeIO = io.BytesIO LOG = logging...
StarcoderdataPython
27801
<reponame>YigeWang-WHU/BlastLoadsRegression import os import pickle as pickle import datetime import time # from contextlib import contextmanger import torch from torch.autograd import Variable import random import numpy as np def time_str(fmt=None): if fmt is None: fmt = '%Y-%m-%d_%H:%M:%S' return dat...
StarcoderdataPython
172489
<reponame>closedLoop/whatsnext<filename>whatnext/graph.py import datetime import logging from typing import List import networkx as nx from .storage.file_storage import load_from_file, save_to_file logger = logging.getLogger(__file__) def sort_nodes( graph: nx.DiGraph, sort_by: str = "importance", limi...
StarcoderdataPython
3303107
<filename>tests/top_movies_serial.py import sys import re import time import itertools import logging import requests import pandas as pd from requests.exceptions import HTTPError from bs4 import BeautifulSoup df = pd.DataFrame(columns=['url', 'rank', 'title']) urls = set(['https://www.imdb.com/chart/top', ...
StarcoderdataPython
3281404
import argparse def parse_args(): """ Parsing arguments """ parser = argparse.ArgumentParser() parser.add_argument("--input_dataset_path", type=str, required=True) parser.add_argument("--input_csv_path", type=str, required=True) parser.add_argument("--input_image_csv_path",type=str, re...
StarcoderdataPython
3341251
<filename>cracking-the-coding-interview/tests/chapter1/test_checkManipulate.py import pytest from chapter1 import checkManipulate as t def test_checkManipulate(): assert t.checkManipulate('ab', 'abb') is True assert t.checkManipulate('ab', 'abc') is True assert t.checkManipulate('abdb', 'abb') is True assert t...
StarcoderdataPython